Jump to content
Macro Express Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


acantor last won the day on April 11

acantor had the most liked content!

Community Reputation

8 Neutral

About acantor

  • Rank

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location

Recent Profile Visitors

567 profile views
  1. I didn't know that shortcut. Thank you Samrae!
  2. On the right edge of the Script Editor, near the top, there are four small buttons. The top two are "Move command up" and "Move command down." To change the order of commands in the script, select a line (or more) and then click the button to perform the action you want. In addition, the are keyboard shortcuts to move lines up and down: Ctrl + Arrow Up Ctrl + Arrow Down I have a hazy recollection that on a computer I once used, I had to include the Shift key as part of these shortcuts: Shift + Ctrl + Arrow Up Shift + Ctrl + Arrow Down
  3. I use blank comments to separate areas of my Macro Express code. I also use a yellow as a background colour to mark the first line of a new section.
  4. I have had little luck capturing and dealing with Window Controls of web pages. At best, I've been able to use Window Controls to zero in on the top left corner of the window itself, or depending on the browser and its version, the top left corner of the active window (i.e., the area underneath menus and toolbars.) Windows Controls are good to know about because of the possibility of getting programmatic access to an application. But for web pages and web-based apps, you may be forced to use less programmatic approaches, e.g., pixel colour changes, mouse cursor shapes, and so on.
  5. // Ask the user for starting coordinates... Variable Set Integer %x%: Prompt Variable Set Integer %y%: Prompt // Move the mouse pointer to these coordinates... Mouse Move: %x%, %y% Relative to Screen
  6. Even when using Window Controls to jump the mouse cursor, or give focus, to a control that Macro Express can access, you may need to use other, less elegant methods to complete the action. For example, you may need to move the mouse pointer along the control to a specific spot, or navigate to a target via keyboard.
  7. There is no option for wildcard matches, but a partial match should be fine.
  8. For example, in Windows 7, I can navigate to the Address bar with Alt + D, to the "Search" field with Ctrl + E. (Not sure these have changed in Windows 10). Does the command you are trying to activate via the mouse appear on any of File Explorer's menus? If yes, that's a very reliable method. For example, if you are "aiming" for "Tiles" view, you can send a sequence of keystrokes like this: Alt+v //_V_iew menu s //Tile_S_
  9. The best way is probably not by clicking on your target. Try using the File Explorer's built in hotkeys to navigate close to where you want, either Tab or Shift Tab to your target, and then either press Enter or spacebar to activate. (It may be one, the other, or either.) There are a few controls in the File Explorer that use the arrow keys, as well.
  10. During the early 2000s, Microsoft introduced a way to copy information from a message box to the clipboard. For this method to work, the message box must have focus. But nothing needs to be selected. In many (although not all) message boxes, pressing Ctrl + C copies its content to the clipboard as plain text. So the script might look like this. Text Type (Simulate Keystrokes): <CONTROL>c Variable Set String %x% from the clipboard contents If Variable %x% Contains "Hello" MessageBox: Result True Else MessageBox: Result False End If <TEXT TYPE Action="0" Text="<CONTROL>c"/> <VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="Hello" IgnoreCase="FALSE"/> <MESSAGEBOX Caption="Result True" Message="Contains \"Hello\"" Icon="0"/> <ELSE/> <MESSAGEBOX Caption="Result False" Message="Does not contain \"Hello\"" Icon="0"/> <END IF/>
  11. Checking pixels by coordinates does seem to be much faster than checking pixels under the mouse pointer. But it's not always viable. In some applications, the target only gets its colour when the mouse pointer is hovering above the target. One workaround I have tried is to hunt for a pixel colour of the border that surrounds the colour-changing target. Sometimes these borders measure as little as 1 pixel wide.
  12. For the pixel search, consider whether it's feasible to decrease the number of pixels your script checks. For example, instead of testing every pixel, test every 50 or 100 pixels. If the pixel checking routine tests the colour beneath the mouse pointer, make the script run more quickly by rewriting the script to check pixels based on their X-Y coordinates. Something like this: Variable Set Integer %x% to 100 // Initial x coordinate relative to the window Variable Set Integer %y% to 100 // Initial y coordinate relative to the window Repeat Start (Repeat 1000 times) Get Pixel Color at (%x%, %y%) Relative to Current Window into %Colour% Variable Modify Integer %x%: Increment // Increment the x value to check the next pixel to the right End Repeat If it's feasible to check one in every 100 pixels along the horizontal line, substitute this line for the one that increments: Variable Modify Integer: %x% = %x% + 100 // Skip the next 100 pixels
  13. If you're in Windows Explorer, or a similar window, this might work: F2 // begin edit mode Short pause Shift + End // extend the selection from the end of the file name to the end of the extension Ctrl + c // copy to the clipboard
  14. Terry, Your solution is cleaner and more elegant than mine, and I can imagine it might run a bit faster. Thank you for posting! It's interesting, educational, and entertaining to develop one's own string manipulation tools. I was going to write Insight and request they add features like reverse, pre-pend to a string (to complement the already-existing append). But if Insight had added these features in the past, I wouldn't have taken the time to learn how to build them myself!
  15. For a script I am developing, I need to reverse the order of characters. For example, "12345" needs to transform into "54321". Macro Express does not appear to have an instruction for reversing strings, so I wrote a script that does just that. I would be curious to know if there are ways to make a script like this run faster. It's quick for strings consisting of a few dozen or hundred characters, but noticeably slower when the string contains thousands of characters. (This test script is set to use "0123456789" as its input.) // String reverse // %Text% = String before processing // %Result% = String after processing Variable Set String %Text% to "0123456789" Variable Set String %Result% to "" // %Len% = Number of characters in %Text% // %Start% = Starting position of the character to copy. (Begin with the last one) Variable Set Integer %Len% to the length of variable %Text% Variable Set Integer %Start% to %Len% // Begin by copying the final character in %Text%. Next time, copy the second last character, etc. // Each time, append the character, %Char%, to the end of %Result% Repeat Start (Repeat %Len% times) Variable Modify String: Copy part of text in %Text% starting at %Start% and 1 characters long to %Char% Variable Modify String %Result%: Append Text (%Char%) Variable Modify Integer %Start%: Decrement End Repeat Text Box Display: Result <COMMENT Value="String reverse"/> <COMMENT Value=" %Text% = String before processing"/> <COMMENT Value=" %Result% = String after processing"/> <VARIABLE SET STRING Option="\x00" Destination="%Text%" Value="0123456789" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%Result%" NoEmbeddedVars="FALSE"/> <COMMENT/> <COMMENT Value=" %Len% = Number of characters in %Text%"/> <COMMENT Value=" %Start% = Starting position of the character to copy. (Begin with the last one)"/> <VARIABLE SET INTEGER Option="\x0D" Destination="%Len%" Text_Variable="%Text%"/> <VARIABLE SET INTEGER Option="\x00" Destination="%Start%" Value="%Len%"/> <COMMENT/> <COMMENT Value="Begin by copying the final character in %Text%. Next time, copy the second last character, etc."/> <COMMENT Value="Each time, append the character, %Char%, to the end of %Result%"/> <REPEAT START Start="1" Step="1" Count="%Len%" Save="FALSE"/> <VARIABLE MODIFY STRING Option="\x09" Destination="%Char%" Variable="%Text%" Start="%Start%" Count="1" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x06" Destination="%Result%" Value="%Char%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x08" Destination="%Start%"/> <END REPEAT/> <COMMENT/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs40 %Result%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END REPEAT _ENABLED="FALSE"/> <TEXT BOX DISPLAY Title="Done" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
  • Create New...