Skip to Content
It is currently March 1st, 2021, 4:55 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: January 2nd, 2021, 3:38 pm 
Offline
New User
New User

Joined: January 2nd, 2021, 1:43 pm
Posts: 4
Been a customer using pretty much generic Sam for 3 years. It's time to fine-tune some things. I keep looking for a PAL reference beyond the Quick Start on Spacial Support page. Oldsters, please laugh at me now.

For instance, I am trying to copy a file from an http location to a local location, so I can add it to the queue at some point. File is very large, and suspect internet is hindering playing from server. Then I want to delete that file at a later point. I see oblique references in the forum about CopyFile and DeleteFile commands, but can't find any documentation for syntax.

I'm quite content to experiment, but needing reference help. I appreciate any guidance you can provide.


Top
 Profile  
Reply with quote  
PostPosted: January 5th, 2021, 8:40 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8154
Location: Cologne (Germany)
Happy new year.

baskins777 wrote:
I'm quite content to experiment, but needing reference help. I appreciate any guidance you can provide.


Check out the PAL Scripting reference available from the help menu of the PAL IDE (and I think the generic SAM help menu as well).

It's basically a dictionary for all the available functions in PAL.

For Downloading a file you can either use WebToFile or try the THttp component. (The later is a more modern solution, but is a full-fledged HTTP library instead of a simple file download method)

CopyFile and DeleteFile are only useful for files you already have on your computer.

The PAL scripting reference also has examples for most of the included functions. They don't explain all the edge cases, but should be enough to understand the basics.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 8th, 2021, 2:02 pm 
Offline
New User
New User

Joined: January 2nd, 2021, 1:43 pm
Posts: 4
Thank you very much. Part of my issue was when I clicked on Help, it takes me to Spacial Web site. I've now found the guide, and experimenting with WebToFile. I keep getting error when I compile, saying "More Arguments Expected" so I am experimenting with syntax. From the description, it seems that it should be pretty straightforward.


Top
 Profile  
Reply with quote  
PostPosted: January 9th, 2021, 1:13 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8154
Location: Cologne (Germany)
If you have any particular problems, please open a new thread (if you have multiple at once, just pick one for the title and combine them in one post), I'll be glad to help and sometimes others have an idea as well.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 9th, 2021, 2:23 pm 
Offline
New User
New User

Joined: January 2nd, 2021, 1:43 pm
Posts: 4
I *think* I've got it, but would appreciate advice as to whether I need to do something else. I thought it should be simple! This is the script:
Code:
PAL.LockExecution;
const File_Local  = 'C:\Users\baski\Documents\TESTINGCOPY.mp3';
const File_Remote = 'http://www.SERVERLOCATION/testing/TESTINGCOPY.mp3';
WebToFile(File_Local,File_Remote);

PAL.UnlockExecution;


It will just copy the file over the existing one, which is fine. It will run once weekly, and the person who uploads the file will know the timing. Then, in a different process, we add that file to the queue to play at a specified time.

Is there anything else I need to add to my script? I know this is simple, but the very first PAL script process I've ever tried to write!


Last edited by Mastacheata on January 9th, 2021, 8:13 pm, edited 1 time in total.
Added CODE tags around code block, please use these yourself next time


Top
 Profile  
Reply with quote  
PostPosted: January 9th, 2021, 8:28 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8154
Location: Cologne (Germany)
Functionally, there's nothing wrong with your code.

The LockExecution/UnlockExecution stuff is useless here, though.
If you leave those commands out, SAM will execute PAL statements only once per second.
In your case, you only have one statement - WebToFile - and 2 variable definitions which are always executed at the very beginning of the script and don't take up any time after that.

For the most part, 1 statement = 1 function/procedure call in PAL (i.e. WebToFile, Queue.AddFile, ...) or Operation (i.e. WHILE x DO is one and whatever is repeated is counted seperately)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 10th, 2021, 9:26 am 
Offline
New User
New User

Joined: January 2nd, 2021, 1:43 pm
Posts: 4
Got it. Thank you very much for your help!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group