cyberchief Posted August 12, 2005 Report Share Posted August 12, 2005 Ok... I have searched and found the examples on this... but I am still a little unclear. Is there a simple way to do a clipboard copy, and set %T%N1%% from Clipboard? If not a simple way, is there ANY way? Thanks! Quote Link to comment Share on other sites More sharing options...
randallc Posted August 13, 2005 Report Share Posted August 13, 2005 Hi, Hey, you want to be really confused>? Try this... <ASCIIC:2:1:10><ASCIIC:3:1:13><TMVAR2:08:03:02:000:000:><TMVAR2:19:03:00:000:000:CRLF><TVAR2:98:01:hi><TMVAR2:16:98:00:000:000:><REP3:01:000001:000001:00010:1:01:><TVAR2:02:03:><TVAR2:31:01:<TVAR2:%N1%:03:>><RUNMACVAR:31><TMVAR2:07:99:00:000:000:%CRLF%T(%N1%)=%T%N1%%%N1%><ENDREP><TBOX4:T:1:Center000254000278000332:000:%T99%T1=%T1% T2=%T2% ...... T9=%T9% T10=%T10%> Variable Set %T2% to ASCII Char of 10Variable Set %T3% to ASCII Char of 13 Variable Modify String: Append %T2% to %T3% Variable Modify String: Save %T3% to Environment Variable Variable Set String %T98% "hi" Variable Modify String: Save %T98% to Clipboard Repeat Start (Repeat 10 times) 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%%%N1%" to %T99% Repeat End Text Box Display: I must say, if I am trying to create arrays, I would much rather used named environment variables; at least I can follow what I'm doing myself! Best, Randall [PS, if this does not display for you, you may not have set the appropriate registry entry, as in the example macros? -I could add that, but am presuming you have done that?] Quote Link to comment Share on other sites More sharing options...
kevin Posted August 13, 2005 Report Share Posted August 13, 2005 How about this: Variable Set String %T99% from Clipboard // Copy from clipboard Variable Set String %T98% "<TVAR2:%N1%:01:%T99%\s>" // Put the direct editor command to Set Variable into T98 Run Macro in Variable %T98% // Run T98 Of course the comments in this example are not in the same position that Macro Express would place them. As Randall points out, this should work as long as the Variable Evaluation Level has been enabled. See the Variable Evaluation Level sample macro for information about how to enable this. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 15, 2005 Author Report Share Posted August 15, 2005 Thanks Randall and Kevin. A follow up question. What exactly does "Run Macro in Variable" do? And at what point do I call it? I have mulitple variables to set (up to 36 probably) that I need to put into %T%N1%%. Thanks! Quote Link to comment Share on other sites More sharing options...
kevin Posted August 15, 2005 Report Share Posted August 15, 2005 Inside Macro Express, each macro command can be represented in one of two ways. In a binary format or in an ASCII format. The ASCII format allows you to use something like a Text Editor to edit macros. You can see this format by clicking on the Direct Editor icon within Macro Express. You cannot see the binary format directly. Instead you see the macro script representation of the commands. The ASCII form of the commands is the predecessor to the current macro script/binary form of the commands. You can use the ASCII form of the commands to do some advanced macro programming. For example, you can have a mainframe application create macros that run on Macro Express. Many companies have custom programs that are written by (or for) them and are proprietary. These programs can be written to create macros and have Macro Express run them. And, you can create 'dynamic' macros or, in other words, macros that change other macros. As an extension to these techniques, you can also put the ASCII form of the macro commands in a variable and use the Run Macro in Variable command to run it. The reason we use the Run Macro in Variable command in this case is because the Scripting Editor does not allow us to dynamically change the macro command on the fly. The ASCII representation of the macro command Variable Set String %T10% "%T99%" looks like this: <TVAR2:10:01:%T99%\s> This command will copy the content of the variable T99 to the variable T10. The :10: portion of the command represents T10. The command looks like this in the Scripting Editor: Variable Set String %T10% "%T99%" We can use :%N1%: in place of the :10: to put the content of T99 into different variables. The Macro Express Player understands this syntax and will run it properly. <TVAR2:%N1%:01:%T99%\s> But, the Macro Express Scripting Editor does not allow us to enter it this way. You could enter this command into the Direct Editor but if you view this macro command in the Scripting Editor it will be converted to this: Variable Set String %T256% Text Type: :%T99%> and it will no longer run properly. So, to get around the syntax checking within Macro Express, we place the macro command in a variable and then 'run' it. There is one more thing that should be explained. There is a character that we call the 'separator character'. On our computers it looks like an upper case L that has the vertical portion cut off. This character is difficult to type using a text editor such as notepad. The separator character is used by some macro commands to indicate the end of a string or the end of the macro command itself. When using the Run Macro in Variable command, the separator character can be represented by \s. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 15, 2005 Author Report Share Posted August 15, 2005 Sorry... I am just trying to understand the overall scope... I appreciate all your help. A couple of follow up questions: So, more or less, after each %T%N1%% command (or should I say: <TVAR2:10:01:%T99%\s>) I need to run the "Run Macro in Variable" command so ME understands what I just did. Is this correct? In my program, I will need to create multiple %T%N1%% variables. I am assuming that I will need to run the "Run Macro in Variable" after EACH set modify variable command. Is this correct? If so, am I limited to having to text type that immediately after each time I Rum Macro in Variable, or can I set all my variables (with run macro in variable after each) and, after all is set, do the text type afterwards. In this, I will run: Repeat Until %N1% = 0 Text Type: %T%N1%% Text Type: <TAB> Variable Modify Integer: %N1% = %N1% - 1 Repeat End <REP3:08:000001:000002:0001:0:01:0><TEXTTYPE:%T%N1%%><TEXTTYPE:<TAB>><NMVAR:02:01:1:0000001:2:0000001><ENDREP> Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 15, 2005 Author Report Share Posted August 15, 2005 Also, If %N1% = 10 And I set %T%N1%% Do I no longer have use of %T10% other than what I just set? Or can I use both %T10% and %T%N1%%? I am thinking I do not... but I just want to check... not sure how ME actual saves this to memory. Quote Link to comment Share on other sites More sharing options...
kevin Posted August 15, 2005 Report Share Posted August 15, 2005 So, more or less, after each %T%N1%% command (or should I say: <TVAR2:10:01:%T99%\s>) I need to run the "Run Macro in Variable" command so ME understands what I just did. Is this correct?Umm, I'm not sure how to answer. This depends on how your macro is written. I may be the one misunderstanding the issue here. If so, I apologize. But, to understand this you may want to study how the Variable Evaluation Level macros work. In my program, I will need to create multiple %T%N1%% variables. I am assuming that I will need to run the "Run Macro in Variable" after EACH set modify variable command. Is this correct?The macro does NOT create new variables with names like %T%N1%%. The variables are T1 through T99. When you put a number in %N1% that is between 1 and 99 then you can use the technique. If N1 = 11 then %T%N1%% accesses T11. If N1 = 12 then %T%N1%% accesses T12, etc. Note, errors will occur if N1 is 100 or greater. Errors may occur if N1 is between 1 and 9 because <TVAR2:%N1%:01:%T99%\s> expects two digits. You may get around this by putting 1 through 9 in another string variable and prepending a '0' so it is 01 through 09. Do I no longer have use of %T10% other than what I just set? Or can I use both %T10% and %T%N1%%? I am thinking I do not... but I just want to check... not sure how ME actual saves this to memory.Again, if N1 = 10 then %T%N1%% refers to %T10%. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 15, 2005 Author Report Share Posted August 15, 2005 Ok, I have read all the articles, looked at the examples.. etc. I have actually been reading them, rereading them, and trying to hammer it into my head since last thursday. Maybe I am just to dense... but I am having a little bit of a hard time understanding. So, here is what I am trying to do. I am copying pages from a screen to a clipboard. I copy one page, set that to T29, then modify-amend that to T30. This will be copying between 3-7 pages. So that in the end of this part... all 7 pages will be in T30. What I need to do is set that to %T%N50%% where N50 starts off at a value of 50. After this, I will increment N50 + 1, and go to the next month's pages and copy all of them too. I could do this up to 36 times (months)... depending. Basically n50 will equal 50 to 86. After all of these are copied, I will be going to a spreadsheet where I will need to access these. In actuality, I need to copy %T%N50%% to %T30 again, starting with N50 back at a value of 50. And use the first page (T50) to do some data output. Then, increment N50 again, send that to T30, and do the data output again. (again, up to 36 times). I can figure out how to set the variables... but am having difficulty on how to retreive them... and where to put my "Run macro in variable" command. Thanks Quote Link to comment Share on other sites More sharing options...
randallc Posted August 15, 2005 Report Share Posted August 15, 2005 Hi, Perhaps you see why I prefer to use named variables [Environment variables]. You don't need to use Run Macro in string. You can name them how you like, like an "array". They do NOT replace your other strings (named string "StringT(10)" does not affect %T10%) <REM2:Repeat for T50-T85; but use named variables; ? - [stringT(%N1%)]><REP3:01:000050:000001:00036:1:01:><REM2:set T30, however that may be, for each variable in the loop><TVAR2:30:01:hi><REM2:set T30, however that may be, for each variable in the loop; name tham;Variable Modify String: Save %T30% to Environment Variable [stringT(%N1%)]><TMVAR2:19:30:00:000:000:StringT(%N1%)><ENDREP><REP3:01:000050:000001:00036:1:01:><REM2:set T30; ;Variable Set string %T30% from Environment Variable [stringT(%N1%)]><TVAR2:30:11:StringT(%N1%)><REM2:Here do what you need with T30; "UPPERCASE" just as example; you would be pasting?><TMVAR2:12:30:00:000:000:><ENDREP> // Repeat for T50-T85; but use named variables; ? - [stringT(%N1%)]Repeat Start (Repeat 36 times) // set T30, however that may be, for each variable in the loop Variable Set String %T30% "hi" // set T30, however that may be, for each variable in the loop; name tham;Variable Modify String: Save %T30% to Environment Variable [stringT(%N1%)] Variable Modify String: Save %T30% to Environment Variable Repeat End Repeat Start (Repeat 36 times) // set T30; ;Variable Set string %T30% from Environment Variable [stringT(%N1%)] Variable Set String %T30% from Environment Variable // Here do what you need with T30; "UPPERCASE" just as example; you would be pasting? Variable Modify String: Uppercase %T30% Repeat End Best, Randall Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 15, 2005 Author Report Share Posted August 15, 2005 Randall, That is awesome. I read your first post, but didn't quite understand it. Lovely if it works... I am going to work on this and see how it will run. My guess is (knowing you) it should be perfect. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 16, 2005 Author Report Share Posted August 16, 2005 Randall, Now, I had your suggestions running perfectly in a test macro... but now that I am trying to do it in a real live functioning macro... it isn't working. See below code. When I run it in my window, it copies and gets put into T30... that part I verified is working. I send that to the enviroment variable "Tax(%N50%)... then when I call the enviroment variable, it just types in "Tax(50)". I am not sure what I am doing wrong... <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:><TMVAR2:19:30:00:000:000:Tax{%N50%}><TBOX4:T:1:CenterCenter000278000200:000:TestTax{%N50%}><WAITKEY2:000010:000000:48> Repeat Until %T1% <> %T1% Text Type: <CTRLD>a<CTRLU> Clipboard Copy Variable Set String %T31% from Clipboard Variable Modify String: Append %T31% to %T30% If Clipboard Contains "FEDERAL UNIVERSAL" Break Else If Variable %N40% > 10 Break Else Variable Modify Integer: %N40% = %N40% + 1 Text Type: <F11> Capture Control to %C1% Repeat Until %T25% Contains "Logged in" Variable Get Control Text: %C1% to %T25% If Variable %T25% contains "Logged in" Break End If Repeat End End If End If Repeat End Variable Modify String: Strip CR/LF from %T30% Variable Modify String: Save %T30% to Environment Variable Text Box Display: Test Wait for Key Press: ESC Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 16, 2005 Author Report Share Posted August 16, 2005 I think I figured it out... Set String to Env rather than Modify String. I will try that. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 16, 2005 Author Report Share Posted August 16, 2005 Nope... that was completely wrong. Anyone have any ideas per my code above? Quote Link to comment Share on other sites More sharing options...
randallc Posted August 16, 2005 Report Share Posted August 16, 2005 Hi, It is pssibly working; your display does nothing; try this; [Envionment vars with indices must be re-named or put into a string to display, as I don't think you can use double "%%%%"] for them; "Tax{%N50%}" will give Tax{1} or whatever; "%Tax{%N50%}%" won't work?; but the macro may still be working OK? <REM2:display Tax[N50]><TMVAR2:19:30:00:000:000:Tax_Env_Var_Display><TVAR2:99:11:Tax{%N50%}><TBOX4:T:1:CenterCenter000278000200:000:TestT99=%T99% ===================== Tax_Env_Var_Display=%Tax_Env_Var_Display%><REM2:End display Tax[N50]> // display Tax[N50]Variable Modify String: Save %T30% to Environment Variable Variable Set String %T99% from Environment Variable Text Box Display: Test // End display Tax[N50] best, RandallEDIT; I am not really sure of your question; do you know you have T30 set, or could there be a problem with your "waiting for windows" etc and NOT actually caturing anything from your controls etc?; I have really just commented on your use of env variable in display, which may be only another, lesser issue! Display your "T30" to check if it is set; Do you know the env var is not receiving the data? Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 17, 2005 Author Report Share Posted August 17, 2005 Randall, I wonder... Is there a limit to how many characters (bytes) can be set to an enviroment variable? Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 17, 2005 Author Report Share Posted August 17, 2005 That's got to be it. There must be some sort of character limit. I cut out the portion of code I am working on and put it into another blank macro. I modified as below: Text Type: <CTRLD>a<CTRLU> Clipboard Copy Variable Set String %T30% from Clipboard Variable Modify String: Save %T30% to Environment Variable Variable Set String %T30% "None" Variable Set String %T30% from Environment Variable Text Box Display: Test <TEXTTYPE:<CTRLD>a<CTRLU>><CLIPC><TVAR2:30:03:><TMVAR2:19:30:00:000:000:Tax(%N50%)><TVAR2:30:01:None><TVAR2:30:11:Tax(%N50%)><TBOX4:T:1:CenterCenter000278000200:000:Test%T30%> Now, I used a large text file... and ran it on there. The text box would not display anything. When I cut that text file down to all but 2 words... it worked perfectly. Hmm... or maybe it is an issue with the text box display? Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 17, 2005 Author Report Share Posted August 17, 2005 Ok, I have been able to determine that the Enviroment variable cannot handle so many characters. It is not the display box... as I changed this to cut from a text pad, set to varaible from clipboard, set to enviroment variable, set string from enviroment variable, and type into the text document. Large amounts of characters causes it to not go to the enviroment variable. When I cut down the data... it goes through fine. I have been using MS Word to try and determine the character limit... but it seems to change depending on the CRLF's and such. Quote Link to comment Share on other sites More sharing options...
kevin Posted August 17, 2005 Report Share Posted August 17, 2005 I would be surprised to learn that Environment variables allowed any CRLFs. I thought environment variables would only hold letters, numbers and punctuation you can see, not tabs, CR, LF, etc. Quote Link to comment Share on other sites More sharing options...
kevin Posted August 17, 2005 Report Share Posted August 17, 2005 According to Macro Express Explained (page 185), on Windows 95, 98 and Me the default maximum environment space available is 4,096 bytes. On Windows NT, 2000 and XP the maximum spece is 32,768 bytes for each user. These figures are the total space available. Any environment variables defined by your system use up a portion of this space. There is a way to increase the environment space on Windows 95, 98 and Me from the default 4K but I have forgotten the details and would have to do some research to retrain myself. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 17, 2005 Author Report Share Posted August 17, 2005 Kevin, If the 32K is for ALL enviroment variables together, then this will not work for my purposes... Just one varaible set is about 5K. I am using XP. 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. Guess I am back to trying to figure out how to work with %T%N1%%. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 17, 2005 Author Report Share Posted August 17, 2005 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). To make this easier, can someone post an example of the following? %N9% set to 50 Repeat loop twice, clipboard copy a text set text to variable, then set to %T%N9%% modify %N9% + 1 Repeat end %N9% set to 50 Repeat loop twice Set %T10% to equatl %T%N9%% TextType %T10% Modify %N9% + 1 Repeat end If someone can show me how to format the above, I may be able to figure it out. My macro gets kinda complicated with other commands... I am just trying to figure out this portion. All the examples I see are only setting %T%N1%% once... except for the macro example that Kevin's link goes to... haven't been able to figure out how that one works yet... Quote Link to comment Share on other sites More sharing options...
randallc Posted August 17, 2005 Report Share Posted August 17, 2005 Hi David, We all learn.. Sorry about that. I have jst substitued the Run in macro commands for my previous example here; hope that is clear enouh for now; <REM2:Repeat for T50-T85; but use named variables; ? - [stringT(%N1%)]><REP3:01:000050:000001:00036:1:01:><REM2:set T30, however that may be, for each variable in the loop><TVAR2:30:01:hi><REM2:set T30, however that may be, for each variable in the loop; name tham;Variable Modify String: Save %T30% to Environment Variable [stringT(%N1%)]><DIS:<TMVAR2:19:30:00:000:000:StringT(%N1%)><TVAR2:31:01:<TMVAR2:09:%N1%:30:000:000:>><RUNMACVAR:31><ENDREP><REP3:01:000050:000001:00036:1:01:><REM2:set T30; ;Variable Set string %T30% from Environment Variable [stringT(%N1%)]><DIS:<TVAR2:30:11:StringT(%N1%)><TVAR2:31:01:<TMVAR2:09:30:%N1%:000:000:>><RUNMACVAR:31><REM2:Here do what you need with T30; "UPPERCASE" just as example; you would be pasting?><TMVAR2:12:30:00:000:000:><ENDREP><MRETURN> // Repeat for T50-T85; but use named variables; ? - [stringT(%N1%)]Repeat Start (Repeat 36 times) // set T30, however that may be, for each variable in the loop Variable Set String %T30% "hi" // set T30, however that may be, for each variable in the loop; name tham;Variable Modify String: Save %T30% to Environment Variable [stringT(%N1%)] Variable Modify String: Save %T30% to Environment Variable Variable Set String %T31% "<TMVAR2:09:%N1%:30:000:000:>" Run Macro in Variable %T31% Repeat End Repeat Start (Repeat 36 times) // set T30; ;Variable Set string %T30% from Environment Variable [stringT(%N1%)] Variable Set String %T30% from Environment Variable Variable Set String %T31% "<TMVAR2:09:30:%N1%:000:000:>" Run Macro in Variable %T31% // Here do what you need with T30; "UPPERCASE" just as example; you would be pasting? Variable Modify String: Uppercase %T30% Repeat End Macro Return best, Randall Quote Link to comment Share on other sites More sharing options...
randallc Posted August 17, 2005 Report Share Posted August 17, 2005 Again, <REM2:Repeat for T50-T51><REP3:01:000050:000001:00002:1:09:><TVAR2:10:01:hi><TVAR2:31:01:<TMVAR2:09:%N9%:10:000:000:>><RUNMACVAR:31><ENDREP><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:CenterCenter000278000200:000:T10%T10%><ENDREP> // Repeat for T50-T51Repeat Start (Repeat 2 times) Variable Set String %T10% "hi" Variable Set String %T31% "<TMVAR2:09:%N9%:10:000:000:>" Run Macro in Variable %T31% Repeat End // 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: T10 Repeat End Randall Quote Link to comment Share on other sites More sharing options...
cyberchief Posted August 17, 2005 Author Report Share Posted August 17, 2005 Randall, In your textbox message... you are calling %T10%... not the %T%N9%% variable.... since you haven't changed %T10%... it will always say "Hi". When changing the textbox to say %T31%... it produces "<TMVAR2:09:10:50:000:000:>" not "Hi". hmm.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.