Jump to content
Macro Express Forums

Setting Variable %t%n1%%


cyberchief

Recommended Posts

Hello Cyberchief!

 

Ok. Back to the %T%N1%%. Here is what I am trying to do: I set %N9% to a value of 50. I set a repeat loop (up to 36 times). Screen copy a page out of the program, set to T31, amend T31 to T30, page back and screen copy again (in another loop), set to T31, amend to T30. So, I have 2 screen copies set to T30 now. I need to set T30 to a %T%N9%% so I can go back a month in the program, increment %N9% up by 1, and do the above again. Again, this can happen up to 36 times. All of my screen copies will then be set to %T50% through up to %T86%. I need to set %N9% back to 50. Set a loop that will set %T30% from %T%N9%%. I need to process some text values depending on the contents of %T30%, then loop back and do this again after incrementing %N9% by 1 (so I will be working with the next month's screen copies).

Here is an answer based on your above statement. There is absolutely no need to use the Variables Evaluation Level feature of Macro Express to solve this problem. What you want to do is very simple, and can be handled quite easily just using the dynamic Run Macro in Variable command.

 

Repeat Start (Repeat 36 times)
 Variable Set String %T30% ""
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\
 // Replace this comment block with your code that sets T30   \\
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\
 Variable Set String %T1% "<TMVAR2:09:%N9%:30:000:000:>"
 Run Macro in Variable %T1%
Repeat End

Repeat Start (Repeat 36 times)
 Variable Set String %T1% "<TMVAR2:09:30:%N9%:000:000:>"
 Run Macro in Variable %T1%
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\
 // Replace this comment block with your code that processes T30   \\
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\
Repeat End


<REP3:01:000051:000001:00036:1:09:><TVAR2:30:01:><REM2:= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\><REM2:Replace this comment block with your code that sets T30   \\><REM2:= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\><TVAR2:01:01:<TMVAR2:09:%N9%:30:000:000:>><RUNMACVAR:1><ENDREP><REM2:><REP3:01:000051:000001:00036:1:09:><TVAR2:01:01:<TMVAR2:09:30:%N9%:000:000:>><RUNMACVAR:1><REM2:= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\><REM2:Replace this comment block with your code that processes T30   \\><REM2:= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\\><ENDREP>

Link to comment
Share on other sites

Hi again,

Change the "hi" if you wany; I expected you would have your own input here;

<TVAR2:10:01:hi%N9%>
  Variable Set String %T10% "hi%N9%"

Just use a display box thus;

<TBOX4:T:1:Center000254000278000332:000:T1=%T1%

T2=%T2%

T3=%T3%

T4=%T4%

T5=%T5%

T6=%T6%

T7=%T7%

T8=%T8%

T9=%T9%

T10=%T10%>

Text Box Display:

==================================================

Randall

Link to comment
Share on other sites

Also;

You Would need to use the "variable evaluation level" to display them, if that is what you want, as in my first post;

Display

<REM2:-----------------------------------------------------------------------------------------------><REM2:Enable the Variables Evaluation Level option><REM2:-----------------------------------------------------------------------------------------------><VSETMISC:T1:Preferences Registry Key><IVAR2:04:01:2><DIS:<REGRINT:4:%T1%\AdvOptions\Variables Evaluation Level><DIS:<IVAR2:04:02:FEnter the desired Variable Evaluation Level. Enter 0 to disable the Variable Evaluation Level.TFCenter:Center><REGWINT:4:%T1%\AdvOptions\Variables Evaluation Level><RELOADPREFS><ASCIIC:2:1:10><ASCIIC:3:1:13><TMVAR2:08:03:02:000:000:><TMVAR2:19:03:00:000:000:CRLF><REP3:01:000001:000001:00010:1:01:><TVAR2:98:01:hi%N1%><TMVAR2:16:98:00:000:000:><TVAR2:02:03:><TVAR2:31:01:<TVAR2:%N1%:03:>><RUNMACVAR:31><TMVAR2:07:99:00:000:000:%CRLF%T%N1%=%T%N1%%><ENDREP><TBOX4:T:1:Center000254000278000332:000:%T99%

T1=%T1%

T2=%T2%

......

T9=%T9%

T10=%T10%>

// -----------------------------------------------------------------------------------------------

// Enable the Variables Evaluation Level option

// -----------------------------------------------------------------------------------------------

Set Variable %T1% to "Preferences Registry Key"

Variable Set Integer %N4% to 2

Read Registry Integer: "Variables Evaluation Level"

Variable Set Integer %N4% from Prompt

Write Registry Integer: "Variables Evaluation Level"

Reload Macro Express Preferences

Variable Set %T2% to ASCII Char of 10

Variable Set %T3% to ASCII Char of 13

Variable Modify String: Append %T2% to %T3%

Variable Modify String: Save %T3% to Environment Variable

Repeat Start (Repeat 10 times)

  Variable Set String %T98% "hi%N1%"

  Variable Modify String: Save %T98% to Clipboard

  Variable Set String %T2% from Clipboard

  Variable Set String %T31% "<TVAR2:%N1%:03:>"

  Run Macro in Variable %T31%

  Variable Modify String: Append "%CRLF%T%N1%=%T%N1%%" to %T99%

Repeat End

Text Box Display:

Randall
Link to comment
Share on other sites

Thank you very much Randall and Joe. Sorry for being such a pain. For some reason.. the logic on this stuff is escaping me...

 

I have put Joe's code in... and so far so good... one little problem. When I go to retreive the info after increasing N9 by 1, it does not seem to be pulling the info for the new month. I will continue to work with it... I think I am close. Thank you all for all the help!!! It is really appreciated.

Link to comment
Share on other sites

Hello Cyberchief!

 

There are two differences from your quote that I should have mentioned:

  • Both loops use T51 through T86. Not T50, which would have been 37 iterations.
  • The upper loop resets T30 to a blank string prior to each iteration through the loop.

Link to comment
Share on other sites

Even though you are not using environment variables now, I thought it wise to finish this discussion for others who use environment variables in the future.

 

If the 32K is for ALL enviroment variables together, then this will not work for my purposes
Yes, 32K is the limit for all environment variables together.

 

But what is interesting is that I do not have any enviroment variables set (that I know of)... and just the 5K one will not work.
Your system defines a number of environment variables. The easiest way I know to display them is to open a DOS Command Prompt. Click Start, Programs, Accessories and then Command Prompt. Inside the command Prompt window type set followed by the ENTER key. A number of environment variables will be displayed including things like this:

ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\XXXXXX\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=XXXXXX
OS=Windows_NT
Path=C:\Program Files\xxx;C:\Program Files\xxxl\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\xxxx;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 5, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0205
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS

But, on most computers, the number of environment variables defined by the system would not come very close to the 32K limit. It is possible that something inside your data is causing a problem. As I mentioned, environment variables are designed to accept string data that does not include non-displayable characters. Depending on the source, some string data contain things like the ASCII NUL character (00 hex) that you cannot see.

Link to comment
Share on other sites

Hello Cyberchief!

 

There are two differences from your quote that I should have mentioned:

  • Both loops use T51 through T86. Not T50, which would have been 37 iterations.
  • The upper loop resets T30 to a blank string prior to each iteration through the loop.

Hey Joe!

 

I am not too concerned about whether it starts at T51 or T50. It will loop a maximum of 36 times... but not always. I have reset T30 in the loop that goes bac to process the data... but I am hitting a snag. I have bothered you all enough so I will try and see what I can figure out with this. During the first loop, it outputs the info correctly... but I modify N9 by incrementing up by 1 (as I do in the first loop), but it inputs the same data as the first loop (like it is not incrementing). Very strange. Anyway, i will keep working with it. Thanks much!

Link to comment
Share on other sites

It is no bother. Helping is what this forum is all about.

 

You should not have to increment N9 yourself, because that is what the loop does automatically.

 

Even though we cannot run it, paste your code so we can see it.

Link to comment
Share on other sites

Hi,

I agree; don't be so coy!

I wonder, as Joe says, if you are not using the "Repeat" command itself to increment the counter, whether you have it set to upset your manual counting?....

RepeatOptions.JPG

Also, simplified example with display (had T1 instead of T50)

<REM2:Repeat for T50-T51><REP3:01:000050:000001:00002:1:09:><TVAR2:10:01:hi%N9%><TVAR2:31:01:<TMVAR2:09:%N9%:10:000:000:>><RUNMACVAR:31><ENDREP><TBOX4:T:1:Center000254000278000332:000:After first LoopT50=%T50%

T51=%T51%

 

T10=%T10%><REM2:Repeat for T50-T51><REP3:01:000050:000001:00002:1:09:><TVAR2:31:01:<TMVAR2:09:10:%N9%:000:000:>><RUNMACVAR:31><TBOX4:T:1:Center000254000278000332:000:During second loopT50=%T50%

T51=%T51%

 

T10=%T10%><ENDREP>

// Repeat for T50-T51

Repeat Start (Repeat 2 times)

  Variable Set String %T10% "hi%N9%"

  Variable Set String %T31% "<TMVAR2:09:%N9%:10:000:000:>"

  Run Macro in Variable %T31%

Repeat End

Text Box Display: After first Loop

// Repeat for T50-T51

Repeat Start (Repeat 2 times)

  Variable Set String %T31% "<TMVAR2:09:10:%N9%:000:000:>"

  Run Macro in Variable %T31%

  Text Box Display: During second loop

Repeat End

Best, Randall

Link to comment
Share on other sites

Ok... it is kinda long.. but here it goes.

 

The macro I have is to do an audit of taxes billed on monthly invoices.

 

This portion pulls up the invoice, copies each page until it hits the tax page. because the taxes can be on mulitple pages, it copies each page until it gets to the "Federal Universal" portion which is always at the end. It breaks there. With each page copy, it sets it to T31 and amends that to T30... so at the end of that loop, I have about 3 or 4 pages set in T30. I am trying to set this value to the variable... because after that, I have to go back 1 month and do the same thing with the prior months invoice. (up to 3 years back)

 

<REM2:Start Loop (36 month)><IVAR2:09:01:50><REP3:05:000001:000001:0050:0:01:><REM2:><REM2:Find FEDERAL EXCISE><IVAR2:40:01:1><REP3:08:000002:000001:0001:1:01:T1><TEXTTYPE:<CTRLD>a<CTRLU>><CLIPC><TVAR2:31:03:><TMVAR2:08:30:31:000:000:><IFOTH2:08:1:FEDERAL UNIVERSAL><BREAK><ELSE><IFVAR2:2:40:4:10><BREAK><ELSE><NMVAR:01:40:1:0000040:2:0000001><TEXTTYPE:<F11>><CAPCONTROL:T:3:1:000449,000703><REP3:08:000007:000001:0025:0:01:Logged in><VARGETCONT:1:25><IFVAR2:1:25:7:Logged in><BREAK><ENDIF><ENDREP><ENDIF><ENDIF><ENDREP><TMVAR2:04:30:00:000:000:><TVAR2:01:01:<TMVAR2:09:%N9%:30:000:000:>><RUNMACVAR:1><REM2:><REM2:Retreive next bill><REM2:><TEXTTYPE:<F6>><CAPCONTROL:T:3:1:000449,000703><REP3:08:000007:000001:0025:0:01:Logged in><VARGETCONT:1:25><IFVAR2:1:25:7:Logged in><BREAK><ENDIF><ENDREP><MSD:100><TEXTTYPE:<CTRLD>a<CTRLU>><CLIPC><TVAR2:02:03:><IFVAR2:1:02:7:REQUESTED><BREAK><ENDIF><NMVAR:01:09:1:0000009:2:0000001><REM2:END of LOOP (36 month)><ENDREP><MACRUN2:Bill TAX Note Spreadsheet>

 

The next portion here takes those values and finds what I am looking for.. mainly Federal, State, County, and City tax. It should pull the very first value of T30 and search that for all the info. It goes to the spreadsheet and notes it. Loops back and should go to the next page that I set in the variable. Here is where I am having the problems.... it is not incrementing N9 to the next page.

 

<NMVAR:07:09:0:0000096:0:0000000><NMVAR:02:96:1:0000096:2:0000050><ACTIVATE2:%T99%><IVAR2:09:01:50><DELAY:1><REM2:><REP3:05:000001:000001:0096:0:01:><TVAR2:30:01:><TVAR2:32:01:><TVAR2:34:01:><TVAR2:36:01:><TVAR2:38:01:><REM2:><REM2:Set T30 from %T%N9%%><TVAR2:01:01:<TMVAR2:09:30:%N9%:000:000:>><RUNMACVAR:1><REM2:><REM2:><REM2:Get Tax Info><REM2:><MACRUN2:Bill Tax Get Amounts by Invoice><REM2:><REM2:><REM2:Enter Federal Tax Info><MSD:100><TEXTTYPE:%T32%><MSD:100><TEXTTYPE:<ARROW DOWN>><REM2:><REM2:><REM2:Enter State Tax Info><MSD:100><TEXTTYPE:%T34%><MSD:100><TEXTTYPE:<ARROW DOWN>><REM2:><REM2:><REM2:Enter County Info><MSD:100><TEXTTYPE:%T36%><MSD:100><TEXTTYPE:<ARROW DOWN>><REM2:><REM2:><REM2:Enter City info><MSD:100><TEXTTYPE:%T38%><MSD:100><TEXTTYPE:<ARROW RIGHT>><MSD:100><TEXTTYPE:<ARROW UP><ARROW UP><ARROW UP>><MSD:100><REM2:><REM2:><NMVAR:01:09:1:0000009:2:0000001><REM2:><ENDREP><TEXTTYPE:<CTRLD><ARROW LEFT><ARROW LEFT><ARROW LEFT><CTRLU>><MSD:100><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN>><MSD:100>

 

 

Inside that, I run macro Bill Tax get Amounts by invoice. Here is the code for that:

 

<REM2:Get Federal><IFVAR2:1:30:7:FEDERAL EXCISE><IVAR2:76:13:30:FEDERAL EXCISE><NMVAR:01:76:1:0000076:2:0000044><TMVAR2:10:32:30:N76:010:><ELSE><TVAR2:32:01:XMPT OR 0><ENDIF><REM2:><REM2:Get State><IFVAR2:1:30:7:STATE SALES><IVAR2:76:13:30:STATE SALES><NMVAR:01:76:1:0000076:2:0000044><TMVAR2:10:34:30:N76:010:><ELSE><TVAR2:34:01:XMPT OR 0><ENDIF><REM2:><REM2:Get County><IFVAR2:1:30:7:COUNTY SALES><IVAR2:76:13:30:COUNTY SALES><NMVAR:01:76:1:0000076:2:0000044><TMVAR2:10:36:30:N76:010:><ELSE><TVAR2:36:01:XMPT OR 0><ENDIF><REM2:><REM2:Get Local><IFVAR2:1:30:7:CITY SALES><IVAR2:76:13:30:CITY SALES><NMVAR:01:76:1:0000076:2:0000044><TMVAR2:10:38:30:N76:010:><ELSE><TVAR2:38:01:XMPT OR 0><ENDIF><REM2:>

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...
×
×
  • Create New...