If-Then-Goto

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Alex Silva

If-Then-Goto

Post by Alex Silva » Mon Mar 03, 2003 4:17 pm

Can someone help me with my macro.

Right now I have it


WaitWindowClosed>Acrobat Scan Plug-in

There are several commands, of course, and it is working right now. THe problem is that if I hit ENTER I am having to click the left button at a specific place, which I already have the coordinates.

Which is waiting on that program, of course. The program gives me the option of hitting ENTER (yes) to do it again, or ESC (no) to exit and go back to the program itself.

What I was thinking was putting an IF-THEN-GOTO, that if I hit ENTER, it will click at a specific place, which I already have it clicking there just before it gets to the command of WaitWindowClosed above, so it repeats the previous commands, or if I hit ESC then it will continue with the macro, which is SAVE AS the name/number that I entered at the beginning of the macro with an INPUT command.

I just don't know how the IF-THEN-GOTO-LABEL command might go to recognice the ENTER button or the ESC button. Can someone with more expertice help me?

Thanks in advance

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 » Mon Mar 03, 2003 6:55 pm

Try something like this:

Ask>Want to Save?,Answer
If>Answer=YES,Save,NoSave

Label>Save
PushButton>ScreenName,EcsButtonName
Goto>End

Label>NoSave
PushButton>ScreenName,EnterButtonName

Label>End

=======================
Hope this helps.....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Alex Silva

Post by Alex Silva » Tue Mar 04, 2003 5:27 am

What happens is that the software is Acrobat 5, I am scanning paper and turning it into PDF. Acrobat will ask YES for another page or NO to stop scanning or adding pages. Well, if you hit ENTER, it goes on to my scanning software, Microtek ScanWizard 5.0, if you hit ESC then it is the same as hitting the NO button with the mouse. What I am trying to do is speed up the process, rather than clicking with the mouse, hitting ENTER or ESC, which Acrobat accepts it as clicking YES or NO.

So, I don't think what you wrote will work. I haven't tried it yet, but I just don't see it working.

I already have it waiting on the window. If I hit ESC/NO then it will do a ALT-S and enter then name of the file from the INPUT at the begining of the macro.

Thanks though. If you have another tip, I'll greatly appreciate it since I am totally outta answers.

Alex

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Mar 04, 2003 9:41 am

Hi,

I'm not sure I understand what you want to do. If you want to wait for a key press use WaitKeyDown.

Or use an Ask dialog:

Ask>Continue?,yn
If>yn=YES,yesbit,nobit

Label>yesbit

Do something here if user hits Yes

Goto>continue

Label>nobit

Do something here if user hits No

Label>continue
MJT Net Support
[email protected]

Alex Silva

Post by Alex Silva » Tue Mar 04, 2003 3:43 pm

Acrobat all by itself has a screen that says Continue (enter) or Exit (esc) when you are aquiring from a scanner. The WaitKeyDown sounds like it might work. I just need to find out what Enter and ESC stand for.

I am creating a macro to use Acrobat and Microtek ScanWizard to create a paperless environment in my office. :) Everything works fine so far with the following macro that I wrote, but I am trying to tweak it.

Run Program>C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
Press ALT
Send Character/Text>WO
Release ALT
Press ALT
Send Character/Text>FMN
Release ALT
Press Enter
Wait>2
MouseMove>486,216
LClick
WaitWindowClosed>Acrobat Scan Plug-in
Input>bill,Invoice Number
Press ALT
Send Character/Text>FS
Release ALT
Send Character/Text>C:\Scan Documents\Account Receivable
Press Enter
Send Character/Text>bill
Press Shift
Press Tab
Release Shift


I just want to have it loop around the scanning procedure if I hit ENTER or continue if I hit ESC.

I still need to find out what is the VK for ENTER and for ESC, and then create my IF-LOOP, which I have NO CLUE since I have never done that.

Thanks and if anyone cares to help me with the loop, that would be greatly appreciate it. If I get it all working, then I'll post the complete script here for anyone to either use it or get an idea.

Alex Silva

Finally, thank you!

Post by Alex Silva » Tue Mar 04, 2003 7:54 pm

Want to thank you guys for lighting me. I didn't understand what you guys were saying since I have never done a LOOP of any kind. Sorry, not a programmer myself. But I knew it could be done. Here is what I came up with, it is probably crappy code in your eyes, or maybe you would off done it differently, less steps, but that is what my brain could come up with, and best of all, it works for me! Thank you.

Alex

Run Program>C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
Press ALT
Send Character/Text>WO
Release ALT
Press ALT
Send Character/Text>FMN
Release ALT
Press Enter

Wait>2
MouseMove>486,216
LClick
Goto>scanloop

Label>scanloop
WaitWindowChanged>*Microtek ScanWizard 5*
WaitWindowChanged>Acrobat Scan Plug-in
Ask>Scan More Sheets?,yn
if>yn=YES,multiscan,continue

Label>multiscan
SetFocus>Acrobat Scan Plug-in
Press Enter
Wait>1
MouseMove>486,216
LClick
Goto>scanloop


Label>continue
SetFocus>Acrobat Scan Plug-in
Press Esc
WaitWindowClosed>Acrobat Scan Plug-in
Input>bill,Invoice Number
Press ALT
Send Character/Text>FS
Release ALT
Send Character/Text>C:\Scan Documents\Account Receivable
Press Enter
Send Character/Text>bill
Press Shift
Press Tab
Release Shift

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