Convert applescript to javascript

Copy link to clipboard
Copied
I have a file which contains applescript. I need to convert this script to javascript and run it in my windows. Please help!!!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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

