Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,200
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. It is pretty straightforward if you routinely enable / disable one particular macro or set of macros. For example, the snippet below toggles the state of a single macro and briefly displays a text box confirming which action is being taken. If Macro "11_keep_computer_awake" is disabled Text Box Display: Information [enabling] Macro Enable: 11_keep_computer_awake Else Text Box Display: Information [disabling] Macro Disable: 11_keep_computer_awake End If Delay: 3 seconds Macro Return To do this for any macro, highlighted in Macro Explorer, I think I would -- ENTER to open the macro in the Editor, -- use keystrokes to navigate to the Nickname, -- copy Nickname into clipboard, -- save Nickname in a variable, -- close the Editor, and -- use the variable in the Enable and Disable commands. I disable / enable just often enough that the clumsiness irritates me every time I have to do it. Now that you have inspired me perhaps I will finally generalize the snippet above and add it to my toolbox. Or I will adopt your message after you share it.
  2. In your example, you don't know if VAR3 will have a blank space or will be null. I don't know either. Try your prompt in a test macro, then use TEXT BOX to display >>>%VAR3%<<<. If the display shows as >>> <<<, you know it is blank. If the display shows as >>><<< then VAR3 is null. If VAR3 is blank after the prompt, you can use VARIABLE SET STRING to set it null -- just enter nothing in the value field of VARIABLE SET STRING. Next thing to check, in a test macro, is what happens when you say (with VAR3 null) IF CLIPBOARD CONTAINS %VAR3% .... Again, display your result with a text box. IF CLIPBOARD CONTAINS %VAR3% TEXT BOX DISPLAY "Contains null" ELSE TEXT BOX DISPLAY "Does not contain null" Sometimes it is not obvious how Macro Express will work, and if you can't find your situation in the Help section, testing like this is the quickest way to figure it out.
  3. "Alt + d" works reliably in my Firefox -- according to this link, should work in other browsers as well. https://www.computerhope.com/jargon/a/alt-d.htm
  4. Edit: Oops! I see acantor has already replied. Do not define URL1, URL2, URL3 within the macro. Instead, use the Variables tab of the Editor to define (add) text variable URL as an array -- a dozen entries, or however many maximum tabs you may have open. Use an integer variable %indx% as shown in this code sample, to store clipboard into successive entries of the array. There is an option of Repeat Start that you could use to increment the counter (%indx%) each time through the Repeat loop, instead of using Variable Modify Integer to do it. The hard part is getting all the % signs in the right places when referring to elements of the array.😋 Variable Set Integer %indx% to 0 Repeat Start (Repeat %qtyTABS% times) [get the data into the clipboard] Variable Modify Integer %indx%: Increment Variable Set String %URL[%indx%]% from the clipboard contents End Repeat
  5. 1. Open spreadsheet (manually or by macro commands) 2. Save spreadsheet (manually or by macro commands) as a CSV or other file format that can be processed by the ASCII FILE BEGIN PROCESS through ASCII FILE END PROCESS macro commands 3. As the ASCII file process returns individual lines to the macro, do the processing you outlined for each line This is accomplishing the same thing as Cory's elegant technique. His method brings the entire spreadsheet into a variable -- all the lines at once into a single variable -- then uses macro commands to split out individual lines and parse the several columns of each line. My suggested method relies on Excel / Macro Express to parse / store / retrieve the columns, one line at a time, into an array. Cory's method is more fun. Mine is more plodding and perhaps easier to visualize for your specific project.
  6. File path and name contains a space. Do you need double-quotes around the whole thing?
  7. Put the common (repeated) commands into a second macro, and call the second macro from the first with the "Macro Run" command. "Macro One" - Beginning commands set a number of variables... Be sure to "Make these variables available to macros called by this macro" (check box when defining the variables) Macro starts... ACTIVATE Window 111 Macro Run "Macro Two" Activate Window 222 Macro Run "Macro Two" Activate window 333 Macro Run "Macro Two" End of "Macro One" "Macro Two" - command command etc, 68 commands etc End of "Macro Two"
  8. Very true. But as you say, it runs slower using the mouse. You can have the best of both worlds by checking x,y coordinates, AND moving the mouse to those coordinates as a visual aid during debugging. After you have found any script problems, disable the mouse movement command and just leave it in place in case you need it again later.
  9. In the far past I tinkered with software that was supposed to look for pictures within a screen, and tried to call them from Macro Express. I didn't have much luck, but I wasn't too serious about it, either. There may be fancier products available now, that you could use. IF you can look for specific colors, and IF they are distinct from the general colors on the screen, and IF there is a limited number of screen areas where you have to look, then the macro command Get Pixel Color is useful. For example, the code below scans vertically down the page looking for a data-entry field. It works because I know approximately where the field will be, and field's color is different from everything around it. But the method is too slow for scanning an entire screen, and likely will find many false positives outside of a narrow search area. // Find the type-in area by color Variable Set Integer %xc% to 300 Variable Set Integer %yc% to 100 Repeat Start (Repeat 150 times) Get Pixel Color at (%xc%, %yc%) Relative to Screen into %color% If Variable %color% Equals "4343115" Repeat Exit Else Variable Modify Integer: %yc% = %yc% + 8 End If End Repeat If Variable %color% Equals "4343115" Else Macro Return End If Variable Modify Integer: %yc% = %yc% + 15 Mouse Move: %xc%, %yc% Relative to Screen // Move mouse down a little from the top edge of the entry field Mouse Left Double Click
  10. Macro "abc" can do whatever, then run macro "def" (without waiting for "def" to finish), and "abc" ends. In other words, the "IF" logic in your example will NOT exist in macro "abc". Macro "def" issues command "Wait for Key Press", waiting for the Enter key. When Enter is pressed, "def" runs "xyz" (again, without waiting for "xyz" to finish), and "def" ends. So if the user presses Enter, "xyz" will be run by "def". If the user presses f11, "abc" will run because f11 is the hotkey for "abc". Your problem, if the user presses f11, is that macro "def" is still running, waiting for the user to (potentially) press Enter. The easiest way out of this might be to set a short time limit on "Wait for Key Press" and end "def" without running "xyz" if Enter does not happen. Whether a short timer will work depends on the nature of the application you are working with. Otherwise you have to set up some kind of feedback among the macros so that "def" can be ended without running "xyz".
  11. At Macro Express version 3, Variable Save and Variable Restore can allow a group of related macros to work with a single set of variables. Any macro in the group has access to values previously set and/or modified by other macros in the group. BUT -- ME version 3 allowed only one macro to run at one time. With ME versions 4/5/6, where multiple macros can run in parallel, it seems that Saves and Restores could overlap in unintended ways, so changes made by one macro would be undone by another.
  12. I just got stuck on this same issue. Unless “Wait for this macro to terminate before proceeding" is check-marked, the variables will NOT be available to called macros. I suppose this makes sense, because do you want two macros, running in parallel, accessing/modifying the same variable? Actually, you could argue this both ways – it would be a great way to coordinate activity between two parallel macros. Registry entries and Environment Variables can be used to pass data. They are a bit clumsier to use but are not subject to the ME limitation. Personally I stick to Environment Variables because monkeying with the Windows Registry makes me nervous. But Environment Variables belong to Windows, and as far as I know they cannot be created on the fly from within ME (if anyone knows different please tell me). Below are my reminder notes on Environment Variables. I have used this method as far back as ME version 3 to pass tens-of-thousands of bytes among macros. Environment Variables in Macro Express To create and use one, other than the standard Windows variables: 1. Start Macro Express from a batch file, and within the batch file define the variable; this example creates environment variable “env9999” and sets value “abc”. (I think all environment variables are text.) set env9999=abc cd\"C:\Program Files (x86)\Macro Express Pro 6\" "C:\Program Files (x86)\Macro Express Pro 6\MacExp.exe" exit 2. Now the environment variable can be used within ME -- can be given other values with an option of the Variable Modify String command; and the value can be retrieved with Variable Set String. For low frequency macros, when timing is not critical, I sometimes use TXT files to pass data. Delete any previous file if it exists, use Variable Modify String to “append to text file”. Then in the called macro, use Text File Begin Process to read the text file and get the saved value. It’s not an elegant method, but it works, and in practice is fast as the blink of an eye.
  13. Something like this should work. It will be a learning experience to look up all these commands and enter them with the correct options. Actually this is overkill -- you don't have to get ALL the file names to know that the folder is not empty. As soon as one file name is returned from the Repeat with Folder command, you could "Repeat Exit" from the loop and do the typing. // Variable Set Integer %counter% to 0 // initialize counter Repeat with Folder c:\folder_name // return names of all files in folder Variable Modify Integer %counter%: Increment // increment counter for each file name End Repeat // If Variable %counter% Is Greater Than "0" // if folder is not empty Text Type (Simulate Keystrokes): <CTRLD>a<CTRLU> // type ctrl + a Delay: 500 milliseconds // delay 1/2 second Text Type (Simulate Keystrokes): <ENTER> // type ENTER End If //
  14. We will file the patent application in both names.😋
  15. This works for me. Windows 10. Notice "x" between WIND and WINU. I'm sure the delays don't have to be a full one-second -- but maybe more than the 50ms you tried. I don't know if Win 11 is different.... Text Type (Simulate Keystrokes): <WIND>x<WINU> Delay: 1000 milliseconds Text Type (Simulate Keystrokes): u Delay: 1000 milliseconds Text Type (Simulate Keystrokes): s
  16. It could have written in free-verse, then it would be even worse.
  17. I don't understand who is converting the language, so I'm just guessing here -- Can you paste with the mouse??? -- right click on the field, then click "Paste". You would have to work with the Mouse Locator tool to figure out the coordinates for moving the mouse, but if the Outlook screen is consistently the same size and location it can be done.
  18. Try this -- it works for me (Windows 10) Right click taskbar Taskbar Settings Notification area -- Select which icons appear on the taskbar Macro Express Running Macros
  19. IF there is only one period in the name, just before the extension, you can use Variable Modify String to change the substring "." to "_LE.".
  20. ChatGPT was largely trained from online text data, so probably somebody somewhere posted that collaboration theory. I asked it to find heating thermostats with a particular feature, and it gave me three suggestions that were totally wrong -- no better than a Google search, but presented in the confident conversational tone of a used-car salesman. Given the huge quantity of mis-information online, we should not be surprised if it leads us astray.
  21. I had quite a conversation yesterday with ChatGPT about sorting algorithms. It wrote me some VB code for a bubble sort, which would almost have worked. And described several techniques for sorting large datasets, though it was kind of vague on the details. It was apologetic and corrected its answer when I pointed out an error in its description. Today I described to it several symptoms my car was displaying, which I had (finally) diagnosed myself. The problem with ChatGPT was that it addressed each symptom individually, whereas only by considering all three together could you come up with the correct diagnosis. In defense of Chat, I should add that three experienced mechanics all fell into the same trap of not putting 1 + 2 + 3 together.
  22. Surprising. I bet it would do well writing Visual Basic code or SQL queries -- especially SQL which is so structured. Thank goodness I am retired so I won't be losing my job to this phenomenon. Or maybe there will be entire new jobs opening up for those most skillful at framing questions / commands and prompting / refining ChatGPT as you have done. Wasn't that considered a vital skill in the long-ago days when people visited oracles?
  23. Are you are running ME on the local PC? As I understand it, the problem is that the local PC sees only a "picture" of the application screen that physically exists on the Citrix server. Therefore ME macros running locally do not have any "real" fields on the local screen to copy. Is there a possibility of running ME on the Citrix server, probably in addition to running on the local PC? Then on Citrix perhaps ME could extract fields and store them in a file accessible to the local PC via network disk or folder mapping. Or paste the extracted data into an intermediary Notepad application on the server that is visible to the local PC. Or maybe a (simpler} macro on the server could copy the entire screen and paste it into a file accessible to your local PC. Then all the extraction could be done by a local macro, which presumably could type (not paste) into the application screen. Also, aren't there Citrix options that make the clipboard usable between host and client? Or is that what you meant when you said no text copying capabilities? As for OCR, sorry, I have not found anything useful -- it seems that somebody must sell such a product by now. Though ME running on the Citrix server itself might make OCR unnecessary....
  24. That's the purpose of variable %cell% -- to preserve the contents of the Excel cell so the clipboard can be used for something else. The code you have written looks good to me. Perhaps the Excel cell copy is failing for some reason. See screen image below -- try putting a Text Box Display command where the arrow points, to display what is in variable %cell%. This should show you whether the Excel information has been captured or not.
×
×
  • Create New...