Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can a macro corrupt? Exact same code works in other macro.
#1
I have a macro that all of a sudden (after running it over and over during development of it) just wouldn't "run" my app.
Finally I stripped out everything down to the one line:

run "C:\Program Files\SAP\SAP Business One\SAP Business One.exe" "" "" "" 0 "SAP"

No response, no error.

I pasted the line into a new macro and it worked.

I pasted the rest of the code into the new one and it all worked.

I deleted the old one, renamed the new one and I'm back to working.

Has anyone experienced this?
#2
One possible situation: it is function, and "single instance" is checked in Properties, and it paused for some reason. It often happens to me: I am wondering why the macro stopped working. Then I go to Threads and see that it is running.
#3
Thanks for the reply,
I figured it had something to do with not truly stopping, but I've since deleted it so I I'll never know the property setting though I never adjusted it.
Later
#4
It's actually happening again to the new macro.
I thought the macro wouldn't run but now I'm noticing the error log:

run "C:\Program Files\SAP\SAP Business One\SAP Business One.exe" "" "" "" 0 "SAP"
wait 5
int w1=act(win("SAP Business One" "TMFrameClass"))

"Error (RT) in Start SAP: window not found"

It's as though the run statement thinks the app is open but when it goes to activate 5 sec later, can't be found. I only put the wait in to see if it needed time. It was working fine without the wait when it did work. :?
#5
instead of a "wait 5"
you could do this.
Code:
Copy      Help
0 WC win("SAP Business One" "TMFrameClass")

that way it'll wait forever till the window is created and then continue.
An old blog on QM coding and automation.

The Macro Hook
#6
Try to change run flags. With flags 0 it does not wait for the window. Try 0x800. Also, use something more precise instead of "SAP". Maybe some window with "SAP" in title exists. For example, if macro name includes "SAP", then QM window title also includes "SAP" when the macro is opened.


Forum Jump:


Users browsing this thread: 1 Guest(s)