revCopyFile and revCopyFolder to the "desktop"

Francis Nugent Dixon effendi at wanadoo.fr
Thu Jan 18 06:38:26 EST 2007


Hi from Paris,

I am confused about the commands "revCopyFile" and "revCopyFolder", on 
both my Mac and on my PC, especially in the context of "desktop". I 
want to create files, folders and shortcuts on the Mac and PC desktops.

I am using Revolution DreamCard 2.6.1, build 152 on my Mac, and 
StackRunner 1.3.0.0 on my PC. I develop my stack on the Mac, and run it 
on both Mac and PC.

Here we go :

For "revCopyFile" and "revCopyFolder", documentation says " If you 
specify a name but not a location, Revolution assumes the destination 
file/folder is the defaultFolder." Does this mean that if the " 
folderToCopyTo " or "destinationFolder" DOES NOT begin with a "/", then 
defaultFolder is used as the destination folder ?

Supposing that this is true : revCopyFile 
"/MyFolder/MyFile.rev","MyFile.rev" could be used to create a copy on 
my desktop ...........

So I coded :

      put specialFolderPath("DeskTop") into GVDeskTop
      set the defaultFolder to GVDeskTop
      revCopyFile "/MyFolder/MyFile.rev","MyFile.rev"

On my Mac, GVDeskTop contains "/Users/francisdixon/Desktop"
On my PC, GVDeskTop contains "C:/Documents and 
Settings/francisdixon/Desktop"

Because of my understanding of the documentation, I thought I would 
create a copy of my file on the deskTop. It didn't work ! The command 
appeared to execute, but no trace of my new file could be found, either 
on the desktop (or anywhere else on the disk). The Result showed no 
error.

So I tried trickery and subterfuge (this is a built-in function for an 
Irishman !), by naming the destination file specifically as the desktop 
:

      put specialFolderPath("DeskTop") into GVDeskTop
      put GVDeskTop & "/" & "MyFile.rev" into GVMyDestination
      revCopyFile "/MyFolder/MyFile.rev,GVMyDestination -- On the Mac
      OR
      revCopyFile "C:/MyFolder/MyFile.rev,GVMyDestination -- On the PC

This works on my Mac (the file appears immediately on the deskTop).
On the PC, the file DOES NOT appear on the deskTop, but DOES APPEAR in 
the desktop folder itself :

Is this because the PC desktop needs to be "refreshed" just like any 
other folder ? If so, how would I do this ?
When I rebooted my PC, my file then showed on the deskTop.

When I test "the Result" after a file copy, to see if the copy is 
successful, "the Result" should be empty (suggested by the 
documentation). I found that "the Result" contains the name of the file 
in quotes, after a successful copy. So how do I check for a failure in 
the copy ?

I assumed that a "revCopyFile" could be used to create a copy of a file 
with a new name (Why Not - It does not say that "fileToCopy" and 
"folderToCopyTo" must NOT use different filenames !). So I tried :

put specialFolderPath("DeskTop") into GVDeskTop
put GVDeskTop & "/" & "MyFile.rev" into GVMySendingFile
put GVDeskTop & "/" & "NewName.rev" into GVMyDestination
revCopyFile GVMySendingFile,GVMyDestination

On my Mac, this renames my original file on the desktop to 
"NewName.rev", and creates a file "MyFile.rev copy" on the desktop. As 
Alice once said -  "Curiouser and curiouser !" (I haven't yet bothered 
to test this on my PC).

I am also having problems creating a shortcut on the PC desktop, but I 
will experiment further before asking for help !

Has anybody got any experience with these commands, especially 
concerning the destination  "desktop" ?

-Francis

"Nothing should ever be done for the first time !"




More information about the use-livecode mailing list