roboz Posted June 25, 2005 Posted June 25, 2005 (edited) Hi there, I'm writing a lot of scripts in VBScript for Adobe InDesign 2. For scripting everything else I always use AutoIt . Now I was wondering if it's possible to use VBScript in AutoIt to access InDesign but also make use of all the other AutoIt features like GUI etc. I'm not a real programmer but I already read a lot about the COM support in the latest help file and in the forum. Also the postings about how to use VBScript in AutoIt sound very promising, although I'm still not sure if it can be done what I'm looking for. I thought the best way would be probably to post this little InDesign VBscript as an example and someone might be able to tell me if this is possible through AutoIt or not. Thanks very much in advance! Dim MyIndesign Set MyIndesign = CreateObject("InDesign.Application.2.0") Set myDocument = myInDesign.ActiveDocument Set myLayers = mydocument.Layers For Each Layer In myLayers Layer.Locked = False Layer.Visible = True Next SelectionCount = 0 Set MySelectionRange = myInDesign.Activewindow.ActiveSpread For Each Frame In MySelectionRange.TextFrames If Frame.Characters.Count = 0 Then myInDesign.Select Frame, True SelectionCount = SelectionCount + 1 End If Next If SelectionCount > 0 Then MsgBox (SelectionCount & " empty Text Frames found and selected") Else MsgBox ("No empty Text Frames found") End If Edited June 25, 2005 by roboz
FuryCell Posted June 25, 2005 Posted June 25, 2005 (edited) Don't know much VB but i think it should look somthing like this. Line 14 has me stumped though. maybe somebody else knows how to fix line 14. Dim $MyIndesign $MyIndesign = ObjCreate("InDesign.Application.2.0") $qmyDocument = $myInDesign.ActiveDocument $myLayers = $mydocument.Layers For $Layer In $myLayers $Layer.Locked = 0 $Layer.Visible = 1 Next $SelectionCount = 0 $MySelectionRange = $myInDesign.Activewindow.ActiveSpread For $Frame In $MySelectionRange.TextFrames If $Frame.Characters.Count = 0 Then $myInDesign.Select Frame, True; I Don't under this line. Sorry :-( $SelectionCount = $SelectionCount + 1 EndIf Next If $SelectionCount > 0 Then MsgBox (0,"",$SelectionCount & " empty Text Frames found and selected") Else MsgBox (0,"","No empty Text Frames found") EndIf Edited June 27, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
roboz Posted June 25, 2005 Author Posted June 25, 2005 Thank you so much SolidSnake! Apart from line it's all working so far. But I'm sure we can figure that out as well. This also gives me an idea of how things work with VBS in AutoIt. Wow, that'll open whole new possibilities for my InDesign scripts! Finally I can turn all my script ideas into reality
FuryCell Posted June 26, 2005 Posted June 26, 2005 Thank you so much SolidSnake! Apart from line it's all working so far. But I'm sure we can figure that out as well.This also gives me an idea of how things work with VBS in AutoIt. Wow, that'll open whole new possibilities for my InDesign scripts! Finally I can turn all my script ideas into reality <{POST_SNAPBACK}>Your welcome. I will try and work on that line that gives me trouble. if i figure it out i will tell you. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
FuryCell Posted June 26, 2005 Posted June 26, 2005 Just saw a typo on the msgbox in my converted script.Updated the post with the fix. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
roboz Posted June 26, 2005 Author Posted June 26, 2005 (edited) Hi SolidSnak, maybe you can help me with that. This is the VBS code: mySelection.Move = Array($myX1, $myY2_store) Now I'm not quite sure what to do with this array: $mySelection.Move = ??? Any idea how to write that in AutoIt? Thanks Edited June 26, 2005 by roboz
FuryCell Posted June 26, 2005 Posted June 26, 2005 (edited) Hi SolidSnak, maybe you can help me with that. This is the VBS code:mySelection.Move = Array($myX1, $myY2_store)Now I'm not quite sure what to do with this array:$mySelection.Move = ???Any idea how to write that in AutoIt?Thanks<{POST_SNAPBACK}>Maybe this would work:#Include<Array.au3> $mySelection.Move = _ArrayCreate($myX1, $myY2_store) Edited June 26, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
roboz Posted June 27, 2005 Author Posted June 27, 2005 Maybe this would work:#Include<Array.au3> $mySelection.Move = _ArrayCreate($myX1, $myY2_store)<{POST_SNAPBACK}>Yes, that's working. Thanks again!
FuryCell Posted June 27, 2005 Posted June 27, 2005 (edited) Yes, that's working. Thanks again!<{POST_SNAPBACK}>No Problem.Also just wondering did you ever get the problem with line 14 solved. still has me stumped. Edited June 27, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
roboz Posted June 29, 2005 Author Posted June 29, 2005 No Problem.Also just wondering did you ever get the problem with line 14 solved. still has me stumped. <{POST_SNAPBACK}>I'm getting there:$myInDesign.Select ($Frame, True)This line selects at least the last created empty text frame, although it's supposed to add all empty text frames. But I'm getting closer A completely unrelated question: I'm using Scite for coding and with the VBS stuff I'm always get an error message popup when I hit F5. The code is still working it just doesn't like this line:...ERROR: ObjCreate(): undefined function.$MyIndesign = ObjCreate("InDesign.Application.2.0")You don't know by any chance how to turn off the error messages in Scite? I just couldn't find an option for that.Thanks
FuryCell Posted June 29, 2005 Posted June 29, 2005 I'm getting there:$myInDesign.Select ($Frame, True)This line selects at least the last created empty text frame, although it's supposed to add all empty text frames. But I'm getting closer A completely unrelated question: I'm using Scite for coding and with the VBS stuff I'm always get an error message popup when I hit F5. The code is still working it just doesn't like this line:...ERROR: ObjCreate(): undefined function.$MyIndesign = ObjCreate("InDesign.Application.2.0")You don't know by any chance how to turn off the error messages in Scite? I just couldn't find an option for that.Thanks<{POST_SNAPBACK}>Thanks for the reply.About your problem with Scite and VBS. I don't think scite supports VBS. Not the version we Autoit users use anyway. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
thefluxster Posted April 20, 2006 Posted April 20, 2006 (edited) Try using Alt+F5 - That will force Scite to use the beta version of AutoIT if it is installed to run the script rather than the standard version. I assume you have the beta version as the standard version doesn't support COM handling very well. Once you figure all this out, please consider making a UDF for your InDesign stuff if it's applicable to other users. I'm considering taking on a similar project for FrameMaker 7.1 Edited April 20, 2006 by thefluxster “Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker
Ármányos Kő Posted January 17, 2008 Posted January 17, 2008 Try using Alt+F5 - That will force Scite to use the beta version of AutoIT if it is installed to run the script rather than the standard version. I assume you have the beta version as the standard version doesn't support COM handling very well. Once you figure all this out, please consider making a UDF for your InDesign stuff if it's applicable to other users. I'm considering taking on a similar project for FrameMaker 7.1I am having a full toolbar for FM7.1.I know it works on FM8.0 also. Haven't tried.What do you want to do with FM?Is it COM based? I never heard of that!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now