AS in TextExpander with user interaction
AS in TextExpander with user interaction
- Subject: AS in TextExpander with user interaction
- From: Michael Grant <email@hidden>
- Date: Sun, 06 Sep 2015 12:25:02 -0500
Anyone here using AppleScript with TextExpander? I'm trying to write an AS snippet that allows the user to insert the contents of an arbitrary text file, but I'm having trouble 1) giving focus to the choose file dialog and then 2) returning focus to the original application for the expansion. What I've got so far works in Script Editor but fails to expand in BBEdit when I call it as a TextEditor snippet — the current application for the script is TextExpander, not the app where I'm actually typing. Any suggestions?
property notesFldr : alias "London:Users:mgrant:Dropbox:SimpleText:"
with timeout of 120 seconds
set ca to current application
tell application "System Events"
activate
set theNote to (choose file of type {"TEXT", "public.plain-text"} with prompt "Choose a note file:" default location notesFldr) as alias
end tell
set theNoteReference to open for access theNote
set theNoteContents to read theNoteReference
close access theNoteReference
tell ca to activate
return theNoteContents
end timeout
--
There's really no such thing as translating. It's all a scam. We basically just make stuff up and try to make it sound plausible.
_______________________________________________
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