Jump to content
Macro Express Forums
Sign in to follow this  
Rick D

Variable Not Being Assigned

Recommended Posts

I have several fields in Excel I am tring to copy and assign to a variable for use in a 3rd party software. The first variable is an Excel generated integer that counts records to assign the number of times to repeat the Macro. (%N99% in the example below.) Then cells are assigned T1-T5 in the actual meat of the macro.

 

If I disable N99 and the repeat line everything works great 1 time. If I put them in, T1 copies in Excel but does not get assigned to the variable T1 (identified by using the debug function in the below example) variables T2-T5 work perfectly. All are text fields.

 

I have tried adding delays of up to 4 seconds in between steps but to no avail. Any ideas?

 

<ACTIVATE2:Microsoft Excel_>

<CTRLD><TEXTTYPE:<HOME>c_><CTRLU>

<DIS:<TVAR2:99:03:>_<DIS:<TMVAR2:05:99:99:000:000:>_

<TEXTTYPE:<ENTER><ENTER><ENTER>_>

<DELAY:1>

<DIS:<REM2:Loop Through Each Row and enter into Meditech_>_

<REP3:02:Center:Center:0001:0:00:>

<REM2:Copy Mnemonic from Excel_>

<CTRLD><TEXTTYPE:c_><CTRLU>

<TVAR2:01:03:>

<TEXTTYPE:<TAB><TAB><TAB>_>

<REM2:Copy Setup Time from Excel _>

<CTRLD><TEXTTYPE:c_><CTRLU>

<TVAR2:02:03:>

<TEXTTYPE:<TAB>_>

<REM2:Copy Cleanup Time from Excel _>

<CTRLD><TEXTTYPE:c_><CTRLU>

<TVAR2:03:03:>

<TEXTTYPE:<TAB>_>

<REM2:Copy Duration from Excel _>

<CTRLD><TEXTTYPE:c_><CTRLU>

<TVAR2:04:03:>

<TEXTTYPE:<TAB>_>

<REM2:Copy Total from Excel _>

<CTRLD><TEXTTYPE:c_><CTRLU>

<TVAR2:05:03:>

<TEXTTYPE:<ENTER><ENTER>_>

<REM2:Debug - Show Variables from Excel_>

<TBOX4:T:1:CenterCenter000278000200:000:Variables From Excel_

T1 = %T1%

T2 = %T2%

T3 = %T3%

T4 = %T4%

T5 = %T5%

Share this post


Link to post
Share on other sites

Hi,

I'd love to see and understand the problem;

Can you try to select the whole script, then in the text box of the reply (like this) press "quote" button, paste the script, then "quote" again for end quote; I can then copy it to my script editor and examine.

Best, Randall

Share this post


Link to post
Share on other sites

Here is the complete Macro.

 

<ACTIVATE2:Microsoft Excel><CTRLD><TEXTTYPE:<HOME>c><CTRLU><DIS:<TVAR2:99:03:><DIS:<TMVAR2:05:99:99:000:000:><TEXTTYPE:<ENTER><ENTER><ENTER>><DELAY:1><REM2:Loop Through Each Row and enter into Meditech><REP3:02:Center:Center:0001:0:00:><REM2:Copy Mnemonic from Excel><CTRLD><TEXTTYPE:c><CTRLU><TVAR2:01:03:><TEXTTYPE:<TAB><TAB><TAB>><REM2:Copy Setup Time from Excel ><CTRLD><TEXTTYPE:c><CTRLU><TVAR2:02:03:><TEXTTYPE:<TAB>><REM2:Copy Cleanup Time from Excel ><CTRLD><TEXTTYPE:c><CTRLU><TVAR2:03:03:><TEXTTYPE:<TAB>><REM2:Copy Duration from Excel ><CTRLD><TEXTTYPE:c><CTRLU><TVAR2:04:03:><TEXTTYPE:<TAB>><REM2:Copy Total from Excel ><CTRLD><TEXTTYPE:c><CTRLU><TVAR2:05:03:><TEXTTYPE:<ENTER><ENTER>><DIS:<REM2:Debug - Show Variables from Excel><DIS:<TBOX4:T:1:CenterCenter000278000200:000:Variables From ExcelT1 = %T1%

