• 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
Old script fails with El Capitan
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Old script fails with El Capitan


  • Subject: Old script fails with El Capitan
  • From: Robert Poland <email@hidden>
  • Date: Sun, 10 Apr 2016 14:51:03 -0600
  • Z-usanet-msgid: XID909uDJuze2528X32

Hi,

This Old script fails with El Capitan. Says it can't set file "01 test" to "test".

(* ChangeFileName - 3/7/2006 - By R.L.Poland
*)

global droppedItem

property searchStrings : {"01 "} -- comma,apostrophe, space, Ampersand and double underscore
property replacementStrings : {""} -- underline, null, underline, _and_

on run
	set droppedItem to choose file
	tell me to open {droppedItem}
	return
end run

on open (droppedItem)
	set this_info to info for droppedItem
	set the item_name to the name of this_info
	set droppedItem to item_name
	tell application "Finder"
		set AppleScript's text item delimiters to ":"
		set theItem to last text item of droppedItem
		set droppedItem to lowercase theItem
		set theItem to droppedItem as text

		repeat with x from 1 to (get count of items in searchStrings)
			set search_string to (item x of searchStrings)
			set replacement_string to (item x of replacementStrings)
			set AppleScript's text item delimiters to search_string
			set theItem to text items of theItem
			set AppleScript's text item delimiters to replacement_string
			set theItem to text items of theItem
			set theItem to theItem as string
			set AppleScript's text item delimiters to ""
		end repeat

		set new_item_name to theItem as string
		set name of file droppedItem to new_item_name
	end tell
	beep
	return
end open

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: Old script fails with El Capitan
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Simple applescriptable diagram maker
  • Next by Date: Re: Simple applescriptable diagram maker
  • Previous by thread: [ANN] Myriad Tables update
  • Next by thread: Re: Old script fails with El Capitan
  • Index(es):
    • Date
    • Thread