Transferring files with AppleScript??

Discussion in 'Mac Basics and Help' started by j26, May 6, 2006.

  1. j26 macrumors 65832

    j26

    Joined:
    Mar 30, 2005
    Location:
    Paddyland
    #1
    Please bear in mind I know nothing about Applescript, but I was wondering if this is possible.

    Can I set a script that when I connect my pda (a Pocket PC uning Missing Sync to mount, connecting via usb) to my pb, can I set up a script to automatically run to transfer files from a folder in my pb to a folder in the pda? It wouldn't need to be smart, comparing which has the most current, just a dump of all the files into the folder, overwriting the ones currently there if necessary.
    If it were to do it automatically on connection it would be lovely, but if I had a script on the desktop that I just have to click it would be fine.

    Would this be easy (and fast) to do. and if it is, how would I go about it? Exams start in 9 days, so I don't have loads of time to work on it.

    To let you know what I'm doing - I'm using VoodooPad to revise my notes into a mini wiki so I have summarised notes, and immediate access to the detailed info behind them (studying law, so case details is an obvious application here). I want to be able to have up to date notes on my pda, so I have immediate access wherever I go.


    If anyone can help me, I owe you a pint/favour/my second born (you can't have my first)
     
  2. funkychunkz macrumors 6502a

    funkychunkz

    Joined:
    Jun 1, 2005
    Location:
    Ottawa, Canada
    #2
  3. j26 thread starter macrumors 65832

    j26

    Joined:
    Mar 30, 2005
    Location:
    Paddyland
    #3
    It mounts and I can view it through Finder if that's what you mean.
     
  4. mduser63 macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #4
    Then yes, it's possible. It would look something like this:

    Code:
    tell application "Finder"
    	copy every item of folder "whatever1" of folder "whatever2" of folder "yourusername" of folder "Users" of startup disk to folder "destination" of folder "pocket PC" of disk "nameofPPCvolume"
    end tell
    I'm not guaranteeing that that's exactly right, as I (obviously) haven't tested, and I wrote it off the top of my head. I think it's right though. You will of course have to change all the folder names appropriately, but that should give you the basic structure of the script. As for making it work automatically on mount, it very well may be possible, but I'm not sure how to do it. The script above should be saved as an application, then you can either put it in your dock or on your desktop and just double click on it to run. You can also enable the Scripts menu in your menu bar and put it in there (HOME->Library->Scripts).

    Hope this helps.
     
  5. funkychunkz macrumors 6502a

    funkychunkz

    Joined:
    Jun 1, 2005
    Location:
    Ottawa, Canada
    #5
    Okay, basics of applescript here:

    Code:
    tell application "Finder"
    	move "PB drive:Users:j26:documents:notes" to disk "PDA NAME" of application "Finder"
    	
    end tell
    
    
    Make sure there are no spaces between the folder (or file) names and the colons. The volume name must be capitalized if it normally is.

    Just copy this with the proper addresses into applescript editor, and save as a run only script. You could probably assign this script as a folder action of your PDA, but I am too tired to try to remember how to do something like this.

    Maybe tomorrow (if you haven't figured it out) I can explain how to make a more versatile script, ie. that detects when the folder needs to by only updated, copy even though the master file has been moved or meerly delete the existing folder before attempting to copy (as it is, it will result in an error-type dialogue).

    Maybe someone that actually uses applescript can help you out....
     
  6. j26 thread starter macrumors 65832

    j26

    Joined:
    Mar 30, 2005
    Location:
    Paddyland
    #6
    Neither of them seem to work unfortunately.

    The first one says that an item with the same name already exists and the other says it can't get the folders.

    Shame, but I can't spend much time on it at the moment. Maybe in te summer I'll have a play around with it. I have some dull repetitive tasks that need doing, and if I can get it to work Applescript will save me a lot of time.

    Thank you both.
     

Share This Page