Re: Copying information to create a script
Re: Copying information to create a script
- Subject: Re: Copying information to create a script
- From: Adam Wuellner <email@hidden>
- Date: Tue, 10 May 2005 10:29:09 -0500
On 5/10/05, Francois Houle <email@hidden> wrote:
> Well I do know that... I should have specified that I am looking at the Script Editor Dictionary and dointg this:
>
> tell application "Script Editor"
> save "my tell statement" as "application" in "filename" run only
> end tell
>
> A few questions arose form this...
> How should I set the reference I want to save... If I try to simply include my tell statement I want to save within brackets I get "Expected end of line but found indentifier"... Thats the main issue.
You need to script Script Editor to first create a new document, then
set its text to the AppleScript code, then save it.
> I would also like to know how I should exactly indicate the "in" section so it saves to a specific location of my choosing, eg in the ~/Library/Scripts folder (for which I would love to get suggestions as to the best way to check for its existence and create it if it doesn't exist)
>
This script does that - it's pretty straightforward since the 'path
to' scripting addition, by default, creates the requested standard
folder if it does not exist. But I've made it explicit below, to draw
attention to the feature.
-- begin script
set scripts_folder to (path to scripts folder from user domain with
folder creation) as string
tell application "Script Editor" to tell (make new document)
set its text to "tell application \"Finder\"
try
mount volume \"afp://...\"
end try
end tell
"
save it as "script" in (scripts_folder & "myscript")
end tell
--end script
The 'in' parameter can be simply a mac-style path to the file you wish
to create. The 'as' parameter should be one of the keywords listed in
the dictionary.
HTH
--
Adam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden