Browse and Copy files

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Browse and Copy files

Post by bidgeeman » Thu May 14, 2009 11:52 am

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

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

Post by bn » Thu May 14, 2009 12:36 pm

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

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Thu May 14, 2009 12:43 pm

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
Last edited by bidgeeman on Fri May 15, 2009 3:09 am, edited 1 time in total.

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu May 14, 2009 4:42 pm

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

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu May 14, 2009 5:19 pm

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

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu May 14, 2009 5:51 pm

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!)

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

Post by bn » Thu May 14, 2009 6:02 pm

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

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Thu May 14, 2009 9:08 pm

Thank you Bernd, I didn't know some of that so it all helps!

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

:)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Fri May 15, 2009 3:47 am

Is it possible for Runrev to join/stitch two audio files together without using an external plugin like QT External?

Cheers
Bidge

Post Reply