libtech Posted January 14, 2015 Report Share Posted January 14, 2015 Hi, I need some help with the macro that adds 48 holdings and corresponding item records for different library locations - here I included only the code for 2 locations (algo and bran) When I run the macro it updates only first few locations and then it closes the record...I tried adding delay 300 milliseconds but it didn't help. Thanks in advance Text Type: <ALT>r Delay 300 Milliseconds Text Type: e Delay 300 Milliseconds Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <F8> Delay 300 Milliseconds Text Type: <DELETE> Text Type: <DELETE> Delay 300 Milliseconds Text Type: algo Delay 300 Milliseconds Text Type: <CTRL>b Delay 300 Milliseconds Text Type: <ENTER> Delay 300 Milliseconds // create algo item record Text Type: <ALT>r Delay 300 Milliseconds Text Type: t Delay 300 Milliseconds Text Type: <CTRL>b Delay 300 Milliseconds Text Type: <ENTER> Delay 300 Milliseconds Text Type: <ALT>f Delay 300 Milliseconds Text Type: c Delay 300 Milliseconds Text Type: <ALT>f Delay 300 Milliseconds Text Type: c Delay 300 Milliseconds // create bran holding record Text Type: <ALT>r Delay 300 Milliseconds Text Type: e Delay 300 Milliseconds Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <F8> Delay 300 Milliseconds Text Type: <DELETE> Text Type: <DELETE> Delay 300 Milliseconds Text Type: bran Delay 300 Milliseconds Text Type: <CTRL>b Delay 300 Milliseconds Text Type: <ENTER> Delay 300 Milliseconds // create bran item record Text Type: <ALT>r Delay 300 Milliseconds Text Type: t Delay 300 Milliseconds Text Type: <CTRL>b Delay 300 Milliseconds Text Type: <ENTER> Delay 300 Milliseconds Text Type: <ALT>f Delay 300 Milliseconds Text Type: c Delay 300 Milliseconds Text Type: <ALT>f Delay 300 Milliseconds Text Type: c Delay 300 Milliseconds // create bruc holding record Text Type: <ALT>r Delay 300 Milliseconds Text Type: e Delay 300 Milliseconds Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <TAB> Text Type: <F8> Delay 300 Milliseconds Text Type: <DELETE> Text Type: <DELETE> Delay 300 Milliseconds Text Type: bruc Delay 300 Milliseconds Text Type: <CTRL>b Delay 300 Milliseconds Text Type: <ENTER> Delay 300 Milliseconds Quote Link to comment Share on other sites More sharing options...
mark_miller66 Posted January 14, 2015 Report Share Posted January 14, 2015 Set each of your delays to a variable such as %r% rather than 300milliseconds for each delay. Then set %r% to different values until the routine works. example Delay %r% vs Delay 300 Milliseconds Quote Link to comment Share on other sites More sharing options...
rberq Posted January 14, 2015 Report Share Posted January 14, 2015 I am guessing that the typing done by the macro is getting out of sync with the screens being typed into??? So the macro keeps right on typing, but maybe the next screen is not yet ready??? Situations like that are frustrating to automate with Macro Express, because no matter how many delays you introduce, eventually Windows is busy doing something else and the application doesn't respond fast enough. Or else you have such long delays that it takes forever to run the macro. If that's your problem, you could add some logic to detect when the application screen changes, and don't let the typing continue until the screen change occurs. Generally I find a spot on the current screen that will change color on the subsequent screen. Then write a repeat loop that checks pixel color at that location, and exit from the loop only when pixel color changes. Each pass through the loop should include a 100ms delay (1/10 of a second). *** Done typing into first screen *** Get Pixel Color into variable N1 Repeat 1000 Get Pixel Color into variable N2 If N1 <> N2 then exit from repeat (screen has changed) Endif Delay 100ms Repeat *** *** at this point either screen has changed, or 10 seconds (1000 repeats) have elapsed If N1 = N2 then display text box "Error -- Time elapsed but screen did not change" Macro Return Endif *** Text type into next screen P.S. At beginning of your macro, set a keyboard delay of something like 30ms, so the keystrokes don't occur quite so fast. Quote Link to comment Share on other sites More sharing options...
libtech Posted January 15, 2015 Author Report Share Posted January 15, 2015 Thanks for both replies, I don't know much about writing code - I do it from macro command list rberg could you insert suggested code into my code with if and end loops. Thanks for your help Quote Link to comment Share on other sites More sharing options...
rberq Posted January 16, 2015 Report Share Posted January 16, 2015 rberq could you insert suggested code into my code with if and end loops. Sorry, I would need to have your application screens on my PC along with your macro. 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.