• 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: Yvan KOENIG <email@hidden>
  • Date: Fri, 26 Mar 2010 21:38:29 +0100


Le 26 mars 2010 à 18:39, Laine Lee a écrit :


on open theitems
    my set_item_name(item 1 of theitems, "Bob's picture.jpg")
end open

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 my French 10.6.2 imac, it behaves flawlessly.
BUT, this_item is an alias, not a string !
For my own use, I would not tell to the Finder but to System Events (with a slightly different syntax) but it's perhaps just matter of taste.


Yvan KOENIG (VALLAURIS, France) vendredi 26 mars 2010 21:35:05


 _______________________________________________
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: Robert Poland <email@hidden>
References: 
 >Re: Rep: old script fails AND BUG in Smile 3.5.2 (build 609) (From: Laine Lee <email@hidden>)

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