Oh well I found in another post that you in order to use a variable in a dialog box you have to declare it as modal. That pretty much solves the problem.
On a related note, is there an easy way of detecting if a dialog box is open, and then what to do if it is? When I run this script, if the cam documents already exist in that folder, it will ask if I want to overwrite them. But if they don't already exist, it won't ask. I'd like to have an If statement that will detect if the dialog box opens, and if it does, just click "yes" to overwrite.
I'm glad you found your problem already! Can you post the script? It sounds useful.
Here is the macro (two thirds of the way down I have commented out the section that I'm not sure how to generate dynamically so that I don't have to answer "yes I actually do want to go ahead and generate the CAM outputs":
'Open the Cam Dialog
Application.ExecuteCommand("Define Cam Documents")
'Select all items in the listbox
x = DefineCamDocumentsDlg.CamDocuments.ListCount
For i = 0 to x-1
DefineCamDocumentsDlg.CamDocuments.Selected(i) = true
'Run CAM Outputs
'Answer "do you want to generate files" dialog
'Here is the problem: Depending on what CAM outputs there are, the dialog box name will change
'DlgPrompt.Question("Do you wish to generate the following outputs? : [Name of CAM Outputs Here]").Answer(mbYes)
'Close CAM Dialog
So what scripting language are you using? that doesn't look like Sax Basic . I'll script something every couple of years or so and it looks like you are into a realm that I've never explored before. Where did you find documentation on "Define Cam Documents"?
I wonder if there is a (unexpected) 'dialog opened' option where you can tell the script to answer yes and continue? If not the CAMDocumentsRun routine would need to be smart enough to have an input that tells it to overwrite the files.
On a side note, at least in 9.3 they fixed the issue where it used to pop up that dialog asking about overwriting for EACH document; that was a pain!
This is a PADS macro. You can record/edit/play macros in PADS just like you can in Excel. In the menu bar, go to View->Output Window (and make sure its not collapsed at the bottom of the screen), and then in the tabs on the bottom of the output window click "macros" (or go to Tools->macros->new macro...).
The PADS User's Guide and Reference Manual has a section on the macro language. You can code one from scratch, but the easiest thing is to record one, then modify it using whatever if/else for/next, etc. programming commands you want.
You can also record a macro then run it using a Sax Basic script using the Application.RunMacro command. What I find useful is actually building a macro using text strings in a basic script, then save that to a .mcr macro file, then run the macro using the RunMacro command, and then deleting the .mcr file. That way the whole macro is contained in the vbscript and you can add dynamic content that is more easily obtained from basic script commands.