Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
load commands from simple txt-file
#1
Can I load/execute several commands from txt-file? File looks like:
lef 23 23
mou 34 343
lef 45 60
lef 435 34
...

Problem is that my macro reads information from one Windows application and performs clicks to another application. It is quite messy when QM macro switches between two applications a hundreds of times. Faster is first to read all the information from one application and save commands to file and then execute this file and target is another application.

Thank you.
#2
Usually we read data, not commands. Read data from app1 and save to a file or variable, then output all data to app2. Do you really need to read commands? Do you create commands at run time? And how?

If you really want to run commands from a file, you can use function RunFileAsMacro.
#3
For example:
I read the color of some pixels from the first application and make some calculations. Then I activate second application and simulate mouse clicks. And then I go back to first application and start again .... and so on and on until the job is done.
#4
And after these calculations macro generates code like

lef 100 100
lef 200 200
...

?

Better save these positions to an array, and then use it with app2:

ARRAY(POINT) a
;here is code to poupulate the array (instead of code to generate the macro code)
...
;then follows code for app2
lef a[0].x a[0].y
lef a[1].x a[1].y
...
#5
Thnx. I thought about the array but... First - there are not only "lef"-s but there are some "rig"-s and "mou"-es depending on the first application and the pattern is not predictable. And these clicks are calculated through different functions that I created - so the sending and getting array index and values between them is very complicated (perhaps I am still newbie). But RunFileAsMacro works...
#6
Yes, sometimes it is better to generate code at run time. I also used this method in some macros, particularly to generate code that runs when you click Test in Find Accessible Object dialog and other similar dialogs. I store the code directly in a macro instead of using file.


Forum Jump:


Users browsing this thread: 1 Guest(s)