• 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: scrpting Script Editor (save as script)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scrpting Script Editor (save as script)


  • Subject: Re: scrpting Script Editor (save as script)
  • From: KOENIG Yvan <email@hidden>
  • Date: Sat, 12 Jan 2008 10:17:55 +0100


Le 12 janv. 2008 à 08:58, Yvon Thoraval a écrit :

My goal :

save a bunch of Applescript scripts already saved in text form
(.applescript extension) as scripts (.scpt extension.

I've tried :
tell application "Script Editor"
activate
open aFile
delay 1
set frontmost to true
try
-- save window 1 as script in my getAlias(aFile)
-- Erreur dans Éditeur de scripts : NSReceiversCantHandleCommandScriptError
-- save window 1 as script
-- Erreur dans Éditeur de scripts : NSReceiversCantHandleCommandScriptError
-- save window 1 as "script"
-- Erreur dans Éditeur de scripts : NSReceiversCantHandleCommandScriptError
tell window 1 to save as script in my getAlias(aFile)
-- Erreur dans Éditeur de scripts : NSReceiversCantHandleCommandScriptError
on error errMsg
display dialog errMsg
end try
close window 1
end tell


getting allways "NSReceiversCantHandleCommandScriptError" even if,
before saving, the Finder makes the new file.

here am i wrong ?

Hello

My first thought is that it's not the window that you may save.
It's the document of this window (the dictionary describes this document as a property of the window).


It describes also the as parameter as a file type in Unicode text.
The file type of a Script (.scpt) file is the string "script".

Here is a quick and dirty sample:


set p2d to (path to desktop)
try
tell application "Finder" to make new file at p2d with properties {name:"monScript.scpt"}
end try
tell application "Script Editor"
activate
open file "Macintosh HD:Users:yvankoenig:Desktop:copieBaseMarcie.applescript"
delay 1
set frontmost to true

try
set dest to ((p2d as Unicode text) & "monScript.scpt") as alias
save (document of window 1) as "script" in dest
on error errMsg
display dialog errMsg
end try
--close window 1
end tell


Yvan KOENIG


_______________________________________________ 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
References: 
 >scrpting Script Editor (save as script) (From: "Yvon Thoraval" <email@hidden>)

  • Prev by Date: Re: scrpting Script Editor (save as script)
  • Next by Date: Re: scrpting Script Editor (save as script)
  • Previous by thread: Re: scrpting Script Editor (save as script)
  • Next by thread: Re: scrpting Script Editor (save as script)
  • Index(es):
    • Date
    • Thread