Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,532
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. Normally I would move and rename as two different operations, but it's convenient to be able to do both at once. The people at Insight Software are responsive to user needs, so why not request a simple rename feature? Agreed the Macro Express way is inconvenient if all one wants to do is rename a single file. But the idea behind writing macros is that you set it up once, and then invoke the macro dozens or hundreds or thousands of time. A small pain for a big gain.
  2. I've been using Macro Express since around 1998, and never before noticed that button!
  3. The panel that contains those keystrokes might have shrunk. To restore the panel, drag the vertical border above the row of function keys upwards: PS: You don't need to choose the keystrokes from a list. You can type them. Here are a few examples: <SHIFT> <HOME> <ARROW RIGHT> <DELETE> <ENTER> <CTRLD> <CTRLU> <CONTROL>
  4. Let me state unequivocally that Macro Express is a totally inappropriate tool for creating games! Nevertheless, as I tinkered with my simplified Wordle, I realized it was possible to get further than I imagined possible. My Wordle is clunky and sometimes fails in interesting ways. But mostly it works. My Wordle is stripped-down compared to the original. For example, mine doesn't track scores or report statistics. Perhaps the most conspicuous difference is that my version does not display a list of letters a player has already tried. The user interface of my game doesn't look anything like the original. In fact, my Wordle looks exactly like a Microsoft Word document — and that's because it runs inside a Word document. And for that reason, I refer to my version as "Word-le!" Word acts as a "container" for the game. A player types a guess into a Word document, and then presses Enter. Pressing Enter triggers another macro that analyzes the guess and uses Word's highlighting tool to "paint" each letter. Perfect matches are painted green, partial matches are painted yellow, and non-matched letters are painted grey. To colour a letter, the script begins by outputting Shift + Right Arrow. This hotkey selects one character to the right. Then, the script outputs key sequences to interact the "Text Highlight Color" palette on Word's ribbon. For example, the key sequence to activate the green highlighter is this: When I posted this challenge last week, Word-le was barely working. And it was greatly simplified. The macro did not verify whether guesses were actual words, and there was only one answer. The current version picks a random answer from a list of 2300 common words, and accepts any guess from a list of 13,000 common and uncommon words. For example, "aargh" is a legitimate guess, but is never an answer. I found the two lists on the web. My first sort-of-working version consisted of about 50 lines of Macro Express code. Over the past week, I've refined the script. The current version consists of about 120 lines of code spread over two scripts. If you want to try Word-le, upload and import the "Word-le.mex" file. It contains two scripts, "Wordle Launcher" and "Wordle Engine." Then… 1. Open a new Word document. 2. Press Ctrl + Alt + Z to start "Wordle Launcher." (Feel free to change the hotkey!) 3. A splash screen appears. Press Enter to start the game. 4. "Wordle Launcher" enables the "Wordle Engine" macro which temporarily changes the behaviour of the Enter key. While Word-le is running, Enter is the hotkey activation for the "Wordle Engine" macro. 5. Type your first guess, and press Enter. "Wordle Engine" analyzes the word. Based on the analysis, the script "paints" letters green (exact match), yellow (inexact match), or grey (not a match). 6. You have six tries to guess the answer. If you succeed, the game is over. "Wordle Engine" is disabled, and this restores the Enter key to normal. 7. Ditto when you don't guess the answer within six tries. 8. While playing Word-le, you can exit at any time by typing a question mark in the Word document and pressing Enter. 9. To play again, press the Ctrl + Alt + Z hotkey. Here's a video of Word-le in action: https://www.youtube.com/watch?v=vKTReEjkKUw Word-le.mex
  5. That cryptic message appears when I run my MEP script within Word. What I'm hoping to do is to trigger VBA scripts for Word via Macro Express.
  6. I use a Word VBA macro for changing the highlight colour to yellow: Sub PaintYellow() Selection.Range.HighlightColorIndex = wdYellow End Sub Is it possible to invoke this code from Macro Express using its "External Script" feature? From MEP Help, I think the solution may be something like this: When I run the Macro Express macro, the text variable %Console% contains this: Not only do I not understand the error message, I don't even know if I'm on the right track!
  7. During the past year, perhaps some of you have developed a need for a daily Wordle fix. I know I have! The "official" version allows you to play once a day: https://www.nytimes.com/games/wordle/index.html However, there are unofficial versions that allow unlimited plays. For example: https://www.wordleunlimited.com/ Here are the rules of Wordle: Players have six attempts to guess a five-letter word. Wordle gives feedback after each guess. If a letter is correct, it shows as a green tile. If a letter is correct but in the wrong position, it shows as a yellow tile. If the letter is incorrect, it shows as a grey tile. The challenge: Create a simplified version of Wordle using Macro Express. There are many parts to Wordle, so don't even think about tackling them all. My version doesn't keep score, doesn't check whether the words I guess are real words, doesn't display a list of already-selected letters, etc. etc. etc. My list of tasks not yet attempted is long. Nevertheless, my version is playable. Sort of. On a good day. Feel free to post partial solutions, or solutions that are on the verge of almost working!
  8. When you refer to "MacroRecorder," do you mean the macro recorder in Macro Express, or something else?
  9. I'm not familiar with the "Try tool" in Macro Express. Do you mean "Test Run," which appears in the "Debug" menu in the Script Editor? No need to run Macro Express scripts from a batch file. In the Script Editor, go to the "Activation" tab, and choose a method for activating your macro. Hotkey activation is probably the most straightforward. Which hotkey? How your keyboard is configured will limit or expand the choices. Safe bets that will work on virtually any keyboard include: Ctrl + 1 Ctrl + 2 etc. I used to recommend using Function keys as Macro Express hotkeys, e.g., F11 and F12. But on "modern" keyboards, the function keys are sometimes not available. They have been mapped as media keys, e.g., Mute, Volume Up, etc.
  10. So, how do you trigger the Macro Express script to open the application and press Ctrl + R? A shortkey? A mouse event? A floating menu?
  11. Curious. Make sure there is only one macro activated by whatever hotkey. If you have two macros activated by the same hotkey, it's hard to predict which macro will be triggered.
  12. When I tried to recreate the problem, I noticed that no files were selected in the right pane when the program launched. So there was nothing to untag. Ctrl + R had nothing to do! So I added a step that selects everything. This macro seems to work, at least as a starting point. You can copy the script below and paste it into the Macro Express Script Editor. (The first four lines show you what the instructions should look like in the Script Editor. It's preferable to copy the last four lines and paste those instead of the first four lines.) You will need to edit the first line of the script. Specify the full path to mp3tag.exe. Activate or Launch: Window "Mp3tag v", Program "MP3TAG.EXE", Parameters "" // Specify the path to mp3tag.exe on your computer! Wait for Window Title: Mp3tag v Text Type (Simulate Keystrokes): <HOME><SHIFT><END> // Go to top of list. Then select from the top to the end of the list Text Type (Simulate Keystrokes): <CONTROL>r <ACTIVATE OR LAUNCH Title="Mp3tag v" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\Users\\Testing\\Mp3tag\\MP3TAG.EXE" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12" _COMMENT="Specify the path to mp3tag.exe on your computer!"/> <WAIT FOR WINDOW TITLE Title="Mp3tag v" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="5"/> <TEXT TYPE Action="0" Text="<HOME><SHIFT><END>" _COMMENT="Go to top of list. Then select from the top to the end of the list"/> <TEXT TYPE Action="0" Text="<CONTROL>r"/>
  13. Considering posting the Macro Express script as it is, along with an explanation of what the script is supposed to do.
  14. If you're talking about the scope of the macro, I suggest deleting the wildcards, and specify a partial match: "Mp3Tag v" (without the quotes) I've struggled with wildcard searches in MEP, so I haven't tried in a long time. However, I find setting the scope to a partial match of the window title is usually good enough.
  15. You may need delays between some steps. Start with 500 ms to one second delays. You probably don't need delays after every step, and not long delays. Many of my scripts won't work without a sprinkling of short (say 100 ms) pauses. Cory's idea of using Windows controls looks viable, but only if you change one of mp3tag's settings: Tools > Options > General > Show current directory in window title UNCHECKED. But controls will probably need to be remade after you upgrade to a new version. The current version number appears in the title bar. Currently it's this: Mp3tag v3.12 But captured controls include information from the window title, so not sure a macro that's based on controls will work after the release of v3.13.
  16. I just downloaded mp3tag and am taking it for a spin. So far, it appears to me that mp3tag doesn't care whether the left pane (Title, Artist, etc.) or the right pane (the list of files) has focus. In either situation pressing Ctrl + R activates the "Remove Tag" command that acts on selected files in the right pane. But I've only been looking at the application for a few minutes. There may be contexts in which the hotkey doesn't work. In those cases, one of these might be more reliable, as it chooses the command from the File menu rather via hotkey: Text Type (Simulate Keystrokes): <F10> // Activate menu bar Text Type (Simulate Keystrokes): f // Choose &File Text Type (Simulate Keystrokes): r // Choose &Remove Tag from the File menu or Text Type (Simulate Keystrokes): <ALT> // Activate menu bar Text Type (Simulate Keystrokes): f // Choose &File Text Type (Simulate Keystrokes): r // Choose &Remove Tag from the File menu You may need to insert short delays between the steps, but probably not.
  17. As a test, create your script up so it does everything up to the point the window becomes active. It sounds like the files you want to act on are already selected, so resist the urge to reach for the mouse. Instead, reach for the keyboard and press Ctrl + R. Does the magic happen? If yes, then no need for your script to move the mouse pointer. If no, then there are two options: find a way to move the mouse pointer to the files, or send keystrokes to give focus to the files. The method Cory suggested, using Windows controls, could prove to be the cleanest way to accomplish what you want to do. But be forewarned that the method works better in some programs than in others, and not at all in some applications. I can get windows controls to work properly about half the time.
  18. I would use the same (or similar) Macro Express instructions that rberq suggests to make the window active. But once the window is active, are you sure the mouse pointer must be positioned over the selected files? What is the next step that you want the macro to perform? Do the selected files have focus when the window becomes active? You mention that the files are pre-selected; and if they are already selected, then they might have focus. And if they have focus, there may be no need to move the mouse pointer to the files. If the files are already focused, you can copy them using the Macro Express copy command or outputting "text type" Ctrl + C. Or delete the files by using the "text type" command to output the Delete key. Or right-click the files by using "text type" to output the "Application" key or Shift + F10.
  19. This should work as long as there is no text in the field. It handles non-integers. The script selects the entire field and copies it to the clipboard before adding the two values. Text Type (Simulate Keystrokes): <HOME><SHIFT><END> // Select the entire field Clipboard Copy Variable Set Decimal %ClipDecimal% from the clipboard contents // Assign variable %ClipDecimal% to the clipboard Variable Modify Decimal: %SumDecimal% = %ClipDecimal% + 20 Text Type (Simulate Keystrokes): %SumDecimal%
  20. I've had limited success interacting with Adobe Reader by setting Scope to Window Specific, partial match: - Adobe Acrobat Reader DC (64-bit)
  21. On the contrary, tabbing is a super reliable way to navigate. The method usually eliminates the need to know, predict, or figure out the coordinates of individual fields; and when text must be copied, the method sometimes eliminates the step of selecting the text (because the act of tabbing automatically selects the entire field). I've written macros that tab through many fields, copying content as each field gets focus. These tabbing macros act fast and rarely fail.
  22. It's challenging (verging on impossible!) to write a macro that is 100% reliable, especially when a macro interacts with web content. If adding a longish delay allows the macro to work nine times out of ten, you're doing good. Increasing the length of the delay may improve reliability, or make no difference. Adding extra code to ensure a target window has focus -- as Cory mentions and rberq illustrates with his pixel monitoring routine -- helps a macro run more quickly and more reliably. But you need to be a bit of a "macro geek" to go to this extra trouble! The need to geek-out to improve script reliability is part-and-parcel of using third-party scripting tools. AutoHotkey, for example, is more powerful than Macro Express. Yet many of my AutoHotkey scripts had to be gussied up to handle the inevitable problems that arise when switching from one window to another, when performing clipboard operations, and so on. Adding delays to a script is the path of least resistance. The approach is effective most, but not all of the time.
  23. That's a big question. There are a lot of focus issues with Windows 10. This might work: Window Activate: Window Title Goes Here! Or maybe something like this. (You'll need to figure out the x,y coordinates): Mouse Move: 100, 200 Relative to Current Window Mouse Left Click
  24. If I'm understanding correctly, when the login page loads, sometimes the user name field has focus, and sometimes it doesn't? When there is no macro in the picture, is this behaviour normal for the page? Adding a two or three second delay after loading the web page might help.
  25. Try changing all of the delays to 500 ms or 1000 ms to see if that improves reliability. If yes, then incrementally decrease the length of the delays.
×
×
  • Create New...