rberq
-
Posts
1,203 -
Joined
-
Last visited
-
Days Won
61
Content Type
Profiles
Forums
Events
Posts posted by rberq
-
-
I would replace the Macro Run commands by copy/pasting the body of the run macros into the calling macro. I only use Macro Run for building and testing. If you still want the shortkey activation availabe, don't delete the original macros.
Gaaaaccckkkk!!!
-
If the problem is passing information among the macros, and variables aren't quite working, here are a couple possibilities:
(1) Create registry key(s), write the data into the keys, read it back in other macros, delete the registry key when done.
(2) Maybe simpler: create a temporary text file, write data into it, read back in other macros, delete when done (actually, delete only when you need to rewrite it with new data -- who cares if an itty-bitty file stays there in a temp folder?). Using files sounds slow and inefficient, but it is plenty fast enough if your macros are assisting a manual process. You won't even have time to blink while the file is written/read.
-
"Run Macro in Variable" looks like a good way to initiate the called macro. Sorry, I only have ME3 installed so I can't check, but does that command have a wait-for-completion option?
If not, you could use a global variable to signal completion:
(1) Main macro sets DoneProcessing variable to zero, then initiates called macro.
(2) Main macro loops (Repeat loop) checking DoneProcessing variable for value of one rather than zero.
(3) Called macro does its thing, sets DoneProcessing to value one, exits.
(4) Main macro sees DoneProcessing value of one, exits from Repeat loop and continues processing.
Obviously, you can name your global variable anything you want -- DoneProcessing is not a keyword within Macro Express as far as I know.
If you use this technique, be sure to put a brief delay within the Repeat loop so it doesn't hog all the processor time -- one-tenth second (100ms) usually works well. Also put some error logic within the Repeat loop -- for example, if it doesn't see the DoneProcessing value within 5 seconds (50 repeats with 100ms delays), then display an abort message and halt the main macro. This allows for a called macro that fails or "forgets" to set the DoneProcessing value.
-
Often when you want to allow for uncertain delays, you can pick a spot on the screen that you KNOW will change when the desired action completes. Use a repeat loop (with MANY repeats) to check for change of pixel color at that spot, then exit from the loop when it changes. Include a 100ms delay within the loop, which pretty much takes care of different speed computers. For example, repeat 1000 times with 100ms delay allows a (nominal) 100 seconds for the action to complete, but the macro will continue immediately when it does complete, be it one tenth of a second or the full 100 seconds. Of course if the 100 seconds elapses and the action still has not finished, you are SOL, so you have to program for that and display a text box error message and abort the macro.
But for this situation Cory's method is better. Play with substrings a little and you may find it's easier than you think.
-
If you really have only 100 files, and this is a one-time thing, then don't bother coding the macro to progress through all 100 files. Alan's model macro already arrows down in Windows Explorer to highlight the next file, so just set up a hot key to start the macro again manually. It won't take much extra time to hit the key 100 times, and it will save you significant coding effort.
In fact, I would be tempted to break Alan's code up into two separate macros: first (hotkey) macro to do the find and paste -- then you eyeball it to make sure it has really done what you want -- then second (hotkey) macro to save the modified file and arrow down to the next file in Explorer. I say this because, whereever you build in time delays, there is the possibility of Windows screwing things up with an unusually long response time. Better you should do a quick visual check on each file before saving it, so if something has gone wrong you can cancel out without saving and start over with that file. If you were doing 10,000 files, no, but with only 100 play it safe.
- 1
-
It is funny however because I've been criticized for being too wordy.
That's easily remedied:
It is fny hwevr bcus I've bn crtcizd fr bng too wrdy.
-
I give the answer he seeks in 4 minutes and SteveK gets "best answer"? Not even a thanks? Pfft.
No good act goes unpunished. -
Once Anagram.txt is saved, read it and write Anagram_2.txt.
Delete lines by NOT writing them to Anagram_2.txt.
When Anagram_2.txt is complete, display it by calling Notepad with Anagram_2.txt as the parameter.
Not fancy or especially elegant, but simple and should be plenty fast enough so your son won't fall asleep.
-
Look at the Launch and Activate command under Windows/Programs. You can launch a program and pass it parameters. Then maybe have your macro wait in a Delay command or a Repeat loop (with delays built in) until the launched program finishes -- either wait a specified time interval or for the program to create a file or Registry entry containing its results, or something of the sort. Then retrieve the results of the launched program and continue processing.
-
It is kind of a hidden feature -- not really hidden, just hard to find.
Variable Set String command with the "Prompt for value" option.
-
I start ME with a desktop shortcut rather than have it start automatically at boot. One property that can be set for the shortcut is "Run as administrator".
I run Windows 7 and ME 3 -- so not quite the same as what you are asking, but maybe it will help.
-
Why can't there be ...
There COULD be any number of features. But how complex do we need ME to be, simply to handle situations that don't commonly occur? I'm thankful it does all that it does, and you can program around these oddball situations.
-
ME version 3 does not like the quotes around the path and program name, but is happy with embedded spaces in the path and program.
So, try C:\Program Files (x86)\MyLifeOrganized.net\MLO\mlo.exe (no quotes) for program/path name, and the rest of your options (with quotes) as program parameters.
-
I think you will have to do as Samrae says, use Pause to kill the running macro. Suggestions others have made, to have the macro kill itself based on a registry or file or variable flag, are fine and are suitable for many situations. But if your macro has called on File Explorer to do something, and Explorer does not return control to the macro, then the macro can't kill itself because it is not in control.
-
Dear rberq you mean a macro which starts other macros? Thats an option but then i need extra macros which i don´t like. First of all let´s understand how MEX determine which macros are run if more than one matches the scope criterias.
You may not LIKE having extra macros, but based on your testing that's what you will need in this case. Personally, I DO like having extra macros if that provides the level of control needed. Even if multiple macros would run based on program and window focus, could you be sure which one would run first?
Just accept that you need an extra macro, and don't keep beating your head against the wall.
-
Could you have a small controlling macro that runs for the FIREFOX program and makes all the decisions? The controlling macro would check window title, run one or more other macros in the appropriate sequence, then exit. The other macros would not need to be program or window specific, and would not need to check window title, because all that would be done by the small controlling macro.
-
How do you do the straight lines? I'm guessing you use the straight-line feature of the art program -- you have ME position the mouse to the beginning point, press and hold the mouse button, move the mouse to the end point of the line, and release the button -- or something akin to that technique. The hard part of that would be translating your x-y coordinates to pixel locations so ME can move the mouse properly.
Same thing should be possible with the free hand drawing feature of the art program. As Alan says, have ME calculate the x-y coordinates of successive points on the curve, translate those to pixel locations, and move the mouse from pixel to pixel. Easier said than done, but I don't know how else you would do it except to feed appropriate parameters to the art program for whatever standard shapes the program supports.
-
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.
-
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.
-
I see what you mean -- Macro Express seems to be deactivated in the Remote Assistance screen. Mouse Locator doesn't even recognize where the mouse is when it's over the RA window.
If you type into Google "batch command to initiate windows remote assistance" there are some command-line options that can be used to start Remote Assistance. Options differ depending on the version of Windows being used. If you can build a batch file on your Mom's computer that works for RA, then you could set up a hot key for her to run a macro, and the macro would run the batch file.
-
When I put that syntax into a batch file it works fine when ME is already running.
If ME is not already running when the batch file runs, ME starts up and then the macro runs.
If I use an non-existing macro name, ME starts up but no macro runs.
If wonder if you might have a path problem, where ME can't find the macro file? My macro file is in the same folder as all the ME executables.
I hope that helps ... maybe a clue there.
-
Change the OR to AND. You will be not unhappy.
-
Here's an idea. Have your macro do all the evaluation of what is to be moved and where, but don't have the macro actually do the move. Instead, have it write DOS "move" commands to a text file. After you review the text file for accuracy, rename it as a .BAT file and run it.
-
[Additional] Macro 3 runs at ME startup, stores date and time in an environment variable.
Macro 2 runs on hot-key, does its thing, then stores date and time in [the same] environment variable.
Macro 1 runs every 1 minute or 5 minutes or whatever, depending how precise you want the 90 minute alert interval to be. When it runs, Macro 1 checks current date and time against the stored value. If 90 minutes have passed, sound the alarm and store a high future date and time in the environment variable. If ninety minutes have not passed, just exit from Macro 1 with no further action.
Time out a Pixel Color search
in Macro Express and Macro Express Pro
Posted
I generally write a repeat loop with a short delay within the loop. Delay time multiplied by number of repeats equals the (nominal) total time to wait, but if the expected color appears the wait is ended immediately. Here's a wait of zero to ten seconds.
REPEAT START 100 TIMES
GET PIXEL COLOR AT n1,n2 INTO n3
IF n3 = 1234567
REPEAT EXIT
ELSE
DELAY100ms (one tenth of a second)
END IF
REPEAT END
* We may exit from the loop when the color is found, or after the maximum repetitions. Therefore the check below
* figures out whether the color was found or not.
IF n3 NOT = 1234567
TEXT BOX DISPLAY not-found message
MACRO END
END IF
Maybe no "better" than your method, just another way of doing it. I'm not sure what you are asking for -- a way to end the wait early without killing the macro???