• 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: Generating applescript files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating applescript files


  • Subject: Re: Generating applescript files
  • From: Paul Skinner <email@hidden>
  • Date: Thu, 16 May 2002 06:27:08 -0400

You could make an empty script, save it to use as a template, duplicate it if you want, then in your creating script just store your new script into it. Your script will need to be an actual compiled script object though. Just text isn't enough.

script thingy
beep
end script
store script thingy in file ((choose file) as text) with replacing

Or you could man osacompile in the terminal. Good luck with that though, I found it to be unusable so far. <waits for someone to bite and show him how to do it...>

On Wednesday, May 15, 2002, at 09:40 PM, Alex Robinson wrote:

Is it possible to generate a file that can then be run as a compiled
applescript?

I tried the following:

set scriptName to "blech"

tell application "Finder"
set theScript to "-- text of script goes here"
set theFile to ("HardDisk:Users:sgp:Desktop:" & scriptName)
set the openFile to open for access file theFile with write permission
set eof of the openFile to 0
write theScript to the openFile starting at eof
close access the openFile
set theFile to file theFile
set creator type of theFile to "ToyS"
set file type of theFile to "osas"
end tell

But when trying to open the file, I get:

"Could not read the file because of a scripting-system (OSA) error"

Which I suppose is fair enough seeing that I've basically made a
straightforward text file and then just changed the types.

So what do I actually need to do or is this kind of thing only possible if
using a scriptable editor like Script Debugger?
--
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Generating applescript files (From: Alex Robinson <email@hidden>)

  • Prev by Date: RE: running an AppleScript from terminal command line
  • Next by Date: Re: Checking 2 folders and copy if new
  • Previous by thread: Re: Generating applescript files
  • Next by thread: Re: Generating applescript files
  • Index(es):
    • Date
    • Thread