Page 3 of 3 FirstFirst 123
Results 21 to 30 of 30
Discuss Apple Script at the Genuine Mac Support - Hackint0sh.org; Originally Posted by JayBird JUST CHECKED SCRIPT: do shell script "cp -R $HOME/ DOWNLOADS /Volumes/ ...
  1. #21
    iPhone Moderator Array

    Join Date
    Aug 2007
    Posts
    3,620
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    220

    Default

    Quote Originally Posted by JayBird View Post
    JUST CHECKED SCRIPT:

    do shell script "cp -R $HOME/DOWNLOADS /Volumes/USB/"

    WORKS 100% VERY VERY HAPPY
    Great hearing that!

    BTW: I dont know Candybar, sorry
    Read the stickies and search the forum before posting!
    If you want to become a Hackint0sh supporter click here
    ----------
    iPhone 4 factory unlocked, iOS 4.3.1, jailbroken
    iPad Wi-Fi + 3G (1G), iOS 4.3.1, jailbroken
    iPad 2


  2. #22
    Senior Professional Array JayBird's Avatar

    Join Date
    Oct 2008
    Posts
    373
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    27

    Default

    is there a way to attach an icon to the script so when you compile it, it will link the image rather than show an apple script icon???

    also i understand that the script below does copy files ect over,

    is there anyway i can get it to show as if i had dragged the files onto the drive (when you see the blue bar + time)??
    Last edited by JayBird; 02-10-2009 at 03:32 PM. Reason: Extra Q
    I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner

    iPhone Owner 3G

  3. #23
    iPhone Moderator Array

    Join Date
    Aug 2007
    Posts
    3,620
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    220

    Default

    Quote Originally Posted by JayBird View Post
    is there a way to attach an icon to the script so when you compile it, it will link the image rather than show an apple script icon???

    also i understand that the script below does copy files ect over,

    is there anyway i can get it to show as if i had dragged the files onto the drive (when you see the blue bar + time)??
    1. Once you created the app, just klick on it once in the Finder, then hit command-I (Information). All the way on the top you see the icon. It can be replaced via copy->paste, very easy.

    2. Yes it does cpoy files etc over

    3. As far as I know the only reliable way would be to create an AppleScript Studio project, but this is not that easy. i dont know of a way to just use AppleScript, never had a reason to look into that. I see your reason for it. Will let you know if I find something you can use.
    Read the stickies and search the forum before posting!
    If you want to become a Hackint0sh supporter click here
    ----------
    iPhone 4 factory unlocked, iOS 4.3.1, jailbroken
    iPad Wi-Fi + 3G (1G), iOS 4.3.1, jailbroken
    iPad 2

  4. #24
    Senior Professional Array JayBird's Avatar

    Join Date
    Oct 2008
    Posts
    373
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    27

    Default

    one last question, i have been looking into apple script and the -R , what is the main reason to using the R (all explanations i read don't make sense).

    Also when it does the copy does it go directly to the drive, i don't know how but 7GB of space has been taken up in the last 2 hrs on my machine and i can't find where from.......
    I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner

    iPhone Owner 3G

  5. #25
    iPhone Moderator Array

    Join Date
    Aug 2007
    Posts
    3,620
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    220

    Default

    Quote Originally Posted by JayBird View Post
    one last question, i have been looking into apple script and the -R , what is the main reason to using the R (all explanations i read don't make sense).

    Also when it does the copy does it go directly to the drive, i don't know how but 7GB of space has been taken up in the last 2 hrs on my machine and i can't find where from.......
    You need -R cause cp alone wont copy folder, just single files.


    One question on the command
    do shell script "cp -R $HOME/DOWNLOADS /Volumes/USB/"

    Did you write it that way, it wont work I am afraid (upper and lower case matter

    would be
    do shell script "cp -R $HOME/Downloads /Volumes/USB/"

    but only if the external volume you are copying the backup to is named "USB" - meaning showing up in the Finder as Volume "USB".
    Please check this
    Read the stickies and search the forum before posting!
    If you want to become a Hackint0sh supporter click here
    ----------
    iPhone 4 factory unlocked, iOS 4.3.1, jailbroken
    iPad Wi-Fi + 3G (1G), iOS 4.3.1, jailbroken
    iPad 2


  6. #26
    Senior Professional Array JayBird's Avatar

    Join Date
    Oct 2008
    Posts
    373
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    27

    Default

    hey i have writen it like:

    o shell script "cp -R $HOME/Downloads /Volumes/USB/" - USB being name of external Drive
    I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner

    iPhone Owner 3G

  7. #27
    Senior Professional Array JayBird's Avatar

    Join Date
    Oct 2008
    Posts
    373
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    27

    Default

    'll PM you the Code
    Last edited by JayBird; 02-10-2009 at 09:46 PM.
    I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner

    iPhone Owner 3G

  8. #28
    Supporter Array Amet's Avatar

    Join Date
    Mar 2008
    Location
    Dubai
    Posts
    73
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    12

    Default

    Try it like this
    Change SourceFolder and TargetFolder to match yours


    -------Copy from here ------------------
    ---------------------------------------
    set SourceFolder1 to path to (home folder)
    set SourceFolder to POSIX path of SourceFolder1 & "/Downloads/"
    set TargetFolder to "/Volumes/USB/"
    ---------------------------------------
    set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
    do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
    repeat
    set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")

    display dialog "Copied " & TSize & "Kb of " & SSize & "Kb" giving up after 1
    if (TSize as number) is (SSize as number) then exit repeat
    end repeat

    ----------To here----------

    It will give you a progress indicator
    Zeljko

  9. #29
    Senior Professional Array JayBird's Avatar

    Join Date
    Oct 2008
    Posts
    373
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    27

    Default

    if i wanted to add more, folders in, for example MOVIES / PICTURES would it look like this?

    -------Copy from here ------------------
    ---------------------------------------
    set SourceFolder1 to path to (home folder)
    set SourceFolder to POSIX path of SourceFolder1 & "/Downloads/"
    set SourceFolder to POSIX path of SourceFolder1 & "/Movies/"
    set SourceFolder to POSIX path of SourceFolder1 & "Pictures/"

    set TargetFolder to "/Volumes/USB/"
    ---------------------------------------
    set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
    do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
    repeat
    set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")

    display dialog "Copied " & TSize & "Kb of " & SSize & "Kb" giving up after 1
    if (TSize as number) is (SSize as number) then exit repeat
    end repeat
    I Do Not Condone Piracy, If You Like It BUY IT! - It's Ok To Test But Not Steal - MacBook Pro Owner

    iPhone Owner 3G

  10. #30
    Supporter Array Amet's Avatar

    Join Date
    Mar 2008
    Location
    Dubai
    Posts
    73
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    12

    Default

    unfortunately you can't do it like that, cos every time you issue a "set SourceFolder to" you overwrite the previous one.

    you can do it like this:

    ---------------------------------------
    set SourceFolder1 to path to (home folder)
    set SourceFolder to POSIX path of SourceFolder1 & "/Downloads/"
    set SourceFolderMOV to POSIX path of SourceFolder1 & "/Movies/"
    set SourceFolderPIC to POSIX path of SourceFolder1 & "/Pictures/"

    set TargetFolder to "/Volumes/USB/"
    ---------------------------------------
    set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
    set SSizeMOV to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
    set SSizePIC to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
    do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"

    do shell script "cp -R " & quoted form of SourceFolderMOV & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
    do shell script "cp -R " & quoted form of SourceFolderPIC & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"

    repeat
    set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")

    display dialog "Copied " & TSize & "Kb of " & ((SSize as number) + (SSizeMOV as number) + (SSizePIC as number)) & "Kb" giving up after 1
    if (TSize as number) is ((SSize as number) + (SSizeMOV as number) + (SSizePIC as number)) then exit repeat
    end repeat

    ----------------------------------------


    or you can simplify it and do it like this:

    --------------------------------------
    set SourceFolder1 to path to (home folder)
    set SourceFolder to POSIX path of SourceFolder1

    set TargetFolder to "/Volumes/USB/"
    ---------------------------------------
    set SSize to (do shell script "du -h -k -d0 " & quoted form of SourceFolder & " | awk '{print $1}'")
    do shell script "cp -R " & quoted form of SourceFolder & " " & quoted form of TargetFolder & " >/dev/null 2>&1 &"
    repeat
    set TSize to (do shell script "du -h -k -d0 " & quoted form of TargetFolder & " | awk '{print $1}'")

    display dialog "Copied " & TSize & "Kb of " & SSize & "Kb" giving up after 1
    if (TSize as number) is (SSize as number) then exit repeat
    end repeat
    ------------------------------------------

    this will copy your whole Home folder to a backup destination

    another thing is , you can download a program called "Do Something When" , and program it to run the script every time you insert this specific external USB disk.
    (no affiliation to azarhi software)

    Hope it helps
    if I can help further just let me know
    Zeljko
    Last edited by Amet; 02-16-2009 at 10:19 PM.


 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 0
    Last Post: 01-04-2011, 03:20 AM
  2. Wake on Lan Script?
    By jaybee16 in forum AppleTV 1
    Replies: 1
    Last Post: 07-17-2009, 04:00 AM
  3. [1.1.3] run a script when docked (?)
    By dbenc in forum General
    Replies: 0
    Last Post: 02-19-2008, 12:29 AM
  4. [1.1.2 OTB] All in one script?
    By hiimcliff in forum iPhone "2G" (Rev. 1)
    Replies: 0
    Last Post: 01-18-2008, 03:27 PM
  5. web script-apple mac website
    By Japka in forum Genuine Mac Support
    Replies: 0
    Last Post: 12-13-2007, 05:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 03:01 PM.
twitter, follow us!