Jump to content
Macro Express Forums

variable jumping when incremented in the code


sunilvedula
 Share

Recommended Posts

Hi All,

 

i am attaching a code below. In that code the variable is set to 1 and when asked to increment it is getting incremented twice. But afte that it gets incremented properly. basically Variable N1 is becoming 2 but going to 3 and from there onwards 4, 5... so on.

<REM2:****OPENING MONARCH****><IVAR2:02:01:1><LAUNCHDEL2:0:01C:\Program Files\Monarch\Program\Monarch.exe><TDELAY:3><REP3:06:000004:000002:0002:0:01:6><TEXTTYPE:<ALT>f><TDELAY:1><TEXTTYPE:R><TDELAY:1><IFVAR2:2:02:1:1><IFOTH:01:2:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCRR><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCRR><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB>><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB>><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:a><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><TDELAY:1><TEXTTYPE:<ARROW UP><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><TEXTTYPE:<ALT>f><TEXTTYPE:m><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MIS\visa outgoing rr><TDELAY:1><REM2:****Moving to the folder MIS for the modals****><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><REM2:****CREATING THE TABLE***><TEXTTYPE:<ALT>w><TEXTTYPE:t><TDELAY:1><REM2:****EXPORTING THE DATA***><TEXTTYPE:<ALT>f><TEXTTYPE:e><TDELAY:1><TEXTTYPE:n><TDELAY:1><TEXTTYPE:<DELETE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCRR.xls><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:3><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><NMVAR:08:02:0:0000001:0:0000000><ELSE><NMVAR:08:02:0:0000001:0:0000000><ENDIF><ELSE><IFVAR2:2:02:1:2><IFOTH:01:2:S:\HBME\HBME Chargebacks and Dispute ResolutionE\Database\Monarch\VCCBK><TDELAY:1><TEXTTYPE:<BACKSPACE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCCBK><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB>><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB>><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:a><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><TDELAY:1><TEXTTYPE:<ARROW UP><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><TEXTTYPE:<ALT>f><TEXTTYPE:m><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MIS\Visa Chargeback><TDELAY:1><REM2:****Moving to the folder MIS for the modals****><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><REM2:****CREATING THE TABLE***><TEXTTYPE:<ALT>w><TEXTTYPE:t><TDELAY:1><REM2:****EXPORTING THE DATA***><TEXTTYPE:<ALT>f><TEXTTYPE:e><TDELAY:1><TEXTTYPE:n><TDELAY:1><TEXTTYPE:<DELETE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCCBK.xls><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:3><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><NMVAR:08:02:0:0000001:0:0000000><ELSE><NMVAR:08:02:0:0000001:0:0000000><ENDIF><ELSE><IFVAR2:2:02:1:3><IFOTH:01:2:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCREP><TDELAY:1><TEXTTYPE:<BACKSPACE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCREP><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB>><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB>><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:a><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><TDELAY:1><TEXTTYPE:<ARROW UP><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><TEXTTYPE:<ALT>f><TEXTTYPE:m><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MIS\Visa-Inc Rept><TDELAY:1><REM2:****Moving to the folder MIS for the modals****><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><REM2:****CREATING THE TABLE***><TEXTTYPE:<ALT>w><TEXTTYPE:t><TDELAY:1><REM2:****EXPORTING THE DATA***><TEXTTYPE:<ALT>f><TEXTTYPE:e><TDELAY:1><TEXTTYPE:n><TDELAY:1><TEXTTYPE:<DELETE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\VCREP.xls><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:3><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><NMVAR:08:02:0:0000001:0:0000000><ELSE><NMVAR:08:02:0:0000001:0:0000000><ENDIF><ELSE><IFVAR2:2:02:1:4><IFOTH:01:2:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCRR><TDELAY:1><TEXTTYPE:<BACKSPACE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCRR><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB>><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB>><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:a><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><TDELAY:1><TEXTTYPE:<ARROW UP><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><TEXTTYPE:<ALT>f><TEXTTYPE:m><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MIS\MC Outgoing Report><TDELAY:1><REM2:****Moving to the folder MIS for the modals****><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><REM2:****CREATING THE TABLE***><TEXTTYPE:<ALT>w><TEXTTYPE:t><TDELAY:1><REM2:****EXPORTING THE DATA***><TEXTTYPE:<ALT>f><TEXTTYPE:e><TDELAY:1><TEXTTYPE:n><TDELAY:1><TEXTTYPE:<DELETE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCCBK.xls><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:3><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><NMVAR:08:02:0:0000001:0:0000000><ELSE><NMVAR:08:02:0:0000001:0:0000000><ENDIF><ELSE><IFVAR2:2:02:1:5><TDELAY:1><TEXTTYPE:<BACKSPACE>><TDELAY:1><IFOTH:01:2:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCCBK><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCCBK><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB>><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB>><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:a><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><TDELAY:1><TEXTTYPE:<ARROW UP><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><TEXTTYPE:<ALT>f><TEXTTYPE:m><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MIS\MC RR Report><TDELAY:1><REM2:****Moving to the folder MIS for the modals****><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><REM2:****CREATING THE TABLE***><TEXTTYPE:<ALT>w><TEXTTYPE:t><TDELAY:1><REM2:****EXPORTING THE DATA***><TEXTTYPE:<ALT>f><TEXTTYPE:e><TDELAY:1><TEXTTYPE:n><TDELAY:1><TEXTTYPE:<DELETE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCRR.xls><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:3><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><NMVAR:08:02:0:0000001:0:0000000><ELSE><NMVAR:08:02:0:0000001:0:0000000><ENDIF><ELSE><IFVAR2:2:02:1:6><IFOTH:01:2:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCREP><TDELAY:1><TEXTTYPE:<BACKSPACE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCREP><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB>><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB>><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:a><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><TDELAY:1><TEXTTYPE:<ARROW UP><ARROW DOWN>><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><TEXTTYPE:<ALT>f><TEXTTYPE:m><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MIS\MC Representment-New><TDELAY:1><REM2:****Moving to the folder MIS for the modals****><TDELAY:1><TEXTTYPE:<ALT>o><TDELAY:1><REM2:****CREATING THE TABLE***><TEXTTYPE:<ALT>w><TEXTTYPE:t><TDELAY:1><REM2:****EXPORTING THE DATA***><TEXTTYPE:<ALT>f><TEXTTYPE:e><TDELAY:1><TEXTTYPE:n><TDELAY:1><TEXTTYPE:<DELETE>><TDELAY:1><TEXTTYPE:S:\HBME\HBME Chargebacks and Dispute Resolution\Database\Monarch\MCREP.xls><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ALT>n><TDELAY:1><TEXTTYPE:<ENTER>><TDELAY:3><TEXTTYPE:<ENTER>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><TDELAY:1><TEXTTYPE:<CONTROL><F4>><NMVAR:08:02:0:0000001:0:0000000><ELSE><NMVAR:08:02:0:0000001:0:0000000><ENDIF><ENDIF><ENDIF><ENDIF><ENDIF><ENDIF><ENDIF><ENDREP>

