Timeout of revCopyFolder

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jhelle
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Thu Oct 26, 2006 10:21 pm

Timeout of revCopyFolder

Post by jhelle » Fri Oct 08, 2010 5:17 pm

Hi,

when I copy a folder with revCopyFolder, it has a timeout after 2 Minutes. Using MacOSX 10.6.4
The copying in the finder goes on, but Rev does not wait until it is finished.
But it has to wait, because after the copying, the script should zip the destination Folder.
I think, this is the AppleScript timeout, because revCopyFolder uses Applescript.
Normally, if I use AppleScript directly, i can modify the timeout by using the "with timeout of..."
But how can I modify the timeout here?
Thanks for help!
Greetings from Germany

Jürgen Helle

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timeout of revCopyFolder

Post by bn » Fri Oct 08, 2010 6:53 pm

Hi Jürgen,
you could do the applescript yourself and send it from Livecode with a return message that will show up in the result. I hope the timeout will not interfere with this.
An easier way to do it is probably to wait after the revCopyFolder with a "wait 30 seconds with messages" in a repeat loop that looks up the number of files in the copied folder and exits when all files are copied. This number is compared to the number of files of the original folder before the copying. You can get at the number of files by setting the defaultFolder to the folder to copy and get "the files" this gives you a list of the filenames. You just count the number of lines of that list.
Of course if you have folders inside of the folder you could drill down and repeat the setting of the defaultFolder to the inside folders and getting the files.
You might want to look up "defaultFolder", "Files" and "Folders" in the dictionary.
Before testing for the number of files in the destination folder/folders it is alway advisable to test for the presence of the folder: if there is a folder "pathToFolder"

That is probably what I would do (maybe I would try the applescript version first) Applescript and Rev work very nicely. It is just tiresome to escape/put quotes around the applescript. So what I do is I test the applescript in the script editor (or in my case I use Script Debugger which is a lot more powerful) to make shure it is working. I declare variables / fill them at the beginning, like pathnames and so on for testing. Then I take the body of the script and put it into a rev field. In the revscript I only declare the variables and then append the body of the applescript in the script. Having all this in one variable and then sending it off to applescript with the do xyz as applescript. Works very well. Just watch out for the pathnames but there is a function "revMacFromUnixPath" (dictionary) that helps. You find an example of what I was trying to explain here: http://forums.runrev.com/phpBB2/viewtop ... +bn#p22151

regards
Bernd

jhelle
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Thu Oct 26, 2006 10:21 pm

Re: Timeout of revCopyFolder

Post by jhelle » Mon Oct 11, 2010 6:36 pm

Hi Bernd,

thank you very much for your Ideas, it is possibly a good idea, to do it with AppelScript directly, but i hoped that it would also be possible to change the timeout of revCopyFolder somewhere ;-) That would be the easiest way.

Jürgen

Post Reply