8 Replies Latest reply on Jun 18, 2008 7:42 AM by (Olav_Kvern)

    [VBS][CS3] WEIRD problem, need help!

    Level 1
      Okay, this script works SOMETIMES...

      Set myInDesign = CreateObject("InDesign.Application.CS3")
      Set onefile = myInDesign.ActiveDocument

      Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
      myParentFolder = myFileSystemObject.GetFile(onefile).ParentFolder

      Of course, thats just a snippet of the script, but this is where the problem is. It WORKS when you open an indesign file and then do a SAVE AS on that file (even though the file already exists), overwriting the existing file, BEFORE running the script. If you just run the script, after just opening a file, it gives a 'file not found' error (referring to 'onefile'). Strange eh? just simply doing a 'save' doesnt work either.

      Any ideas folks? i'm tempted to add some 'save as' code to circumvent the problem, but its an awful lot of work just to get the name of the parent folder.

      Thanks everyone!

      Adam
        • 1. Re: [VBS][CS3] WEIRD problem, need help!
          Level 1
          Hi Adam,

          I'm somewhat surprised it ever works.:-) "onefile" in the above example is an InDesign document object--FileSystemObject.GetFile is expecting a file path as a string. Instead, you can use the FilePath property of the document--that will give you the path to the file without the file name. Then you can use GetFolder rather than GetFile.

          Thanks,

          Ole
          • 2. Re: [VBS][CS3] WEIRD problem, need help!
            Level 1
            Thanks Ole!

            I knew the code was a little mickey-mouse but i couldnt find any property of activedocument that would return a path... so its 'FilePath' eh? good to know!

            Is there a list of these properties somewhere that i'm missing?
            • 3. Re: [VBS][CS3] WEIRD problem, need help!
              Level 1
              i see now that my copy of Indesign didn't install the 'scripting support' folder which holds the type library.

              Is there anywhere i can download a copy of "Resources for Visual Basic.tlb"? I'm using Adobe CS3 Standard

              Thanks!
              • 4. Re: [VBS][CS3] WEIRD problem, need help!
                Level 1
                Hi AdamN,

                If you have InDesign on your system, and have run it at least once, you have a copy--just search for it. InDesign generates it on its first startup, or whenever the plug-in set changes.

                Thanks,

                Ole
                • 5. Re: [VBS][CS3] WEIRD problem, need help!
                  Level 1
                  Hi Ole,

                  I wish that were the case- no file. I found the library for CS2, but there is no "scripting support" folder in the Version 5 directory. A full computer search didnt turn it up either. I've check the other computers with CS3 installed around here and none of them have this file.

                  Cheers,
                  Adam
                  • 6. Re: [VBS][CS3] WEIRD problem, need help!
                    Level 1
                    Hi Adam,

                    Hm. Does your user account have Administrator privileges? If not, log in as Administrator and run InDesign once. The only thing that can prevent InDesign from writing the file, as far as I know, is lack of read/write access to the folder.

                    Thanks,

                    Ole
                    • 7. Re: [VBS][CS3] WEIRD problem, need help!
                      Level 1
                      Hi Olav,

                      Thanks for keeping on this. I called tech support and they couldnt find the file on their computers either. I spoke with one of the programmers here, and we went through his VB.NET references - sure enough, its there but in the 'all users' folder, not under my name (i do have admin privileges). Weird that a windows search for the file (inluding system and hidden files) didnt turn it up...

                      Anyways, next problem is getting vbsedit to recognize it... When i reference that tlb and give the program ID as "InDesign.Application.CS3" it says 'cant find object in library'.
                      Should the object be referenced using a different name?

                      I know this is getting a little off topic, but any help would be much appreciated.

                      Cheers,
                      Adam
                      • 8. Re: [VBS][CS3] WEIRD problem, need help!
                        Level 1
                        Hi Adam,

                        While I like VBSEdit a lot, I never have been able to get it to recognize the CS3 type library. I've even written to their tech support about it, and have not gotten any reply. I just use VB (like VBA or VB6--anything pre-.NET) to look at the library.

                        Thanks,

                        Ole