2 Replies Latest reply on May 12, 2010 5:08 AM by PeterHedrington

    [CS4/JS/AS] doScript pass variable from JS to AS


      I have this doScript that I wish to pass a variable (theFold) to the AppleScript it is calling:


      #target "InDesign-6.0"

      var theFold = ["Spotlight"]

      var myScriptFolderPath = ("Macintosh HD:Users:user:Desktop:Unlock V3.app:"); 

      app.doScript(File(myScriptFolderPath),ScriptLanguage.applescriptLanguage, theFold);


      The AppleScript is:


      property theAdd : "Macintosh HD:Users:user:Desktop:"


      on run(fromJava)

      tell application "Finder"

      set nameTwo to (fromJava as text)

      set theName to (theAdd & nameTwo) as alias

      my openSez(theName)

      end tell

      end run


      on openSez(theName)

      tell application "Finder"

      set folderContents to (items in folder theName)

      if (count of folderContents) > 0 then

      -- cycle through each item in the folder

      repeat with i from 1 to count of folderContents

      set carryThrough to (item i of folderContents)

      -- if it's another folder, then recurse

      if kind of carryThrough is "folder" then

      set theName to (carryThrough as string)

      my openSez(theName)


      if locked of carryThrough is true then

      set locked of carryThrough to false

      end if

      end if

      end repeat

      end if

      end tell

      end openSez


      Is it possible to pass a variable when you call a script from a path?


      I get the error "Can't make <script> into Unicode text.


      Thanks for any help or comments.