• 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
Bad script, good script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bad script, good script


  • Subject: Bad script, good script
  • From: "R. Nelson Byrne" <email@hidden>
  • Date: Mon, 03 Sep 2012 12:53:20 -0700

I'm trying to use AppleScript to move a file named "man1" from a folder "source" to a folder "sink". Here's my first attempt:


set movee to alias "Drobo:Disk Speed:source:man1"
get movee
set toWhere to alias "Drobo:Disk Speed:sink"
exists toWhere
tell application "System Events" to move movee to toWhere
tell application "System Events" to get contents of toWhere
get movee

--
Does nothing so far as I can see, no error, no nothing. File man1 remains in source. Here's the reply in AppleScript Editor:
--


tell application "AppleScript Editor"
	exists alias "Drobo:Disk Speed:sink:"
		--> true
end tell
tell application "System Events"
	move alias "Drobo:Disk Speed:source:man1" to alias "Drobo:Disk Speed:sink:"
end tell
Result:
alias "Drobo:Disk Speed:source:man1"


=============

OK, try again, only this time don't use the variables movee and toWhere in the System Events call. Here's what works:


set movee to alias "Drobo:Disk Speed:source:man1"
get movee
set toWhere to alias "Drobo:Disk Speed:sink"
exists toWhere
tell application "System Events" to move alias "Drobo:Disk Speed:source:man1" to alias "Drobo:Disk Speed:sink:"
tell application "System Events" to get items of toWhere
get movee

--
This DOES move the file man1 to the sink folder. Here's the reply:
--


tell application "AppleScript Editor"
	exists alias "Drobo:Disk Speed:sink:"
		--> true
end tell
tell application "System Events"
	move alias "Drobo:Disk Speed:source:man1" to alias "Drobo:Disk Speed:sink:"
		--> missing value
	get every item of alias "Drobo:Disk Speed:sink:"
		--> {file "Drobo:Disk Speed:sink:.DS_Store", file "Drobo:Disk Speed:sink:man1"}
end tell
Result:
alias "Drobo:Disk Speed:sink:man1"



How come script one doesn't do the same thing?
 _______________________________________________
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: Bad script, good script
      • From: Luther Fuller <email@hidden>
  • Prev by Date: Re: Switching Time Machine on and off
  • Next by Date: Re: Bad script, good script
  • Previous by thread: Re: Switching Time Machine on and off
  • Next by thread: Re: Bad script, good script
  • Index(es):
    • Date
    • Thread