Re: Scriptable Text Editor v.1.1
Re: Scriptable Text Editor v.1.1
- Subject: Re: Scriptable Text Editor v.1.1
- From: "Marc K. Myers" <email@hidden>
- Date: Sat, 15 Sep 2001 10:42:07 -0400
- Organization: [very little]
Rachel Cogent wrote:
>
>
Entity Marc K. Myers spoke thus:
>
>
> In TE+ you can script almost anything that you can do manually.
>
>
OK Marc, here's one I have not been able to do:
>
Convert ReadMe to TE+
>
This script converts every file in a folder that are Read-only Readme text
>
into Tex-Edit Plus thus allowing opening in Tex Edit with a click.
>
(Until now, I did this by copying the contents into a new window and naming
>
it the original name)
>
>
tell application "Tex-Edit Plus"
>
activate
>
save windows as string with creator +class TBB6;
>
close windows
>
end tell
>
>
My problem is I don't know how to write it to the original folder, it seems
>
to go wherever.
While this is quite possible in TE+, it's using a screwdriver to pound
nails. Changing file types and creator types is usually a job for the Finder:
on run
open ({choose folder})
end run
on open (itemList)
tell application "Finder"
set fileList to files of item 1 of itemList [optn-L]
whose (creator type is "ttxt" and file type is "ttro")
repeat with aFile in fileList
set creator type of aFile to "TBB6"
set file type of aFile to "TEXT"
end repeat
end tell
end open
Note that "[optn-L]" is a replacement for the AppleScript continuation character.
If you really need a TE+ solution you're going to have to use the Finder
to extract the path of each file so you can use it in the save
statement. What you're missing is the part of the "save as" that's
mediated by the Finder, which is choosing the destination of the saved file.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[9/15/01 10:40:17 AM]