Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,532
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. I think the Windows desktop is overrated. It's visually busy, hard to keep organized, and challenging to navigate around sans mouse. At various times I have preferred instead to open the desktop as a folder in Windows Explorer: I find it easier to deal with files and folders when they are listed alphabetically, which is easy to do when viewing the desktop as a regular Windows folder:
  2. Terry, Win+M is a legacy hotkey leftover from Windows 95 or 98. Microsoft introduced Win+D (D for desktop) years ago, and I have generally found it a little more reliable than the old hotkey. The following key sequence, which has also been around since Windows 95, minimizes all windows; but in Windows 7 and beyond, I am not sure it reliably puts focus on the desktop. But it does lend itself to scripting... Ctrl + Esc ' Activate Start/Windows button Esc ' Cancel Start button, but leave it focused Alt + M ' Minimize all A related key sequence makes it possible to interact with items on the desktop without actually minimizing any windows. So interaction with desktop items is hidden behind the open windows. For example, to navigate to and activate a desktop icon called "Terry"... Ctrl + Esc ' Activate Start/Windows button Esc ' Cancel Start button, but leave it focused Shift + Tab ' Navigate to the desktop Terry <Enter> ' Incremental search to Terry, and press Enter to activate it.
  3. To expand on Bruce's excellent explanation... There is no (easy) way to move the mouse pointer to selected text. But experiment with Chrome to find out whether it supports standard Windows hotkeys for selecting text once you have zeroed in the text using the Find command, e.g.: Shift + right arrow (select one character to the right) Shift + Ctrl + right arrow (select one word to the right) Shift + Home (select to the start of the line) Shift + End (select to the end of the line) This is a partial list of hotkeys for selection within a webpage. There are others, pretty well all of which involve holding down the Shift key. With Chrome, you may need to press F7 to enable selection via keyboard. It's a toggle (it's either ON or OFF) so you may need to turn it off once you're done selecting text, e.g., F7, Shift + Ctrl + Right, F7. Overall, I find Firefox more versatile than Chrome -- and much more versatile than Internet Explorer -- when I am scripting macros that select text on a webpage.
  4. I use Variable Modify String commands a lot to revise texts. For example: Text Type (Simulate Keystrokes): <CONTROL>a // Select all Clipboard Copy Variable Set String %Clip% from the clipboard contents Variable Modify String %Clip%: Strip CR/LF // Delete all new lines Variable Modify String: Replace " " in %Clip% with " " // Replace double spaces for single spaces Variable Modify String %Clip%: Lowercase // Lowercase everything Variable Modify String: Replace "color" in %Clip% with "colour" // Change the spelling of words that contain "color" and "labor" Variable Modify String: Replace "labor" in %Clip% with "labour" Text Type (Simulate Keystrokes): %Clip% // Replace the selection with the revised text
  5. Although the code is (mostly) unintelligible to me, I did have a few concerns that might account for the inability to interact with the screen elements via keyboard: Interaction via keyboard is improved by relying on "onfocus" instead of "onclick" events. A modal dialog is a secondary window that opens in front of the main window. For example, when you close a word processing document without having saved it, the program pops up a window asking you if you want to save the document. You must interact with the dialog box before you return to main window. In Windows, standard dialog boxes are keyboard accessible by default. In web apps, dialog boxes can be keyboard accessible, but it's up to the developer to ensure keyboard interactivity. There are no accesskey attributes in the code sample. Developers can provide mechanisms for interacting via keyboard by incorporating access keys. In the above example, a user would be able to go to the home page by pressing Alt + h (in Internet Explorer and Chrome) or Shift + Alt + h (in Firefox). In Chrome, the access key is either Alt + h or Shift+ Alt + h, depending on the circumstances.
  6. Can you navigate to these "buttons" by tabbing to them? Is it clear the buttons have focus? If it's clear these non-responsive buttons have keyboard input focus, and if pressing Enter or spacebar have no effect, you may be dealing with a scripted control that does not obey standard interaction rules. If you post a sample of the source code for the control (which you can expose in Chrome by pressing Ctrl + U), there may be hints on ways to activate the control via keyboard (and therefore via keystrokes sent via Macro Express). Or it may be obvious the developers have broken keyboard interaction! If the developers have designed the page for mouse-only interaction, I would encourage you to write them and report a bug -- and an area of non conformance with WCAG 2.0, the de facto international standard for web content accessibility. https://www.w3.org/TR/UNDERSTANDING-WCAG20/keyboard-operation-keyboard-operable.html
  7. I have learned a lot of your posts over the years, so I am glad to be able to reciprocate! The technique is not 100% reliable, but considering the range of macro scripting techniques that involve interacting with the user interface, it's pretty good. Inserting short delays may make the technique less apt to fail when web traffic, downloads, and low resources slow down a system.
  8. 1. Is there a capability to search for a specific text and select or click on that particular text You can search for specific text after you copy it into a variable. Selecting text within an application can be done in some applications, but that has nothing to do with Macro Express. 2. Can i grab text from application and paste it in text file Yes, as long as you can select the text in the application. There may be ways to copy text without selecting when dealing with Window controls. 3. Can i compare text file data with application data Yes.
  9. Alexis, You might be happy to know that the accelerator keys for the English versions do not always make sense. For example, in Word, to navigate to commands related to columns, press "Alt + P" (for Page Layout), and then "J" (for Columns). "J" was a strange choice as an accelerator key, as "C" was available!! And then there are commands to insert symbols, which are accessed by pressing "Alt + N" (for Insert), followed by "U"! I did a quick Google translate, and not too many languages include the the letter "U" in their word for symbol, other than Basque (ikurra) and Corsican (simbulu)...
  10. Microsoft retains some, but not all, key sequences from the pre-ribbon releases of Office. The technique worked better in some programs than in others, with the best example being Word: the commands on the following menus could be accessed by pressing the old key sequences: "Edit," "Tools," "Format," "Table," and "Insert;" but not "Window" or "Help." Some commands from the old "File" menu were still available using the Alt + F key combination. The reason they kept these key sequences was to appease power users. At least, that's what a Microsoft employee told me when I asked at a conference we both attended. It's been more than 10 years since Microsoft got rid of the menus. Some key sequences continue to work, others not; and some work in Word, but not in Outlook. (In Office 2003 and earlier, the menus in Outlook and Word were somewhat analogous. I suppose the underlying idea was that if you knew how to format a Word document, you would be able to do the same in an Outlook email message. But the user interfaces of the two programs seem to have drifted apart.)
  11. Is it possible the ribbons behave differently in different languages?
  12. For many years I have referred to combinations like Alt + H, O, R as "key sequences," as they involve pressing a specific sequence of keys. I don't think key sequences are documented, as there are thousands, maybe tens of thousands of them. But they are not the kind of the thing that people tend to memorize. Instead, they are discovered by paying attention to the letters (or numbers) that appear after pressing the initial Alt, and then following the prompts. So the key sequences are not really hidden. I bet most people don't notice them, so in a sense they are kind of invisible. But once one knows about the letters and numbers that are exposed when you start accessing menus and ribbons via keyboard, one finds they are almost everywhere. In general, I find key sequences are easier to spot in programs that have menus rather than ribbons. With menus, you are looking for underlined letters rather than floating alpha numeric characters. For example, in Firefox, "Options" is Alt + T, O. It might be helpful to know something interesting about the initial Alt. You do NOT need to hold it down while pressing the subsequent key. So you could press, with one finger, the first key, then the second, then the third. In Firefox, "Options" is.. Alt T O Another useful trick for macro scripting is to know you can substitute F10 for the initial Alt. Alt and F10 are functionally identical: F10 T O
  13. I know of two ways to figure out key combinations: 1. Understanding the rules for interacting with Windows applications via keyboard. For example, one rule is that pressing Alt shifts keyboard input focus from the active part of the window to the Ribbon or Menu bar. Pressing Alt also exposes accelerator keys. For example, in Excel, when you press Alt, you can see that H is Home, N is Insert, etc. Pressing one of these keys will reveal the next layer of key presses available. It's way more cumbersome to navigate through Ribbons than through menus, but the underlying rule is the same. 2. The other method: Google it!
  14. Text Type (Simulate Keystrokes): <ALT>h // Activate "Home" Ribbon Text Type (Simulate Keystrokes): o // Format Text Type (Simulate Keystrokes): r // Rename Sheet Delay: 200 milliseconds Clipboard Copy Delay: 200 milliseconds Text Type (Simulate Keystrokes): <ESC> // Cancel Variable Set String %WorksheetName% from the clipboard contents Text Box Display: %WorksheetName%
  15. 1. Review all of your Macro Express scripts and see if any are triggered by Ctrl + K. You are looking for a conflict with the built in Outlook command. (I didn't know anybody else used Ctrl + K in the To and CC fields other than me! (K stands for "komplete" the address!) 2. Are you running any other macro scripting programs like AutoHotkey? 3. Try a total shutdown of Windows. Not a log off, but a shutdown.
  16. Could you show us the script that is executing slowly?
  17. Been there, done that! I think this is a mistake all macro scripters have made. A "repair macro" to update all of your scripts is certainly doable. I use dozens of Macro Express macros that run only in Macro Express, so there is nothing to prevent you from trying to automate the task. But be aware that you may reach the point of diminishing returns if the time it takes to automate the process takes longer than manually fixing the scripts. But if it were me, I would try! I totally agree with rberq: don't try to do everything in one go. Start modestly, maybe 10 or 20 scripts at a time; and if you discover your repair macro is working reliably, then up the number of repetitions. You can increase the reliability a bit by pressing Esc to close the Replace dialog instead of clicking on the Close icon. Adding delays between steps, even 100 or 200 ms, might help. Longer delays will likely be helpful when windows and/or dialog boxes are opening and closing, maybe 300 ms or 500 ms. This might be the perfect moment to rewrite your script in ways that would simplify the task of updating the scripts in the future!
  18. I have been using the latest version since the day of its release. Maybe it's my imagination, but MEP feels more stable. Macro Express Pro does not crash often, but it happens occasionally. I think some freezes and crashes have to do with delays, and especially timed delays, e.g., Delay: 100 milliseconds Delay: 100 milliseconds, without ability to halt Since installing the upgrade two weeks ago, I have not experienced a single MEP crash. Thank you!
  19. I don't have a ready made solution, but when dealing with these kinds of scripting projects, I have found the "Date/Time" dialog tremendously and surprisingly useful. For example, I managed to make a script that calculates the date six months from now and outputs it. But if the future date is a Friday, the script changes the date to the previous Thursday. If the date happens to be a Saturday, Sunday or Monday, the script changes the date to the next Tuesday. My script looks something like this. Hope it inspires a simple solution. // Extract the day of the week, six months from today Date/Time: Set %DayofWeek% to an adjusted date/time using "dddd" as the format // Text Variable // Adjust target date (I don't book appointments on Mondays or Fridays) Delay: 100 milliseconds // A delay is needed somewhere… Not sure why. Switch( %DayofWeek% ) Case: Friday // Friday --> Previous Thursday Variable Set Integer %NumberofDays% to -1 End Case Case: Monday // Monday --> Next Tuesday Variable Set Integer %NumberofDays% to 1 End Case Case: Saturday Variable Set Integer %NumberofDays% to 3 End Case Case: Sunday Variable Set Integer %NumberofDays% to 2 End Case Default Case Variable Set Integer %NumberofDays% to 0 End Case End Switch // Insert new date Date/Time: Type out an adjusted date/time using "dd-MMM-YYYY" as the format
  20. I figured it out... and only three lines of code for the folder names, and three more lines for the file names. <REPEAT WITH FOLDER Path="C:\\Users\\Alan\\Documents\\Test" OnlyFiles="FALSE" Destination="%x%" FullPath="FALSE" ProcSubfolders="FALSE"/> <TEXT TYPE Action="0" Text="%x%<ENTER>"/> <END REPEAT/> Repeat with Folder C:\Users\Alan\Documents\Test Text Type (Simulate Keystrokes): %x%<ENTER> End Repeat Another example of the versatility of Macro Express Pro!
  21. I want to generate a file that contains the names of every folder and every file in a particular folder. I am trying to avoid a clunky solution like this: Repeat the number of objects in the folder Press F2 // Rename the item, which causes the object to be selected Clipboard Copy Press Esc // Escape from rename Switch to an open file Clipboard Paste Switch to the list of folders and files Press Down Arrow // Navigate to the next item Repeat End I should be able to do this from the command line using this: dir > list.txt But I do not have administrative rights to access the folder from the command prompt. Looking forward to seeing your cool MEP ideas!
  22. Although I prefer Macro Express Pro, I have recommended Macro Express Version 3 to a lot of people over the years, and most of them continue to use it.
  23. If you don't understand what it means to call one macro from another, don't worry. Suffice to say it is a technique for recycling Macro Express scripts. For now, focus your energies on perfecting a script that searches a line of, say, 400 pixels, maybe something like this... Variable Set Integer %x% to 100 // Initial x coordinate Variable Set Integer %y% to 300 // Initial y coordinate Variable Set String %TargetColour% to "255" // Target pixel colour 255 = RED of the words "Macro Stop" in the MEP "Script Editor" Repeat Start (Repeat 400 times) Delay: 10 milliseconds // Slow down the macro so you can see what's happening Mouse Move: %x%, %y% Relative to Screen Get Pixel Color from Beneath the Mouse into %PixelColour% If Variable %PixelColour% Equals "%TargetColour%" Text Box Display: Pixel found! Macro Stop End If Variable Modify Integer %x%: Increment // Increase the value of x by 1 End Repeat Text Box Display: Pixel NOT found! ====== <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="100" _COMMENT="Initial x coordinate"/> <VARIABLE SET INTEGER Option="\x00" Destination="%y%" Value="300" _COMMENT="Initial y coordinate"/> <VARIABLE SET STRING Option="\x00" Destination="%TargetColour%" Value="255" NoEmbeddedVars="FALSE" _COMMENT="Target pixel colour 255 = RED of the words \"Macro Stop\" in the MEP \"Script Editor\""/> <COMMENT/> <REPEAT START Start="1" Step="1" Count="400" Save="FALSE"/> <DELAY Flags="\x02" Time="10" _COMMENT="Slow down the macro so you can see what's happening"/> <MOUSE MOVE Option="\x01" X="%x%" Y="%y%" _PROMPT="0x000A"/> <GET PIXEL COLOR Option="\x00" Rel_To_Screen="TRUE" Destination="%PixelColour%"/> <IF VARIABLE Variable="%PixelColour%" Condition="\x00" Value="%TargetColour%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Pixel found!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang4105{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <MACRO STOP/> <END IF/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%x%" _COMMENT="Increase the value of x by 1"/> <END REPEAT/> <TEXT BOX DISPLAY Title="Pixel NOT found!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang4105{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
  24. I have written many scripts to search for a particular pixel colour within a region. There are several ways to approach the problem. Here are five methods I have tried: 1. Examine a single coordinate at regular intervals. 2. Check a vertical or horizontal line. 3. Check a rectangular region, one line at a time. 4. Check the entire screen or a specific window, one line at a time. 5. Check each pixel in a spiral pattern from a single coordinate. My experience is that only [1] and [2] execute quickly enough to be practical. [3] works fine if the rectangle isn't too large. [4] can take too long to execute: a 1366 x 768 screen would require 1,049,088 pixel colour tests! [5] is elegant and works nicely, but only if you have a rough idea of where to start the search. I have never found a practical application for [5], at least not yet. A series or combination of these methods is possible. I have, for example, searched a vertical line until I have found a pixel, and then hunted horizontally for a second pixel colour. I have done this for applications that have large rectangles consisting of only a few colours, e.g., a web app that has two or three frames. My most sophisticated macro of this ilk does four searches one after another: along a vertical line, then horizontal, then vertical and then horizontal again. During the last search, the macro counts the number of times a certain colour is found. It was challenging to make this macro work reliably. When I need to search large regions for a pixel colour, I sometimes opt for other scripting tools. Search rectangle for a pixel colour would be a dynamite feature to add to a future release of Macro Express! At one point I submitted a feature request to the good folks at Insight... I would encourage others to do the same.
×
×
  • Create New...