Hi folks,
I’m a newbie in applescript programming and i need one script that have to mount a server disk and copy some files to that folder. And this is to be in time scheduled.
Can anyone help me with that??
Thanx a lot
Andre Tozzini
Hi folks,
I’m a newbie in applescript programming and i need one script that have to mount a server disk and copy some files to that folder. And this is to be in time scheduled.
Can anyone help me with that??
Thanx a lot
Andre Tozzini
I have done something similar…the code is below. Just change the specifics for your environment.
tell application "Finder"
--if you want to use an IP address instead of Rendezvous just replace it with the #
set ThisVolume to "afp://log:password@Rendezvous-Name.local/Hard Drive Name"
try
if (list disks) does not contain "Hard Drive Name" then mount volume ThisVolume
end try
try --this will reveal the drive in a Finder window
reveal folder "Hard Drive Name"
end try
end tell
To copy files I have this handler to be called when needed. You must specify a list of items to be moved and set the list to the variable theseItems. Then you must set the variable thisFolder to the folder on the mounted drive that you intent to move to.
on moveItems(theseItems, thisFolder)
--Input: theseItems is the list of items to be moved
-- thisFolder is the destination they are to be moved to
--Output: true or false based on success of the move
tell application "Finder"
set folderContents to name of folders of thisFolder
set itemName to name of theseItems
--check to see if the file to be moved already exists in the target folder
if folderContents does not contain itemName then
try
move theseItems to thisFolder --this is the line doing the work
return true
on error
error --put your error command here
return false
end try
else
display dialog ("The folder '" & itemName & "' already exists in '" & thisFolder & "'.")
end if
end tell
end moveItems
I’m also new to this AppleScript writing, but here’s a Script I’m using.
I’m trying to compress folders on my Mac G5 (OSX), and place them on the server for archival. There’s a problem I’m having with this though. When the folders are large and take a while to compress…they get an “AppleEvents timed out” error. Does anyone know how to disable the AppleEvents timeout pref? Or, another way of doing this.
thanks,
I know you can tell a script to delay execution of the next command, making it wait for a specified time. Just add the following anywhere you want the script to pause:
delay 600
--this will delay the script for 600 seconds
I am not sure how to do a conditional pause to make the script wait for an operation to complete before continuing. I would be interested if anyone knew how to do this.
It might work to use a handler to verify if a file is busy, having it check to see if your Stuffit file is still being used or not. The script could halt until this handler verifies the file is no longer being used, and then continue. I have not had much luck with the “is busy” command, but once again, if anyone has had success with this I would be interested in seeing how is was done.
Hope these help in working towards a solution.
jON bEEBE