• 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: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)


  • Subject: Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
  • From: Robert Poland <email@hidden>
  • Date: Fri, 26 Mar 2010 11:10:53 -0600

Ed's suggestion gets me past this error, but now I get errors in the next section of the script.

This errors at "set the parent_container_path to (container of this_item)"

ERROR: Can't get Container of "Macintosh HD:Users:RLP:Desktop:work folder:amer.weihnachten1.jpg". 
NOTE: This still works with older iMac (OS 10.6.2).

--on set_item_name(this_item, new_item_name)
set this_item to "Macintosh HD:Users:RLP:Desktop:work folder:amer.weihnachten1.jpg"
set new_item_name to "amer.weihnachten1.jpg"

tell application "Finder"
set the parent_container_path to (container of this_item)
try
set the name of this_item to new_item_name
on error the error_message number the error_number
if the error_number is -59 then
set the error_message to "This name contains improper characters, such as a colon (:)."
else --the suggested name is too long
set the error_message to error_message -- "The name is more than 31 characters long."
end if
--beep
tell me to display dialog the error_message default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
copy the result as list to {new_item_name, button_pressed}
if the button_pressed is "Skip" then return 0
my set_item_name(this_item, new_item_name)
end try
end tell
--end set_item_name



On Mar 26, 2010, at 10:05 AM, Yvan KOENIG wrote:

Le 26 mars 2010 à 16:49, email@hidden a écrit :

You could insert this into your script:
tell application "Finder"
 set theKind to class of item (currentItem as text)
 if theKind is folder then set theKind to "folder"
end tell

In place of:

set theKind to kind of currentItem

Yours and mine return "folder" it the treated item is a folder.

Also, I'd still caution against using index as a variable, it is an appleScript keyword. In general, if your compiler colors a variable differently than the other variables in your script, you should pick a different name for the variable.

I definitively agree.
This is why, to be free of this kind of problem, I use French_like names for the variables in my own scripts.

Yvan KOENIG (VALLAURIS, France) vendredi 26 mars 2010 17:01:36

Robert Poland - Fort Collins, CO



 _______________________________________________
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: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
      • From: Laine Lee <email@hidden>
    • Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
      • From: "Stockly, Ed" <email@hidden>
    • Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
      • From: Laine Lee <email@hidden>
References: 
 >Rep: old script fails AND BUG in Smile 3.5.2 (build 609) (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Back and forth between Posix and HFS paths
  • Next by Date: Re: How do I write "If option key is down then" in AppleScript ?
  • Previous by thread: Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
  • Next by thread: Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609)
  • Index(es):
    • Date
    • Thread