revCopyFile Problem
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
revCopyFile Problem
Greetings All,
I am writing a script (Mac OS X) that will copy multiple audio files from one folder to another. I want to use a scrollbar to show the progress when copying more than one file. I've done this with smaller text files, and it worked fine.
However, with these audio files, Revolution waits until all the files are copied, then it executes the incremental changes to the scrollbar very quickly, and all at once (bing, bing, bing). I've tried various iterations of the "wait" command right after the revCopyfile line to force a pause, but nothing seems to work.
repeat with x = 1 to (number of lines in filesXX)
set the thumbposition of scrollbar "Copy Status" to x
-- SET FILEAA
-- SET FILEBB
revcopyfile fileAA,fileBB
end repeat
Can anyone help?
Thanks!
John Miller
I am writing a script (Mac OS X) that will copy multiple audio files from one folder to another. I want to use a scrollbar to show the progress when copying more than one file. I've done this with smaller text files, and it worked fine.
However, with these audio files, Revolution waits until all the files are copied, then it executes the incremental changes to the scrollbar very quickly, and all at once (bing, bing, bing). I've tried various iterations of the "wait" command right after the revCopyfile line to force a pause, but nothing seems to work.
repeat with x = 1 to (number of lines in filesXX)
set the thumbposition of scrollbar "Copy Status" to x
-- SET FILEAA
-- SET FILEBB
revcopyfile fileAA,fileBB
end repeat
Can anyone help?
Thanks!
John Miller
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
Have you set the endValue of your scrollbar before entering the loop?
Mark
Code: Select all
set the endValue of sb "Copy Status" to the number of lines in filesXX
Best,repeat with x = 1 to (number of lines in filesXX)
set the thumbposition of scrollbar "Copy Status" to x
-- SET FILEAA
-- SET FILEBB
revcopyfile fileAA,fileBB
end repeat
Mark
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
John, I tried this myself, and the progress bar seemed to update as I'd expect. This is the actual code I used (not substantially different from yours, I think). I added the 'put' line as another way of seeing the progress.
This is using 2.8.1 and 2.9 beta on OS X 10.4 macintel.
Hope we can figure it out...
Best,
Mark
Code: Select all
on mouseUp
put "/Users/marksmith/Desktop/AudioFiles/" into sFo
put "/Users/marksmith/Desktop/Archive/" into dFo
set the directory to sFo
put the files into fList
filter fList without ".*"
set the endvalue of sb "prog" to the number of lines in fList
repeat with n = 1 to the number of lines in fList
set the thumbpos of sb "prog" to n
put sFo & line n of fList into sFile
put dFo & line n of fList into dFile
put sFile & cr & dFile -- see if this shows what you'd expect
revCopyFile sFile, dFile
end repeat
end mouseUp
Hope we can figure it out...
Best,
Mark
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
Mark,
Again, thanks for your response.
I duplicated your script. Mine is already pretty much the same.
I ran the script with no change in behavior.
The copies are made successfully which would indicate that the file locations are correct. However, things still don't happen in the order I would expect. First I get a spinning beach ball while the copies are being made. Then after the copies are complete. the progress bar is updated one step at a time as Mac OS X rings out the copy complete sound.
My files are MP3 files that are about 2MB each. Would this make a difference?
- John
Again, thanks for your response.
I duplicated your script. Mine is already pretty much the same.
I ran the script with no change in behavior.
The copies are made successfully which would indicate that the file locations are correct. However, things still don't happen in the order I would expect. First I get a spinning beach ball while the copies are being made. Then after the copies are complete. the progress bar is updated one step at a time as Mac OS X rings out the copy complete sound.
My files are MP3 files that are about 2MB each. Would this make a difference?
- John
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
I'd have thought the size of the files should make no difference.
My test was on a folder of WAVs, AIFs and mp3s.
You could try changing the revCopyFile for a shell call:
Maybe you could post the actual code?
Best,
Mark
My test was on a folder of WAVs, AIFs and mp3s.
You could try changing the revCopyFile for a shell call:
Code: Select all
get shell("cp" && quote & sourceFile & quote && quote & destFile & quote)
Best,
Mark
-
- Posts: 116
- Joined: Mon Apr 30, 2007 3:33 pm
Mark,
I think I found the problem. My code is embedded within a dragdrop handler, and that seems to be the problem. If I use the exact same code from within a button, everything works great.
I tried dragging different types of files that I wanted to copy and I had the same problem with all of them. The glitch seems to be using the revcopyfile inside the dragdrop handler.
I'll still do the dragdrop, but add a confirmation button. That should solve my problem.
Thanks for your interest.
- John
I think I found the problem. My code is embedded within a dragdrop handler, and that seems to be the problem. If I use the exact same code from within a button, everything works great.
I tried dragging different types of files that I wanted to copy and I had the same problem with all of them. The glitch seems to be using the revcopyfile inside the dragdrop handler.
I'll still do the dragdrop, but add a confirmation button. That should solve my problem.
Thanks for your interest.
- John
Hi John,
First run your script to handle the drag-and-drop. In this script, add a line
send "copyFiles" to me in 0 millisecs
Use the copyFiles handler to do everything related to copying and to set the thumbPos of the progress bar. This will work.
Best,
Mark
First run your script to handle the drag-and-drop. In this script, add a line
send "copyFiles" to me in 0 millisecs
Use the copyFiles handler to do everything related to copying and to set the thumbPos of the progress bar. This will work.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode