• 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
Javascript for automation quastions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Javascript for automation quastions


  • Subject: Javascript for automation quastions
  • From: Deivy Petrescu <email@hidden>
  • Date: Thu, 11 Dec 2014 11:00:29 -0500

Some questions that I could not find the answer (plenty more to come).

First, how does one get  “me” in JSA ?

Example:

<script>
set k to path to me
</script>


Note: me points to <<scrpt>> not to the “front” document.



Second, “runScript", according to the dictionary  it takes  text:
	"run script script : the script text (or an alias or file reference to a script file) to run”

In AppleScript the following works:

<script>
run script "Tell app \"Mail\" to activate”
</script>


In JSX the following does not work

<script>
se = Application.currentApplication()
se.includeStandardAdditions = true

scrpt= "Application('Mail').activate()"

se.runScript(scrpt)
</script>

——>Error:"Error on line 6: Error: Expected script but found string.”

However if I try  the following  works, but it throws an error

<script>
se = Application.currentApplication()
se.includeStandardAdditions = true


se.runScript(Application('Mail').activate())
</script>

—>Error: "Error on line 5: Error: Expected script but found boolean.”

In both JSA scripts the error line is the last line
Is this an error on the JSA dictionary?

What is the point of JSA taking a script instead of text?
If you put the script into a variable it will execute before the call to runScript.

Thanks


Deivy Petrescu
email@hidden


 _______________________________________________
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


  • Follow-Ups:
    • Re: Javascript for automation quastions
      • From: David Steinberg <email@hidden>
  • Prev by Date: Re: New day, new issue, TextEdit
  • Next by Date: Re: Javascript for automation quastions
  • Previous by thread: Re: New day, new issue, TextEdit
  • Next by thread: Re: Javascript for automation quastions
  • Index(es):
    • Date
    • Thread