Page 1 of 1

using GetPackAndGo in autohotkey

Posted: Tue Aug 17, 2021 5:30 pm
by colt
I have converted most of my macros over to autohotkey, but am having trouble with the GetPackAndGo command. Autohotkey is an untyped language that can run vba macro code with only a few syntax changes. I kept getting the error 'parameter not optional' in ahk and 'argument not optional' in macro.

Code: Select all

'Dim swModel As SldWorks.ModelDoc2
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swPackAndGo = swModel.Extension.GetPackAndGo() 'error here
Debug.Print swPackAndGo.GetDocumentNamesCount()
Uncommenting the swModel declaration fixes the problem in macro. The problem is I can not specify the variable type in Autohotkey. I am not sure what exactly is happening when that variable gets defined, but normally you can just skip that step unless you want auto-completion.

Anyone else have experience with this?

Re: using GetPackAndGo in autohotkey

Posted: Wed Aug 18, 2021 3:46 am
by zwei
My personal experience with IPackAndGo Interface is that it is rather unstable...
I have a macro that work fine months ago but now will crash whenever I run because of the pack and go code...

Unless you require to pack into zip file... Can you use saveas method instead?

Re: using GetPackAndGo in autohotkey

Posted: Wed Aug 18, 2021 11:44 am
by colt
Good info, thanks for the warning. It is too bad because the gui pack and go does everything I need it is just way to clunky and slow. My ultimate goal was to use the swDocumentManager to build my own pack and go in autohotkey but the doc manager is having an even harder time in ahk. I was planning on using the default module as a crutch until I got the doc manager to work. Maybe I should just focus on driving the gui with ahk.

Re: using GetPackAndGo in autohotkey

Posted: Wed Aug 18, 2021 2:24 pm
by Austin Schukar
Might be absolutely silly, but could you try removing the parentheses behind GetPackandGo?

I.E.:

Set swPackAndGo = swModel.Extension.GetPackAndGo

Re: using GetPackAndGo in autohotkey

Posted: Wed Aug 18, 2021 3:40 pm
by colt
Yeah, that still throws the same error.