• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can i auto install App under ML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can i auto install App under ML


  • Subject: Re: How can i auto install App under ML
  • From: Christopher Stone <email@hidden>
  • Date: Thu, 25 Oct 2012 02:33:35 -0500

On Oct 25, 2012, at 02:02, Brian Christmas <email@hidden> wrote:
I'm trying to auto install a folder into the Applications folder, but compiling under Mountain Lion with "move (path to app) to Applications folder" refuses to compile, and the script below does not generate an error, nor does it move the folder.
______________________________________________________________________

Hey Brian,

You got bit by copy.  It was copying the value of one variable to another variable.

The Finder's duplicate command is what you're looking for:

------------------------------------------------------------------------------------------------
try

  

  set p2me to path to me
  set ptaf to path to applications folder

  

  tell application "Finder"
    set p2cofme to container of (path to me) as text

    

    if exists folder (ptaf & "Mail Manager" as text) then move folder (ptaf & "Mail Manager" as text) to trash
    set folderPath to (p2cofme & "Mail Manager") as alias
    duplicate folderPath to ptaf
  end tell

  

on error e number n
  set e to e & return & return & "Num: " & n
  tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
  if button returned of dDlg = "Copy" then set the clipboard to e
end try
------------------------------------------------------------------------------------------------

Hmm.  Changing duplicate to move compiles just fine here on my machine (10.8.2), and it works correctly when run.

------------------------------------------------------------------------------------------------
try

  

  set p2me to path to me
  set ptaf to path to applications folder

  

  tell application "Finder"
    set p2cofme to container of (path to me) as text

    

    if exists folder (ptaf & "Mail Manager" as text) then move folder (ptaf & "Mail Manager" as text) to trash
    set folderPath to (p2cofme & "Mail Manager") as alias
    move folderPath to ptaf
  end tell

  

on error e number n
  set e to e & return & return & "Num: " & n
  tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
  if button returned of dDlg = "Copy" then set the clipboard to e
end try
------------------------------------------------------------------------------------------------

For testing I had the script and folder saved here:

 ~/Desktop/Brian_Script_Folder/
Brian_Script.app
Mail Manager/

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How can i auto install App under ML
      • From: "L. Lee" <email@hidden>
References: 
 >How can i auto install App under ML (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: How can i auto install App under ML
  • Next by Date: set clipboard fails
  • Previous by thread: Re: How can i auto install App under ML
  • Next by thread: Re: How can i auto install App under ML
  • Index(es):
    • Date
    • Thread