• 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: Copying information to create a script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Copying information to create a script


  • Subject: RE: Copying information to create a script
  • From: "Francois Houle" <email@hidden>
  • Date: Tue, 10 May 2005 14:49:24 -0400
  • Thread-topic: Copying information to create a script

What I was missing in the end was the \ before every " to I guess tell
the script to simply escape them so they are viewed as text and not as
an actual quote to be used in the script itself...
Thanks alot !

Frank

-----Original Message-----
From: Adam Wuellner [mailto:email@hidden]
Sent: Tuesday, May 10, 2005 11:29 AM
To: Francois Houle
Cc: John C. Welch; AppleScript User's List
Subject: Re: Copying information to create a script

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

  • Prev by Date: Re: Compiled script and high CPU %
  • Next by Date: Re: Illustrator save as PDF; adding extra bleed?
  • Previous by thread: Re: Copying information to create a script
  • Next by thread: Write Unicode characters to HTML
  • Index(es):
    • Date
    • Thread