Page 1 of 2
Problem with RevCopyFile
Posted: Mon Jun 14, 2010 7:49 am
by Dixie
Good morning...
Is anybody able to tell me why the code below works when run in the IDE but not when running as a standalone under Mac OSX. The script creates the folders but the file and folder are not copied using revCopyFile and revCopyFolder.
Code: Select all
global gdefaultFolder
on mouseUp
if fld 1 is empty then exit mouseUp
answer folder "Select a folder in which to build the presentation"
if it is empty then exit mouseUp
set the defaultFolder to it
put it into theFolderPath
put line 1 of fld 1 into theFolderName
create folder theFolderName
create folder theFolderName & "/BernierResources"
create folder theFolderName & "/BernierResources/capitons"
create folder theFolderName & "/BernierResources/cercueils"
create folder theFolderName & "/BernierResources/cercueilsCroix"
create folder theFolderName & "/BernierResources/cercueilsEnfant"
create folder theFolderName & "/BernierResources/emblemes"
create folder theFolderName & "/BernierResources/urnes"
revCopyFile (gdefaultFolder & "/Bernier Master.rev"), (theFolderPath & "/" & theFolderName)
revCopyFolder (gdefaultFolder & "/BernierResources/BernierData"), theFolderPath & "/" & theFolderName & "/BernierResources"
rename (theFolderPath & "/" & theFolderName & "/Bernier Master.rev") to (theFolderPath & "/" & theFolderName & "/Presentation.rev")
put empty into fld 1
--open stack (theFolderPath & "/" & theFolderName & "/Presentation.rev")
end mouseUp
Any help would be appreciated...
Be well
Dixie
Re: Problem with RevCopyFile
Posted: Fri Dec 24, 2010 2:08 pm
by exheusden
Dixie, did you ever get revCopyFile and revCopyFolder to work correctly?
I, too, am using MacOS X and revCopyFile copies nothing; revCopyFolder, on the other hand, copies the folder, but not its contents.
Re: Problem with RevCopyFile
Posted: Mon Dec 27, 2010 6:45 am
by interactbooks
I'm having the exact same problem with revCopyFile on OS/X. Works in IDE but gives an error when running stand alone. Any ideas?
Re: Problem with RevCopyFile
Posted: Mon Dec 27, 2010 7:36 am
by WaltBrown
In the original post, Dixie, you use "gdefaultfolder" but don't set it anywhere. Could that be an issue?
Walt
Re: Problem with RevCopyFile
Posted: Mon Dec 27, 2010 11:04 am
by exheusden
After much testing, I gave up on RevCopyFile and looked for another solution. I finally achieved what I wanted with AppleScript:
Code: Select all
tell application "Finder"
set theSourceFile to POSIX file (do shell script "echo " & "#fileToCopy#") as alias
set theDestinationFolder to POSIX file (do shell script "echo " & "#destinationPath#") as alias
duplicate file theSourceFile to folder theDestinationFolder replacing true
end tell
I put the above code in a hidden field. These contents I put into a variable in my RunRev script (e.g. appleScriptInit) and substitute my placeholders #fileToCopy# and #destinationPath# with the appropriate values in a RunRev script, then execute a
Code: Select all
do appleScriptInit as "applescript"
It works fine.
I do much the same for folders, with just a slight modification to the Apple Script code.
Re: Problem with RevCopyFile
Posted: Mon Dec 27, 2010 7:48 pm
by interactbooks
Thank you Exheusden! Your solution is perfect and it solved my problem.
Re: Problem with RevCopyFile
Posted: Mon Dec 27, 2010 9:34 pm
by exheusden
Glad to have been of some help, interactbooks.
Re: Problem with RevCopyFile
Posted: Tue Dec 28, 2010 6:52 pm
by wsamples
The conclusion that revCopyFile does not work in OS X is not supported by what I see here.
A one button application that runs a simple script with "answer file to copy", "answer destination directory" and "revCopyFile selectedfile,selectedDestination" works in both the IDE and as a standalone in 10.6.3. The standalone works in 10.6.3 whether the app is produced in OS X or in Linux.
A similar simple app which creates the destination directory instead of selecting an already existing one also works as expected.
An app made to select and then copy a file into [theApp.app]/Contents/MacOS directory of the standalone, using effective filename of this stack, etc. syntax, also successfully copies to this location for me.
With all due respect, is it not possible that you are having trouble with filepath names? Are the files and folders you're copying actually where you're telling the script to look, both working with the stack in the IDE and after you've made the standalone? Are all the various created pathnames correct; no extra slashes or misplaced quotes? Perhaps adding some mechanism to show the pathnames of all files and directories at each step of the operation, and whether or not the files to be copied are actually found in their specified locations at the time of the operation, would reveal such problems.
(edit -- I apologize for cross-posting this. It was inadvertent. There has been some cross-posting of this topic as well as some cross-referencing to another thread, which is where I had originally intended to post this. Tabbed browsing... If it's ok with the mods, it might be useful to allow it stay here, too, though, because it is relevant to the topic.)
Re: Problem with RevCopyFile
Posted: Wed Dec 29, 2010 4:56 am
by interactbooks
This was using the exact same files, and the exact same folders, correct path names, correct file names. The alternate solution suggested by another poster worked perfectly using the Apple Script that he supplied. I wish I could better narrow down this issue, but the bottom line is this, it works in the IDE but does not work in a stand alone application and I'm not the only one who has reported this issue. There is obviously a problem going on with the revCopyFile which is causing this bug to occur. I'd love to lay blame on something as simple as an extra quote or misspelled file name but this is simply not the case.
Re: Problem with RevCopyFile
Posted: Wed Dec 29, 2010 12:43 pm
by Dixie
Interactbooks...
I don't think that there is any problem with revCopyFile. I have attached a stack that works both in the IDE and as a standalone if you compile it...
be well
Dixie
Re: Problem with RevCopyFile
Posted: Wed Dec 29, 2010 10:41 pm
by interactbooks
Thank you Dixie, I will test it and get back to you.
Re: Problem with RevCopyFile
Posted: Wed Dec 29, 2010 11:09 pm
by interactbooks
Dixie,
The code you sent works like a charm both in Stand Alone as well as in the IDE. My code is still not working in stand alone, which leads me to think that I am missing a dependency. Since I am using a third party tree stack in my application I had to turn off the "Search for required inclusions" option (according to their instructions). Although I did select every library that logically looked like my application uses. Do you have any idea what library file the revCopyFile command is located in?
Thanks again for your support.
Regards,
Ezra
Re: Problem with RevCopyFile
Posted: Wed Dec 29, 2010 11:33 pm
by jmburnod
Hi All,
I tested the Dixies copystack.rev. It work well for me as stand alone
Tested with :
powerbook G4 OSX 10.4.2
iMac intel core duo OSX 10.5.6
All the best
Jean-Marc
Re: Problem with RevCopyFile
Posted: Sat Jan 01, 2011 1:06 pm
by Dixie
Ezra...
The revCopyFile is in the common library... I have sent you another stack that uses a 3rd party library, revCopyFile still works from the IDE and again if you compile it as a standalone..
be well
Dixie
Re: Problem with RevCopyFile
Posted: Sat Jan 01, 2011 4:23 pm
by interactbooks
Thank you again Dixie, my only thought on all this is that it must be related to the fact that I'm trying to copy files from my DropBox folder. DropBox actually caused me another problem relating to deployment so I'm thinking that this might be the culprit. It just makes no sense to me that it works in the IDE but the same exact files won't copy in the stand alone, so my only thoughts are that it relates to the environment. If I do discover anything else I will definitely update this thread.