Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

"Translate" VBScript to AppleScript

Advisor ,
Mar 23, 2015 Mar 23, 2015

Hi all.

I am trying to convert the vbs that i am using in my sublimeText to Indesign plugin to work with AppleScript, but since i never used AppleScript before i'm having a bit of a hard time.

The vb script is:

myScript = Wscript.Arguments.Item(0)

myPort = WScript.Arguments.Item(1)

myVer = WScript.Arguments.Item(2)

Set myInDesign = CreateObject("InDesign.Application"&myVer)

Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")

Set myFile = myFileSystemObject.GetFile(myScript)

Set objShell = CreateObject("Wscript.Shell")

strPath = Wscript.ScriptFullName

Set objFile = myFileSystemObject.GetFile(strPath)

strFolder = myFileSystemObject.GetParentFolderName(objFile)

runFile = myFileSystemObject.GetFile(strFolder & "/jsRunner.jsx")

On Error Resume Next

Dim r

r = myInDesign.DoScript(runFile, 1246973031, Array(myFile,myPort))

If Err.Number<>0 Then

  WScript.Echo "___"

  WScript.Echo  Err.Description

  WScript.Echo  Err.Number

End IF

It takes three comand line arguments: Script to run, Port on withc to communicate back to Sublime and the version of indesign to run

How can i pass command line parameters to AS?

TOPICS
Scripting
953
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 23, 2015 Mar 23, 2015
LATEST

try to add on run clause at the beginning of your script:

  on run mPparameter
      set myScript to item 1 of mPparameter

      set myPort to item 2 of mPparameter

      set myVer to item 3 of mPparameter
  end run

call the script from command line:

osascript myscript.scpt param1 param2 param3
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines