Help with Include/Calling scripts and looping

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Help with Include/Calling scripts and looping

Post by gchichester » Thu Feb 19, 2009 11:04 am

Because I’ve been posting a lot questions, I thought it would be helpful to
explain some of what I trying to accomplish.
So here’s the big picture, and a request for any feedback that would help.

Objective: Automate a poorly written vertical market application that
requires a lot of back and forth from keyboard to mouse.

Solution: After trying several different scripting tools.
Macro Scheduler was the best choice.

Processes: User initiated scripts, Dialogs/Forms to collect data.

Dialogs: I needed Dialogs that can account for up to 140+ variables,
but they are not all used every time. So I broke them down
in to 4 separate dialogs each having more variables then the
last. Using yet another variable to call the correct dialog.
For each dialog there is a corresponding action script,
That’s Included/called when closed.

Example: NewBill.scp runs which has the starting BoLDialog, when it closes
the script continues until the ContXX_Dlg.scp is called which is
based on the variable BoLDialog.NumOfCont and calls 1 of the 4 dialogs.(See Below)

If “OneCountâ€

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Feb 19, 2009 4:27 pm

No time to work on this now, but a few comments on this section:

Code: Select all

Label>ContCount
If>%BoLDialog.NumOfCont%>20,ThirtyCount
If>%BoLDialog.NumOfCont%>10,TwentyCount
If>%BoLDialog.NumOfCont%>5,TenCount
If>%BoLDialog.NumOfCont%>1,FiveCount
If>%BoLDialog.NumOfCont%<1>OneCont

Label>FiveCount
Let>Dlg=Cont5
Include>c:\CP_Macros\Cont5_Dlg.scp
Include>c:\CP_Macros\ContFill.scp
Goto>Exit

Label>TenCount
Let>Dlg=Cont10
Include>c:\CP_Macros\Cont10_Dlg.scp
Include>c:\CP_Macros\ContFill.scp
Goto>Exit

Label>TwentyCount
Let>Dlg=Cont20
Include>c:\CP_Macros\Cont20_Dlg.scp
Include>c:\CP_Macros\ContFill.scp
Goto>Exit

Label>ThirtyCount
Let>Dlg=Cont30
Include>c:\CP_Macros\Cont30_Dlg.scp
Include>c:\CP_Macros\ContFill.scp
Goto>Exit

Label>OneCont
Script Continues
Label>Exit
1. You have no IF %BoLDialog.NumOfCont%=1.
2. Syntax on last IF line is not correct: If>%BoLDialog.NumOfCont%OneCont
2. Each of the nCount sections could be eliminated and replaced with one routine that has the value of Dlg in the strings. Something like this.

Code: Select all

If>%BoLDialog.NumOfCont%>20
   Let>Dlg=30
ELSE
If>%BoLDialog.NumOfCont%>10
   Let>Dlg=20
ELSE
...
...
...
ENDIF

Label>Process
Include>c:\CP_Macros\Cont%Dlg%.scp
Include>c:\CP_Macros\ContFill.scp
Goto>Exit
Again, no time to do any more right now.....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Help with Include/Calling scripts and looping

Post by gchichester » Thu Feb 19, 2009 8:32 pm

Bob, I don't need a IF %BoLDialog.NumOfCont%=1, because I don't call any dialogs for just 1
It's added to the main dialog. My intention is If>%BoLDialog.NumOfCont%OneCount and continue the script.

This was a typo “If>%BoLDialog.NumOfCont%,OneCountâ€

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Help with Include/Calling scripts and looping

Post by gchichester » Fri Feb 20, 2009 2:16 pm

My test script seemed to work but after adding it to the main script,
It won’t call/include/run any of the dialogs, The only one it runs is “OneCountâ€
Last edited by gchichester on Mon Mar 02, 2009 11:29 am, edited 2 times in total.

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Help with Include/Calling scripts and looping

Post by gchichester » Sun Mar 01, 2009 4:07 pm

There’s been no responses in quite as while so I was wondering if I broke some forum edict?
If so please let me know , so I don’t do it again.
I know most of the experienced members have a full time job, families, and understand there time limits. I really don’t expect a script rewrite, just a nudge in the right direction.

Thanks again for any and all nudges.
Gil Chichester

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 02, 2009 8:47 am

It's quite hard to read your script as there is no indentation. Can you paste it again, this time use the "Code" button to paste it between textarea tags. Also disable Smilies and HTML

However, a *very* quick look at your code as-is tells me it will ALWAYS run the code after the Process and OneCount labels. I'm not sure that this is what you want. If it IS what you want then there is no need for the Goto>Process lines inside your If blocks proceeding it.

Doing this, is also pointless:

Goto>label
Label>label

Neither line is needed (the script will go to the next line anyway).

You have a label called Exit which is never called and even if it was the script is not going to Exit - it will continue past that point.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts