using GetPackAndGo in autohotkey

Programming and macros
colt
Posts: 56
Joined: Tue Mar 30, 2021 5:43 pm
Answers: 0
x 14
x 22

using GetPackAndGo in autohotkey

Unread post 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?
User avatar
zwei
Posts: 701
Joined: Mon Mar 15, 2021 9:17 pm
Answers: 18
Location: Malaysia
x 185
x 600

Re: using GetPackAndGo in autohotkey

Unread post 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?
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
colt
Posts: 56
Joined: Tue Mar 30, 2021 5:43 pm
Answers: 0
x 14
x 22

Re: using GetPackAndGo in autohotkey

Unread post 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.
Austin Schukar
Posts: 98
Joined: Thu Mar 18, 2021 11:19 am
Answers: 1
Location: St. Louis, MO
x 288
x 56

Re: using GetPackAndGo in autohotkey

Unread post by Austin Schukar »

Might be absolutely silly, but could you try removing the parentheses behind GetPackandGo?

I.E.:

Set swPackAndGo = swModel.Extension.GetPackAndGo
Austin
colt
Posts: 56
Joined: Tue Mar 30, 2021 5:43 pm
Answers: 0
x 14
x 22

Re: using GetPackAndGo in autohotkey

Unread post by colt »

Yeah, that still throws the same error.
Post Reply