• 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: Script to insert the file name in TextWrangler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to insert the file name in TextWrangler


  • Subject: Re: Script to insert the file name in TextWrangler
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 08 Jan 2016 14:32:14 +0100


Le 2016/01/08 à 08:48, CafeTran Wiki <email@hidden> a écrit :

Hello,

Could someone please help me with a script that copies the name of the open file without the path and the extension (.md) to the clipboard, for easy inserting in the open document?

So in TE I've opened:

/Users/Hans/Dropbox/CT/Man/en-GB/preview-me-in-the-viewer.md

The script puts the file name 'preview-me-in-the-viewer' on the clipboard.

Thanks for your help!

Hans


Maybe this would help :

tell application "TextWrangler"
set itsFile to file of document 1 as text
end tell
tell application "System Events" to tell disk item itsFile
set itsName to its name
set itsExtension to its name extension
end tell
if itsExtension is not "" then
set the clipboard to text 1 thru -(2 + (count itsExtension)) of itsName
else
set the clipboard to itsName
end if


Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) vendredi 8 janvier 2016 14:32:01





 _______________________________________________
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: 
 >Script to insert the file name in TextWrangler (From: CafeTran Wiki <email@hidden>)

  • Prev by Date: Re: Renamer script
  • Next by Date: Re: Renamer script
  • Previous by thread: Script to insert the file name in TextWrangler
  • Next by thread: Re: Script to insert the file name in TextWrangler
  • Index(es):
    • Date
    • Thread