T2 = %T2%

T3 = %T3%

T4 = %T4%

T5 = %T5%><REM2:Activate Meditech "Gemms" Window><ACTIVATE2:GAA GEORGIA MARKET HCIS><DELAY:2><TEXTTYPE:%T1%<ENTER><ENTER><ENTER><ENTER><ENTER><ENTER><F8><ENTER><F10>%T2%<F10>%T3%<F10>%T4%<F10>%T5%><TEXTTYPE:<F12>><DELAY:1><TEXTTYPE:<BACKSPACE>F<ENTER>><DELAY:2><ACTIVATE2:Microsoft Excel><CLEARVAR1:T:ALL><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:Macro Complete%N1% Records Processed.>

Share this post


Link to post
Share on other sites

Hi,

I can reproduce the problem and appear to fix T1 if I put the delay 1 sec(? needs only 200msec or less) after "control-c". Copying to the clipboard often needs a delay unexpectedly (use "Clipboard Copy instead? - but may still need a delay) Watch it by inserting "Text box Display" after your first "control-c" and control up and T1 from clipboard.

Best, Randall

Share this post


Link to post
Share on other sites

Thanks,

The 200msec works great. I have longer up to 5 sec delays because the 3rd party program is over a network that from time to time has serious speed issues.

Share this post


Link to post
Share on other sites

Rick,

 

I have had the same issues with proprietary programs over a network... I hated the 5 second thing when it could be anywhere from a fraction of a second to 10-20 seconds. You may want to look into the "Get Control"/"Capture Control" along with the "Wait for Control" delay. Worked wonders for me.

Share this post


Link to post
Share on other sites

It seems to me that the network speed would have nothing to do with the clipboard. Windows takes a lot of time to process the clipboard. Here is an excerpt from the Macro Express Explained book that may shed some light on the subject.

 

Global Clipboard Delay

 

This is not a command, but rather a system-wide preference. Windows needs extra time to process the clipboard. So, Macro Express added a global delay that it applies after every Clipboard command, and can be found in the Delays section of the Preferences dialog. (Options | Preferences | Delays).

 

There is no wait-for-clipboard-to-finish command. With all the other Wait For commands that Macro Express has, I am sure if it were possible, we would have it, instead of a global delay. Without this delay, Macro Express would continue processing commands while Windows is still playing with the clipboard, causing your macro possibly to misfire. All preferences are global in scope, which means that any setting here will affect the Clipboard commands in each macro that uses them. The default is a 250 millisecond (1/4-second) delay after each command. I found it to be a perfect setting on my system. But, because no two systems are the same, you will want to experiment to find the best setting for yours.

Share this post


Link to post
Share on other sites

The problem is two fold. The proprietary program is a graphically enhanced DOS program that appears to open windows for commands (Menu numbers) to be entered. Problem is they are not true windows so you can't just wait on the titled window.

 

Secondly with number of users varying from 100s to 10,000s speed on the network can vary drastically.

 

We have played with all the various wait, delay and pause options and found that if we don't just delay the macro for several seconds data is posted in the wrong place (while waiting for the simulated window to appear) and causes the program to error out because the pasted data is not acceptable in the field it was pasted to.

 

ME has greatly sped up the data entry process but because the 3rd party program and network have issues, it still takes hours to run a few thousand records due to the delay at each step. Currently one record takes about 45 seconds to process.

Share this post


Link to post
Share on other sites

Rick,

 

Again, the program I interact with is also an old DOS program... in something similar to a "window"... but the title bar never changes. Does this program have anything like a status bar at the bottom? Perhaps with dialog showing "waiting" or "done"?

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...