I wanted to add some comments :
try tell application "Finder" to set the source_folder to (folder of the front window) as alias on error -- no open folder windows set the source_folder to path to desktop folder as alias ############################################################ # it's odd to coerce this way because path to desktop folder is already an alias # I was quite sure that it would fail. I was wrong # "folder" is superfluous. as Standard Additions define the descriptor as "desktop", not "desktop folder" # So the correct instruction would be : # set the source_folder to path to desktop # In fact I never used the article the in AppleScript # set source_folder to path to desktop # is sufficient ############################################################ end try repeat display dialog "Text to trim from every folder name:" default answer "" buttons {"Cancel", "Trim Start", "Trim End"} set text_to_trim to text returned of result if the text_to_trim is not "" then exit repeat end repeat set the character_count to the number of characters of the text_to_trim ############################################################ # I was quite sure that applying list folder to an alias would fail. I was wrong ############################################################ set the item_list to list folder source_folder without invisibles set source_folder to source_folder as string
Yvan KOENIG (VALLAURIS, France) mercredi 15 janvier 2014 15:29:37
|