• 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: Trim folder names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trim folder names


  • Subject: Re: Trim folder names
  • From: "koenig.yvan" <email@hidden>
  • Date: Wed, 15 Jan 2014 15:30:04 +0100

Oops

I posted too fast.

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



 _______________________________________________
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: 
 >Re: Trim folder names (From: Christopher Stone <email@hidden>)

  • Prev by Date: Fwd: Trim folder names
  • Next by Date: Re: Save as web archive
  • Previous by thread: Re: Trim folder names
  • Next by thread: Re "Nouns" and "Verbs"
  • Index(es):
    • Date
    • Thread