Page 1 of 1

Browse and Copy files

Posted: Thu May 14, 2009 11:52 am
by bidgeeman
Hi.
I am a total beginner and trying to make a little stack that copies a wav file from one location to a user selected folder. I've gotten it to work between preset folders, as per the script below, but not sure how to get the file to copy to a user selected path.


On mouseUp
if the label of me is "Copy" then
answer folder "Please select a location to save to."
if it is not empty then
revCopyFile "C:\ring.wav","D:\Temp"
end if
else
pass mouseUp
end if
end mouseUp


I know this is very basic stuff but would greatly appreciete any help :)

Cheers
Bidge

Posted: Thu May 14, 2009 12:36 pm
by bn
Bidge,
try this:

Code: Select all

On mouseUp 
   if the label of me is "Copy" then 
      answer folder "Please select a location to save to." 
      if it is empty then exit mouseUp -- the user has  cancelled out

      -- it now contains the path to a folder, it is a good idea to put it into a variable
      -- because it is changing so often that one tends to forget, so as soon as you 
      -- fill it put it into something else

      put it into tDestinationFolder
      revCopyFile "C:\ring.wav",tDestinationFolder
   else 
      pass mouseUp 
   end if 
end mouseUp 
regards
Bernd

Posted: Thu May 14, 2009 12:43 pm
by bidgeeman
Bernd.

Thank you so much!!! It worked perfectly.
I really appreciate your help Bernard. God know's I've helped many people on forums in the past and you are proof that what comes around goes around.

Cheers
Bide

Posted: Thu May 14, 2009 4:42 pm
by gyroscope
Bidge, hope you don't mind me bustling in here...

Bernd, I tried your script on a Mac but the folder remains empty. Could you tell me why please :?:

Code: Select all

On mouseUp 
   if the label of me is "Copy" then 
      answer folder "Please select a location to save to." 
      if it is empty then exit mouseUp

      put it into tDestinationFolder 
      revCopyFile "4x4.wav",tDestinationFolder 
   else 
      pass mouseUp 
   end if 
end mouseUp

Posted: Thu May 14, 2009 5:19 pm
by Klaus
Hi gyroscope,

quick guess: the file "4x4.wav" is not in the current directory, so nothing gets copied?

Check "the directroy" or set the directory to the folder containing that file or supply an absolute path to the file.


Best

Klaus

Posted: Thu May 14, 2009 5:51 pm
by gyroscope
Thanks for the suggestions Klaus, unfortunately no joy there.

I added

Code: Select all

 set the defaultFolder to "/Hard Disk/sound file"
set the defaultFolder to it
which finds the folder directly, which is nice.

But importing the audio file as control or putting it into a player, either way it doesn't copy into the folder.

(I know this was originally Bidge's prob but I like to learn bits of Rev whenever I can!)

Posted: Thu May 14, 2009 6:02 pm
by bn
Hi Gyroscope,

I am with Klaus on this.

you could try to add:

Code: Select all

on mouseUp
  answer file "Select the file to copy" 
  if it is empty exit mouseUp
  put it into myFileToCopy
  -- more code
  revCopyFile myFileToCopy,tDestinationFolder
  -- more code
end mouseUp
just indicating the file only works for the defaultFolder, which is usually in the Rev folder in the program folder. If you set the defaultfolder by going:

Code: Select all

answer folder "Select the folder of Origin" 
put it into myNewDefault
set the defaultFolder to myNewDefault 
than you can just refer to the files in this folder by their names. Rev adds the path.
And once you set the defaultFolder to the folder you want you can than tell Rev

Code: Select all

put the files into tAllFilesOfmyDefaultFolder
Rev puts the name of every file into the variable tAllFilesOfmyDefaultFolder.

You probably know all this but I explained it in a little more detail because when I started with Rev I had to come to grips with Rev's concept of the default folder.

regards
Bernd

Posted: Thu May 14, 2009 9:08 pm
by gyroscope
Thank you Bernd, I didn't know some of that so it all helps!

Thanks also to Bidge as I "tagged" his thread.

:)

Posted: Fri May 15, 2009 3:47 am
by bidgeeman
Is it possible for Runrev to join/stitch two audio files together without using an external plugin like QT External?

Cheers
Bidge