Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,532
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. You could write a macro, using Macro Express, that would perform the three steps to navigate to the dialog box via hotkey. Alt + F Slight pause O
  2. I'm running a test macro. So far, the script has activated at the correct time. With another macro scripting tool that I use, there's a bug related to time: it gets converted to Greenwich Mean Time!
  3. While there are programs that Macro Express cannot detect – Adobe Reader is hit-and-miss – programs that are easily controllable via keyboard using normal interaction rules are, in my experience, very amenable to macro automation. But Q-Dir appears to be an exception. I don't think I've ever seen anything quite like the difficulties we are seeing in accessing different areas of Q-Dir's interface via macros when Q-Dir already has a reliable set of hotkeys. Workarounds are not necessarily a bad thing. In my macro-scripting world, I often need to puzzle out workarounds to gain the functionality I'm after.
  4. I just tried this AutoHotkey script: !1:: SendInput, ^1 return Translation: Create a hotkey triggered by Alt +1 that outputs Ctrl + 1 I tested the macro in Q-Dir, and it fails. When I run the macro in Word, the command works. (Ctrl + 1 in Word = single space the paragraph.) So the problem is not inherent to Macro Express. My script fails as an AutoHotkey macro, which is a more powerful automation tool than Macro Express -- albeit much harder to learn and use... which is why MEP is still my first choice.
  5. Here's another workaround: two scripts: one that navigates to the next pane, and the other to navigate to the previous pane. Macro 1: Text Type (Simulate Keystrokes): <ALT>d Text Type (Simulate Keystrokes): <TAB> Macro 2: Text Type (Simulate Keystrokes): <ALT>d Text Type (Simulate Keystrokes): <SHIFT><TAB> So if the third pane has focus and you want to go to the first, press the hotkey for the first macro twice, or the second macro three times.
  6. This was all sounding curious, so I downloaded the software, installed it, and wrote a few macros. You're right, my scripts don't seem to be able to send Ctrl +1, 2, etc. to the application. However, I found a workaround. Rather than send keystrokes, I could capture the controls for all four address bars, and gain access to the "panes" that way. Get Control: (Q-DIR.EXE) Using z-order -> %Control% Set Focus to %Control% When you use Macro Express's Get Control feature, you'll need to drag the crosshairs (a stylized purple-coloured "X") over each of the four address bars. I used the option to capture using each control's "Z-order."
  7. If moving the mouse to the text cursor position doesn't work (followed by space or Ctrl + space... or by Up arrow then Down arrow... or Down arrow then Up arrow.... Then the best option is probably what Cory suggested right off the bat: checking pixel colours. Pixel checking under Windows 7 and earlier worked beautifully. They are slow under Windows 10, and therefore, I've been forced to change the way I hunt for colours. I used to check each pixel along a path; now I check every 20th, or 50th, or 100th. Looking at your screen shot, I'm guessing you could get away with checking every 50 pixels, which will likely be fast enough. Maybe something like this untested code: // Calculate half horizontal size of window Variable Set Integer %WinWidth%: Set to the Current Window's Width Variable Modify Integer: %WinWidthHalf% = %WinWidth% / 2 // Maximum times to check for a pixel colour Variable Set Integer %MaxChecks% to 25 // Y-coordinate fudge factor -- where to start checking pixel colours from top of window Variable Set Integer %y% to 200 Repeat Start (Repeat %MaxChecks% times) Mouse Move: %WinWidthHalf%, %y% Relative to Current Window Get Pixel Color from Beneath the Mouse into %PixelColour% If Variable %PixelColour% Equals "123456" // Colour of a selected row Mouse Left Double Click Macro Stop Else Variable Modify Integer: %y% = %y% + 50 // Next time, check 50 pixels "south" End If End Repeat Text Box Display: Pixel colour not found! <COMMENT Value="Calculate half horizontal size of window"/> <VARIABLE SET INTEGER Option="\x0A" Destination="%WinWidth%"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%WinWidthHalf%" Value1="%WinWidth%" Value2="2"/> <COMMENT/> <COMMENT Value="Maximum times to check for a pixel colour"/> <VARIABLE SET INTEGER Option="\x00" Destination="%MaxChecks%" Value="25"/> <COMMENT/> <COMMENT Value="Y-coordinate fudge factor -- where to start checking pixel colours from top of window"/> <VARIABLE SET INTEGER Option="\x00" Destination="%y%" Value="200"/> <COMMENT/> <REPEAT START Start="1" Step="1" Count="%MaxChecks%" Save="FALSE"/> <MOUSE MOVE Option="\x02" X="%WinWidthHalf%" Y="%y%" _PROMPT="0x000A"/> <GET PIXEL COLOR Option="\x00" Rel_To_Screen="TRUE" Destination="%PixelColour%"/> <IF VARIABLE Variable="%PixelColour%" Condition="\x00" Value="123456" IgnoreCase="FALSE" _COMMENT="Colour of a selected row"/> <MOUSE LEFT DOUBLE CLICK/> <MACRO STOP/> <ELSE/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%y%" Value1="%y%" Value2="50" _COMMENT="Next time, check 50 pixels \"south\""/> <END IF/> <END REPEAT/> <COMMENT/> <TEXT BOX DISPLAY Title="Pixel colour not found!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs14 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
  8. In many applications, a hotkey moves focus to the address line without the need to know its coordinates. Try Alt + D and/or Ctrl + L.
  9. I think this solution might only work when the mouse pointer happens to be hovering over the row. I don't know this application, but few programs I've seen move the mouse pointer when navigating via arrow keys.
  10. So... you manually click inside Q-DIr before you press the hotkey, and sometimes it works, sometimes it doesn't. Any patterns you can discern to the failures, e.g., the hotkey never works the first time you press it, but it always works the second time. If this is the case, not sure what is going on, although it might have to do with a component of Q-Dir stealing focus. Take a screen shot of Q-Dir window, and post it here!
  11. What happens if you manually click somewhere inside the application window before activating the hotkey?
  12. 1. Try substituting this: <TEXT TYPE Action="0" Text="<CTRL>1"/> 2. What happens if you change the activation to something that doesn't involve a modifier key, e.g., F11, F12, Numpad *, etc.
  13. Your macro, activated by Ctrl + 1, sends Ctrl + 1 to the application? If so, that's probably the problem. Try a totally different hotkey.
  14. It sounds like moving the mouse cursor to the row gives focus to the row, but does not select it. Try pressing spacebar to select the row. Or Ctrl+spacebar. Or press down arrow, then up arrow. (Although this probably won't work right for the last row. Up, then down may not work for the first row.)
  15. Do you have this checkbox unchecked? "Wait for the HotKey to be released before activating." If yes, put a tick in the checkbox, save the macro, and try again.
  16. Confirm that there is no keyboard shortcut for what you want to do. I googled "Fidelity Active Trader Pro keyboard shortcuts" and noticed many built-in hotkeys. If there is no hotkey, here are two ideas: 1. What happens if you right-click the row? Does a context menu appear with the option you need? Let's assume this is the context menu: Hello Conversation Goodbye Can you navigate to the second item via down or up arrow keys? Note underlined accelerator keys. For the second item, Conversation, the accelerator key is V. What happens if you press "V?" If any of these work, try this... Text Type (Simulate Keystrokes): <SHIFT><F10> // Keyboard shortcut to Right Click Text Type (Simulate Keystrokes): <ARROW DOWN><ARROW DOWN><ENTER> // or... Text Type (Simulate Keystrokes): <SHIFT><F10> // Keyboard shortcut to Right Click Text Type (Simulate Keystrokes): v 2. Try routing the mouse pointer to the cursor position. This doesn't work in all programs. But if it works in this application, this script fragment might do the trick: Mouse Move: To the Text Cursor Position Mouse Left Double Click
  17. An accurate description of the life of a person who likes to script macros!
  18. There are a few applications that MEP can't see. But if your macros work sporadically, that suggests to me that something else is wrong. Add an instruction to your macro to pop a message box as a way to confirm your macros are getting activated. MessageBox: The hotkey was recognized! Some programs, especially when running under Windows 10, have trouble keeping focus. Does it help if you click in the Q-Dir window before you activate your hotkey?
  19. 1. Double check whether the Search button can reached via standard navigation techniques, such as pressing Tab and Shift + Tab. The key sequence might be quite strange, e.g., Tab, Tab, Right arrow. 2. Check whether Macro Express can "see" the Citations window when it's open. When setting the scope to Window-specific, does the Citation window appear anywhere in this list? If the answer to both of these questions is no, then you'll need to resort to dodgy techniques that are possible yet labour-intensive to implement. For example: ensuring the window always appears in the same location and then clicking the same XY coordinate (as rberq suggested); searching for pixel colours; searching for changes in the shape of the mouse cursor; or combination of the above.
  20. I agree. The potential savings of a macro that creates variables on the fly needs to be balanced against the time and effort needed to make it work. I can imagine spectacular failures along the way. Although it could be a fascinating project to test one's mettle, it's not something Macro Express was designed to do. But there is another possibility. Under "Preferences," "General" tab, "Dialogs." there is this option: "Prompt the user to create a variable that is not defined." When unchecked, the variables that one creates in the Script Editor are (sort of) generated on the fly. I disabled this setting ages ago, and haven't missed it. For general-purpose scripting, I find I rarely have reason to do anything in the "Variables" tab in the Script Editor.
  21. Although I don't know a straightforward way to create Macro Express variables on-the-fly, that doesn't mean it's impossible. Many years ago, I developed a Macro Express script that generated other Macro Express scripts. I wonder whether the approach could be applied to the problem of generating variables. The script worked by sending sequences of keystrokes and mouse clicks to the Macro Express user interface. After a lot of tweaking, the script was nearly 100% reliable, although while running, the script felt brittle.
  22. You will need to define every variable you plan to input into the script. You can define dozens or hundreds of variables, if you want. All of those variables shouldn't impact performance significantly. This script accepts variables "a", "b", and "chrome" only: Variable Set String %a% to "" Variable Set String %b% to "" Variable Set String %chrome% to "" Variable Set String %VariableName%: Prompt If Variable %VariableName% Equals "a" OR If Variable %VariableName% Equals "b" OR If Variable %VariableName% Equals "chrome" Variable Set String %%VariableName%% to topmost window title Text Box Display: Values Else MessageBox: Can't use this as a variable! End If <VARIABLE SET STRING Option="\x00" Destination="%a%" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%b%" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%chrome%" NoEmbeddedVars="FALSE"/> <COMMENT/> <VARIABLE SET STRING Option="\x01" Destination="%VariableName%" Prompt="What is the name of the variable?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/> <COMMENT/> <IF VARIABLE Variable="%VariableName%" Condition="\x00" Value="a" IgnoreCase="TRUE"/> <OR/> <IF VARIABLE Variable="%VariableName%" Condition="\x00" Value="b" IgnoreCase="TRUE"/> <OR/> <IF VARIABLE Variable="%VariableName%" Condition="\x00" Value="chrome" IgnoreCase="TRUE"/> <VARIABLE SET STRING Option="\x05" Destination="%%VariableName%%"/> <TEXT BOX DISPLAY Title="Values" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang4105\\f0\\fs20 VariableName = %VariableName%\r\n\\par \r\n\\par %a%\r\n\\par %b%\r\n\\par %chrome%\\lang1033\\f1\\fs14 \r\n\\par }\r\n" Left="821" Top="Center" Width="871" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <ELSE/> <MESSAGEBOX Caption="Can't use this as a variable!" Message="You must specify \"a,\" \"b,\" or \"chrome,\" not \"%VariableName%\" " Icon="4"/> <END IF/>
  23. For at least one badly-behaved app that I've automated, I was forced to Tab (or Shift+Tab) 10, 15, 20, maybe 25 times to reach some targets. It wasn't ideal, but the macros worked reliably.
×
×
  • Create New...