Re: Script to insert the file name in TextWrangler
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:
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