3 Replies Latest reply on Jul 30, 2010 9:25 AM by Loic.Aigon

    Convert applescript to javascript

    karthikb1987 Level 1

      I have a file which contains applescript. I need to convert this script to javascript  and run it in my windows. Please help!!!

        • 1. Re: Convert applescript to javascript
          Marijan Tompa [tomaxxi] Level 4

          Hey!

           

          Maybe you can try to run it with doScript like this:

           

          app.doScript(File(app.activeScript.path+'/'+'your_apple_script_file'), ScriptLanguage.APPLESCRIPT_LANGUAGE);
          

           

          tomaxxi

          • 2. Re: Convert applescript to javascript
            Muppet Mark-QAl63s Level 4

            Tomaxxi, I doubt very much that that is going to work? I thought that calling app.doScript() was only platform independent when calling another JavaScript? If your are to perform an OS level script you should make an OS check the perform either VB or AppleScript dependent on the result. It sounds to me that the OP wanted the called script translated and performed on Windows? Or may be I just read the post wrong?

            • 3. Re: Convert applescript to javascript
              Loic.Aigon Adobe Community Professional

              Muppet Mark seems right.

               

              Translating APS to JS is someway doable. Unless the APS script uses cmd that don't have matching items in JS, it shouldn't be a problem.

               

              However, I don't think a script may convert  all by itself an APS script to JS.

              For generic commands such as "set x to" or "display dialog", it's quite easy but how to translate "whose", "starts", "first", "last"....?

              What if the script goes for file on the system using a tell application "Finder" block ?

               

              In my opinion, the translation process can only be efficiently done by a someone knowing both languages.

               

              Can I help you ?

               

              Loic