9 Replies Latest reply on Jun 2, 2010 6:41 AM by Poo_Del

    Few Problem in VBS

    Poo_Del Level 1

      Dear all,

      I am working first time on vbs, I am facing two problem please see below.

      ---------------------Problem 1 (Joboption file is not get loaded in indesign application)--------------------------------------------

      set idApp=CreateObject("InDesign.Application.CS4")

      set myFileSysObject=CreateObject("Scripting.FileSystemObject")

       

      idApp.Import InDesign.idExportPresetFormat.idPDFExportPresetsFormat, "C:\Test.joboptions")

       

      -------------------Problem 2 (Copy all linked images [which are not linked from active indesign document path] to the path of active indesign document path and relink it). Please see my below apple script code----------------------------------------

      tell application "InDesign CS4"

      tell active document

      set myFolderPath to get path

      repeat with OLINK in (get links)

      set LinkedPath to file path of OLINK

      if LinkedPath is not (myFolderPath & name of OLINK) then

      tell application "Finder" to set MovedFile to (move file LinkedPath to myFolderPath) as alias

      relink (contents of OLINK) to MovedFile

      update OLINK

      end if

      end repeat

      end tell

      end tell

       

      The above code is working fine for AppleScript, and I want to convert it to vbscript, I know many of us can suggest/help me.

      ------------------------------------------------------------------------------------------ ---------------------------------

      reagrds,

      Poo

        • 1. Re: Few Problem in VBS
          Poo_Del Level 1

          Hey Guys,

          I tried a lot for loading joboptions but it throws some errors. I am damn sure so many of you can suggest/help me.

           

          Regards,

          Poo

          • 2. Re: Few Problem in VBS
            Poo_Del Level 1

            Dear All,

            Below code is working fine when we are saving vbs file to script panel (script folder) of InDesign and running through Scripts windows.

             

            set idApp=CreateObject("InDesign.Application.CS4")

            set myFileSysObject=CreateObject("Scripting.FileSystemObject")

             

            idApp.Import InDesign.idExportPresetFormat.idPDFExportPresetsFormat, "C:\Test.joboptions")

             

            But the same above code is not working when I am trying to run through command line or just by double clicking on it. Can any one help me why it is not working from command line.

             

            Regards,

            Poo

            • 3. Re: Few Problem in VBS
              Steven.. Level 3

              Which version of Windows? If > XP there may be permissions issues

              • 4. Re: Few Problem in VBS
                Poo_Del Level 1

                I am using WIndows7. What I need to do in that case if it is related to permission issues.

                 

                Regrads,

                Poo

                • 5. Re: Few Problem in VBS
                  Steven.. Level 3

                  to test if thats the issue, run from an elevated permissions command prompt.

                   

                  1. open start menu

                  2. type cmd

                  3. right click command prompt and run as administrator

                  4. pass in command line to your script

                  • 6. Re: Few Problem in VBS
                    Poo_Del Level 1

                    Not working same message below:

                    ObjectRequired: "InDesign"

                     

                    Regards,

                    Poo

                    • 7. Re: Few Problem in VBS
                      Poo_Del Level 1

                      I have checked in XP as well with administrator login. But still I am facing the same problem rest of all sysntax is working fine only third line is not working when I am running it from external path.

                       

                      Regards,

                      Poo

                      • 8. Re: Few Problem in VBS
                        Poo_Del Level 1

                        I have tested with admin login on windows 7 & windows XP. But unfortunately I am getting the same error. I tried some other method as well like calling javascript but again it shows some error.


                        Below is the code I got from sdk folder.
                        ---------------------
                        Set myInDesign = CreateObject("InDesign.Application.CS4")
                        myJavaScript = "alert(""First argument: "" + arguments[0] + ""\rSecond argument: "" + arguments[1]);"
                        myInDesign.DoScript myJavaScript, idScriptLanguage.idJavascript, Array("Hello from DoScript", "Your message here.")
                        myVBScript = "msgbox arguments(1), vbOKOnly, ""First argument: "" & arguments(0)"
                        myInDesign.DoScript myVBScript, idScriptLanguage.idVisualBasic, Array("Hello from DoScript", "Your message here.")
                        ---------------
                        But it gives error for idScriptLanguage required at line 3 and char 1.

                         

                        Regards,
                        Poo
                        • 9. Re: Few Problem in VBS
                          Poo_Del Level 1

                          Guys!!!!!
                          Fixed, please see below code:

                           

                          Set idApp=CreateObject("InDesign.Application.CS4")
                          Set myFileSysObject=CreateObject("Scripting.FileSystemObject")
                          idApp.Import 1716745324, "D:\TestRajeev.joboptions"

                           

                          Regards,
                          Poo