• 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: On the difficulties of "/"" in Applescript with example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: On the difficulties of "/"" in Applescript with example


  • Subject: Re: On the difficulties of "/"" in Applescript with example
  • From: "koenig.yvan" <email@hidden>
  • Date: Fri, 18 Oct 2013 17:53:27 +0200


Le 18/10/2013 à 17:03, Walter Bushell <email@hidden> a écrit :


On Oct 17, 2013, at 8:07 PM, Shane Stanley wrote:

On 18 Oct 2013, at 10:02 AM, Walter Bushell <email@hidden> wrote:

But here I get from

tell application "Finder" to set x to alias "After Ewe Firewire:Users:Walter:Music:\"ur\"file"

--->error "Finder got an error: Can’t get alias \"After Ewe Firewire:Users:Walter:Music:\\\"ur\\\"file\"." number -1728

What happens if you run this:

set thePath to (choose file) as text -- choose the file in question
tell application "Finder" to set x to alias thePath
log x
log (x as alias)

-- my addition
get name of x
So

set thePath to (choose file) as text -- choose the file in question
tell application "Finder" to set x to alias thePath
log x
log (x as alias)
get name of x
================

tell application "AppleScript Editor"
choose file
--> alias "After Ewe Firewire:Users:Walter:Music:\\\"ur\\\"file"
end tell
tell application "Finder"
get alias "After Ewe Firewire:Users:Walter:Music:\\\"ur\\\"file"
--> document file "\\\"ur\\\"file" of folder "Music" of folder "Walter" of folder "Users" of startup disk
(*document file \"ur\"file of folder Music of folder Walter of folder Users of startup disk*)
get document file "\\\"ur\\\"file" of folder "Music" of folder "Walter" of folder "Users" of startup disk
--> alias "After Ewe Firewire:Users:Walter:Music:\\\"ur\\\"file"
end tell
(*alias After Ewe Firewire:Users:Walter:Music:\"ur\"file*)
tell application "Finder"
get name of document file "\\\"ur\\\"file" of folder "Music" of folder "Walter" of folder "Users" of startup disk
--> "\\\"ur\\\"file"
end tell
Result:
"\\\"ur\\\"file"

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

There is some bob and weave going on here.

Which operating system are you running ?

Under 10.8.5, using Apple's Script Editor version 2.5.1 (138.1) and running :

set thePath to (choose file) as text -- choose the file in question
log thePath
tell application "Finder" to set x to alias thePath
log x
log (x as alias)
get name of x

I got :

tell application "AppleScript Editor"
choose file
--> alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
end tell
(*Macintosh HD:Users:yvankoenig:Desktop:"ur" file.txt*)
tell application "Finder"
get alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
--> document file "\"ur\" file.txt" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk
(*document file "ur" file.txt of folder Desktop of folder yvankoenig of folder Users of startup disk*)
get document file "\"ur\" file.txt" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk
--> alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
end tell
(*alias Macintosh HD:Users:yvankoenig:Desktop:"ur" file.txt*)
tell application "Finder"
get name of document file "\"ur\" file.txt" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk
--> "\"ur\" file.txt"
end tell




Alternate attempt with this edited script :


tell application "Finder"
set thePath to (choose file) as text -- choose the file in question
log thePath

set x to alias thePath

end tell
log x
log (x as alias)
get name of x

which returned this « funny » report:

tell application "Finder"
choose file
--> error number -1708
«event ascrgdut»
--> error number -1708
choose file
--> alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
(*Macintosh HD:Users:yvankoenig:Desktop:"ur" file.txt*)
get alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
--> document file "\"ur\" file.txt" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk
(*document file "ur" file.txt of folder Desktop of folder yvankoenig of folder Users of startup disk*)
get document file "\"ur\" file.txt" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk
--> alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
end tell
(*alias Macintosh HD:Users:yvankoenig:Desktop:"ur" file.txt*)
tell application "Finder"
get name of document file "\"ur\" file.txt" of folder "Desktop" of folder "yvankoenig" of folder "Users" of startup disk
--> "\"ur\" file.txt"
end tell



Third version :


set thePath to (choose file) as text -- choose the file in question
log thePath
set x to alias thePath
log x
tell application "Finder"
get name of x
end tell

which returned :


tell application "AppleScript Editor"
choose file
--> alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
end tell
(*Macintosh HD:Users:yvankoenig:Desktop:"ur" file.txt*)
(*alias Macintosh HD:Users:yvankoenig:Desktop:"ur" file.txt*)
tell application "Finder"
get name of alias "Macintosh HD:Users:yvankoenig:Desktop:\"ur\" file.txt"
--> "\"ur\" file.txt"
end tell


Yvan KOENIG (VALLAURIS, France) vendredi 18 octobre 2013 17:49:42









 _______________________________________________
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

References: 
 >On the difficulties of "/"" in Applescript with example (From: Walter Bushell <email@hidden>)
 >Re: On the difficulties of "/"" in Applescript with example (From: Shane Stanley <email@hidden>)
 >Re: On the difficulties of "/"" in Applescript with example (From: Walter Bushell <email@hidden>)
 >Re: On the difficulties of "/"" in Applescript with example (From: Shane Stanley <email@hidden>)
 >Re: On the difficulties of "/"" in Applescript with example (From: Walter Bushell <email@hidden>)

  • Prev by Date: Re: On the difficulties of "/"" in Applescript with example
  • Next by Date: Re: savedsearch files
  • Previous by thread: Re: On the difficulties of "/"" in Applescript with example
  • Next by thread: Re: On the difficulties of "/"" in Applescript with example
  • Index(es):
    • Date
    • Thread