Link to comment
Share on other sites

... the variable is set to 1 and when asked to increment it is getting incremented twice. But afte that it gets incremented properly. basically Variable N1 is becoming 2 but going to 3 and from there onwards 4, 5... so on

I think you mean Variable N2; there is no reference to N1 in the macro. I put a text box display of N2 right after the REPEAT UNTIL statement, and it is incrementing properly for me.

 

The REPEAT structure and the use of N2 seem to serve no useful function, since you execute a separate block of code each time through the REPEAT loop. Why not get rid of the REPEAT and all checking and incrementing of N2, and simply run the blocks of code for each IF FILE EXISTS one after the other?

Link to comment
Share on other sites

Yeah i was talking abt the variable N2. You are right. sorry for the mistake. I have tried but the use of repeat is becoz i want all the loops to work one afte the other. If i remove the repeat it does not work. It stops after perfomring the first iteration. It doesnt go to the second file. Any help? Also with the existing code when i put a text box display right after the n2=1 loop completed at the place where the increment takes place it shows n2=2 twice and then again shows n2=3. this is the main issue. When i removed the last increment at n2=6 after else there then it worked fine for me but had small issue at n2=6. Can you pls help me out with this.

Link to comment
Share on other sites

This is what I mean by getting rid of the REPEAT and all the references to %N2%:

 

// ***OPENING MONARCH****

Variable Set Integer %N2% to 1

Program Launch: "Monarch.exe"

Wait Time Delay 3 Seconds

Text Type: <ALT>f

Wait Time Delay 1 Seconds

Text Type: R

Wait Time Delay 1 Seconds

//

If File Exists "VCRR"

~~~~~

End If

//

If File Exists "VCCBK"

~~~~~

End If

//

If File Exists "VCREP"

~~~~~

End If

//

If File Exists "MCRR"

~~~~~

End If

//

Wait Time Delay 1 Seconds

Text Type: <BACKSPACE>

Wait Time Delay 1 Seconds

//

If File Exists "MCCBK"

~~~~~

End If

//

If File Exists "MCREP"

~~~~~

End If

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...