• 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
Running AppleScripts from an App using NSAppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Running AppleScripts from an App using NSAppleScript


  • Subject: Running AppleScripts from an App using NSAppleScript
  • From: Dave <email@hidden>
  • Date: Mon, 27 Apr 2015 14:52:59 +0100

Hi All,

I have a number of AppleScripts I’d want to run from my App. Each Script has a couple of parameters, here is an example:

on run
	set  myParam1 to <Data from Cocoa App>
	set  myParam2 to <Data from Cocoa App>
	set myStatus to doStuff(myParam1, myParam2)

	return myStatus
end run

—
—  Do something with Param1 and Param2
—
on doStuff(theParam1,theParam2)

	tell application ”TextEdit"

	end tell

	return “OK"
end setClassificationContent


At the moment, I setup the Text for the Script, Compile it and then Run it each time. I’m wondering if there is anyway to be able to just compile the Script once, and then pass the Parameters to the Script as it seems a bit time-consuming to recompile each time when 99% of the Script is constant.

All the Best
Dave


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Running AppleScripts from an App using NSAppleScript
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: The Case of the Dancing Keyboard
  • Next by Date: Re: Running AppleScripts from an App using NSAppleScript
  • Previous by thread: Re: Cocoa window stops responding
  • Next by thread: Re: Running AppleScripts from an App using NSAppleScript
  • Index(es):
    • Date
    • Thread