Jump to content
Macro Express Forums

terrypin

Members
  • Content Count

    2,057
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by terrypin

  1. This appears to work although I had some erratic behaviour. Decimal played hard to get but fiddling around with delays appears to have sorted it. Bool is very slow to display. My code is just plain stuff, slogging through the IFs and could no doubt be improved. Also I haven't figured out why I need to double click twice in the command list to get the dialog. EDIT: Activation is Window Title: Variable Set Window Gains Focus Title is a partial match (Coudn't get reliable triggering with Window Is Opened.) Whether I'll actually now use this macro is uncertain 😉 // Assumes that one of the Variable Set... dialogs has just been opened Wait for Window Title: Variable Set Variable Set String %tTitle% to topmost window title // BOOL If Variable %tTitle% Equals "Variable Set Bool" Text Type (Simulate Keystrokes): <TAB> // First a single tab Wait for Text Playback Delay: 0.1 seconds Text Type (Simulate Keystrokes): <F4> // Open drop-down Wait for Text Playback Delay: 0.1 seconds End If // CONTROL TEXT If Variable %tTitle% Equals "Variable Set Control Text" Text Type (Simulate Keystrokes): <TAB> Delay: 0.1 seconds Text Type (Simulate Keystrokes): <F4> // Opens drop-down Delay: 0.1 seconds End If // DECIMAL If Variable %tTitle% Equals "Variable Set Decimal" Text Type (Simulate Keystrokes): <TAB> Delay: 0.2 seconds Text Type (Simulate Keystrokes): <F4> // Opens drop-down Delay: 0.1 seconds End If // FROM FILE If Variable %tTitle% Equals "Variable Set From File" Text Type (Simulate Keystrokes): <TAB> Delay: 0.1 seconds Text Type (Simulate Keystrokes): <F4> Delay: 0.1 seconds End If // HANDLE If Variable %tTitle% Equals "Variable Set Handle" // Back with Shift+Tab Text Type (Simulate Keystrokes): <F4> // Open drop-down Delay: 0.1 seconds End If // INTEGER If Variable %tTitle% Equals "Variable Set Integer" Text Type (Simulate Keystrokes): <TAB> Delay: 0.1 seconds Text Type (Simulate Keystrokes): <F4> // Opens drop-down Delay: 0.1 seconds End If // STRING If Variable %tTitle% Equals "Variable Set String" Text Type (Simulate Keystrokes): <TAB><TAB><TAB><TAB><TAB> Delay: 0.1 seconds Text Type (Simulate Keystrokes): <F4> // Opens drop-down Delay: 0.1 seconds End If // ASCII CHAR If Variable %tTitle% Equals "Variable Set to ASCII Char" Text Type (Simulate Keystrokes): <TAB> Delay: 0.1 seconds End If // ASCII VALUE If Variable %tTitle% Equals "Variable Set to ASCII Value" Text Type (Simulate Keystrokes): <TAB> Delay: 0.1 seconds End If // MISC // As it's not one of the preceding nine, the dialog opened must be 'Variable Set From Misc' // No tabs needed, and no drop-down. <COMMENT Value="Assumes that one of the Variable Set... dialogs has just been opened"/> <WAIT FOR WINDOW TITLE Title="Variable Set " Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <VARIABLE SET STRING Option="\x05" Destination="%tTitle%"/> <COMMENT/> <COMMENT Value="BOOL"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Bool" IgnoreCase="TRUE"/> <TEXT TYPE Action="0" Text="<TAB>" _COMMENT="First a single tab"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Open drop-down"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="CONTROL TEXT"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Control Text" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="DECIMAL"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Decimal" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.2"/> <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="FROM FILE"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set From File" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<F4>"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="HANDLE"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Handle" IgnoreCase="FALSE"/> <COMMENT Value="Back with Shift+Tab"/> <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Open drop-down"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="INTEGER"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Integer" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="STRING"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set String" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB><TAB><TAB><TAB><TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="ASCII CHAR"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set to ASCII Char" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="ASCII VALUE"/> <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set to ASCII Value" IgnoreCase="FALSE"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <END IF/> <COMMENT/> <COMMENT Value="MISC"/> <COMMENT Value="As it's not one of the preceding nine, the dialog opened must be 'Variable Set From Misc'"/> <COMMENT Value="No tabs needed, and no drop-down."/>
  2. Hi Hans, Can you provide more information please. When your code above is run, what application is active (Excel?) and what is currently focused or selected? What result do you expect and exactly what result do you get? Do we need a specific file in order to reproduce the issue? Terry, UK
  3. Well done! Looking forward to trying it in the morning. It will be a neat complement to Cory’s macro, which I use to tackle the reverse task of finding those macros (if any) which run a specified macro as a ‘sub macro’.
  4. Excellent posts, thanks! I’ve plainly neglected error logging for far too long and those will be a great help. But the last recommendation gets the seegar, thanks so much @rberq. Of course, embarrassingly obvious once you see it suggested! And, thanks to Cory, I already I have his brilliant macro ‘Search and report on macro text’ which will do the job nicely.
  5. Hi Alan, Yep, you’re right on the mark there. I may return to it but meanwhile so much other stuff to do. Not least drastically culling my 2,300 macros! A key obstacle to that is avoiding removal of sub macros. MX Pro has no reliable way to identify which of these gets used in ‘main’ macros.
  6. Thanks Alan, much appreciate your nice work on this. But your macro means abandoning my existing familiar one, which I'd not want to do. At present it achieves the task of adding the 'unpercented name', in the logical place, namely within each such TBD, at the time they are inserted, where the variables can be reliably entered. If I've understood correctly your approach requires searching for them later, to add the 'unpercented name' and also do the sizing work, yes? On a specific, how and when do you expect the clipboard to capture the name of each variable? As I'm having some trouble testing it, would you mind sending me whatever files make up your own test environment please. If indeed it's possible at all I'd want any sizing to be either done in an add-on to my macro, or to follow it immediately in a fresh macro. The only ideas I had were to somehow (!) use either the complex Run macro in variable command, or the registry to manage the variable data. In practice, I guess the width and height and then change it after the first run. So I'm ready to conclude that this is one of those 'nice-to-have' macros that are not really worth the effort, apart admittedly for the intellectual satisfaction! Terry
  7. Morning Alan, 1. The latter. 2. I think a fixed width of say 120 chars would be OK (including 'xxx...xxx = ', with word wrap if then necessary. Terry
  8. Hi Alan, Still yet to get to my PC (tomorrow) but reading your three posts more carefully in bed now on my iPad, with a glass of Chardonnay for inspiration. I don’t see anything that automatically changes the size of the TBD? With several variables listed, varying in width, I’m wondering if there’s some way to resize it appropriately based on the length of the longest one? Of course, it’s easy enough to do manually, but.... Terry
  9. Many thanks Alan, those look very interesting. Garden chores all day today so will try them tomorrow morning.
  10. As well as following Cory's suggestions you could also sort the MX Pro Explorer list on the Modified column, showing the most recent at the top. BTW, I assume you included a prefix or suffix with 'pn' to activate your shortkey macro, (set with Options | Preferences | Activations | Shortkeys) as 'pn' alone obviously risks starting the macro whenever you (or a macro) types words like 'pneumonia', etc.
  11. This simple macro , written years ago, has proved very useful. When writing macros I use many Text Display commands, temporarily showing variable values. The macro makes their identification unambiguous. One day I'll get around to trying to improve it in a few ways, such as by automatically sizing the TBD. (But if anyone feels like tackling that for me...! ) <DELAY Flags="\x02" Time="100"/> <COMMENT Value="Assumes a Text Box Display command dialog window is open."/> <COMMENT Value="Assumes text cursor is at RH end of target line.\r\nActivation is l-click in small area to left of entries."/> <KEYSTROKE SPEED Delay="50"/> <TEXT TYPE Action="0" Text="<ARROW LEFT>" _COMMENT="Prepare to select all but the last percent sign."/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<SHIFT><HOME>" _COMMENT="Select"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<CONTROL>c" _COMMENT="Copy to clipboard"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<HOME>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<CONTROL>v" _COMMENT="Paste"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<SPACE>=<SPACE>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<HOME>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<DELETE>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<END>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Move to next line."/> <DELAY Flags="\x02" Time="100"/>
  12. I don’t understand what you mean. Your screenshot shows all the expected information. And are you using MXPro in elevated mode or not? If not, why not? I have not tested it, but I’m not sure whether elevated mode is necessary for the Mouse Locator to work correctly. Perhaps someone working in normal mode can confirm please? Edit: Just seen your additional comments. I have no file of that name. The present program executable for MXPro 6.1.3.1 is called MSLocate.exe and has a size of 810 KB. The only file with a name like that you give on my PC is MSLocate_v6.1.1.1.exe dated April 2019, size 786 KB. I would re-install 6.1.3.1.
  13. With MX Pro 6.1.3.1 I'm using Win 10 Version 1909 (OS Build 18363.900) and the Mouse Locator is displaying the colour code OK. MacEdit.exe and MacExp.exe are currently shown as 'Elevated' in Task Mgr. If the issue remains in any application, and after rebooting, I think my next step would be to type SFC /scannow into the Run box or at an elevated command prompt, in case any key DLLs have somehow become corrupted. If your Win 10 version has had a more recent update then perhaps that too is another possible cause. Failing any success I reckon I'd then re-install MX Pro. Terry, UK
  14. That correctly draws a rough circle here. Are you sure you have Brush tool selected before drawing? And that Colour 1 is not white? What was the result of running the macro I sent you? If all of that is OK after careful checking, then look for other factors that may differ. Single monitor here. Win 10 Version 1909 (OS Build 18363.900). No virtual systems etc.
  15. I assume you have removed those spurious lines from start and end of the current macro? I'm guessing they were also probably the reason you couldn't use the code box. After removing about 2,300 redundant lines from your macro, albeit hastily, and inserting a delay where described, it paints something vaguely like a face here: <MACRO PLAYBACK SPEED Speed="1"/> <WINDOW RESIZE Option="\x00" Partial="FALSE" Wildcards="FALSE" Method="\x00" Width="1624" Height="974"/> <DELAY Flags="\x03" Time="320"/> <MOUSE MOVE Option="\x02" X="1071" Y="129" _PROMPT="0x000A"/> <DELAY Flags="\x03" Time="23"/> <MOUSE LEFT BUTTON DOWN/> <DELAY Flags="\x01" Time="0.1"/> <MOUSE LEFT BUTTON UP/> <DELAY Flags="\x03" Time="262"/> <MOUSE MOVE Option="\x02" X="669" Y="408" _PROMPT="0x000A"/> <MOUSE LEFT BUTTON DOWN/> <DELAY Flags="\x01" Time="0.1"/> <MOUSE LEFT BUTTON UP/> <MOUSE MOVE Option="\x02" X="657" Y="465" _PROMPT="0x000A"/> <DELAY Flags="\x03" Time="337"/> <MOUSE LEFT BUTTON DOWN/> <DELAY Flags="\x03" Time="52"/> <MOUSE MOVE Option="\x02" X="660" Y="466" _PROMPT="0x000A"/> <MOUSE LEFT BUTTON UP/> <MOUSE MOVE Option="\x02" X="776" Y="472" _PROMPT="0x000A"/> <DELAY Flags="\x03" Time="398"/> <MOUSE LEFT BUTTON DOWN/> <DELAY Flags="\x03" Time="52"/> <MOUSE MOVE Option="\x02" X="776" Y="470" _PROMPT="0x000A"/> <MOUSE LEFT BUTTON UP/> <MOUSE MOVE Option="\x02" X="716" Y="507" _PROMPT="0x000A"/> <DELAY Flags="\x03" Time="113"/> <MOUSE LEFT BUTTON DOWN/> <DELAY Flags="\x03" Time="8"/> <MOUSE MOVE Option="\x02" X="727" Y="541" _PROMPT="0x000A"/> <MOUSE LEFT BUTTON UP/> <MOUSE MOVE Option="\x02" X="629" Y="552" _PROMPT="0x000A"/> <DELAY Flags="\x03" Time="157"/> <MOUSE LEFT BUTTON DOWN/> <MOUSE MOVE Option="\x02" X="793" Y="552" _PROMPT="0x000A"/> <MOUSE LEFT BUTTON UP/>
  16. Not here! With the Brush tool selected I simply move the mouse cursor. No need to hold the mouse key down. CORRECTION: Just tried it again and this time I did have to hold the mouse down. I think that previously while testing your macro a Mouse Left Down command had not been followed by a Mouse Left Up. Your comments on those weird chars? At least once, there is no delay between your mouse down and mouse up, which might cause a problem. <DELAY Flags="\x03" Time="254"/> <MOUSE MOVE Option="\x02" X="1071" Y="129" _PROMPT="0x000A"/> <DELAY Flags="\x03" Time="23"/> <MOUSE LEFT BUTTON DOWN/> <MOUSE LEFT BUTTON UP/> <DELAY Flags="\x03" Time="262"/> <MOUSE MOVE Option="\x02" X="1071" Y="130" _PROMPT="0x000A"/>
  17. Firstly, Script.txt contains weird characters at the start and end. -------------------- ​ <MACRO PLAYBACK SPEED Speed="1"/> <WINDOW RESIZE Option="\x00" Partial="FALSE" Wildcards="FALSE" Method="\x00" Width="1624" Height="974"/> . . Total 2,375 lines . . . <MOUSE MOVE Option="\x02" X="949" Y="626" _PROMPT="0x000A"/>  ​ -------------------- When pasted into MX Pro they become Text Type commands, such as: Text Type (Simulate Keystrokes): ​ Secondly, my typo sorry. I meant Left Mouse. not Ctrl key. IOW, why are you drawing with the mouse key depressed? I'll take a look at the 2,300 odd lines of code after lunch!
  18. Hello Mike. I'm not a regular Chrome user but I just tried it with the shortcuts @rberq mentioned. Strangely Ctrl+1, Ctrl+3, Ctrl+4, etc all worked OK. But Ctrl+2 consistently did nothing. So in case you'd already been using that, avoid it by using Ctrl+1 followed by Ctrl+Tab. And brief research shows that similar Chrome shortcut problems are not rare. The following macro worked consistently here: // Assumes Chrome is open. // Any of Chrome's tabs could currently be selected. But the window tiltle of all of them will include the string ' - Google Chrome'. // Assumes Excel is open and active, with a cell in the Parts column selected. // This macro will copy the selected part number and paste it into a text field of the page open in Tab#2 of Chrome. Clipboard Copy Window Activate: - Google Chrome Wait for Window Title: - Google Chrome // Select tab #2 by using Ctrl+1 folowed by Ctrl+Tab (to avoid the issue I described, if it's present for you too). Text Type (Simulate Keystrokes): <CONTROL>1 Delay: 0.1 seconds Text Type (Simulate Keystrokes): <CONTROL><TAB> Delay: 0.1 seconds // Navigate with tabs or mouse clicks to the text target location. Mouse Move: 434, 643 Relative to Current Window Mouse Left Click // Paste from clipboard. Clipboard Paste CODE (for pasting to Direct Editor): <COMMENT Value="Assumes Chrome is open."/> <COMMENT Value="Any of Chrome's tabs could currently be selected. But the window tiltle of all of them will include the string ' - Google Chrome'."/> <COMMENT Value="Assumes Excel is open and active, with a cell in the Parts column selected."/> <COMMENT Value="This macro will copy the selected part number and paste it into a text field of the page open in Tab#2 of Chrome."/> <CLIPBOARD COPY/> <WINDOW ACTIVATE Title="- Google Chrome" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <WAIT FOR WINDOW TITLE Title="- Google Chrome" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <COMMENT Value="Select tab #2 by using Ctrl+1 folowed by Ctrl+Tab (to avoid the issue I described, if it's present for you too)."/> <TEXT TYPE Action="0" Text="<CONTROL>1"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<CONTROL><TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <COMMENT Value="Navigate with tabs or mouse clicks to the text target location."/> <MOUSE MOVE Option="\x02" X="434" Y="643" _PROMPT="0x000A"/> <MOUSE LEFT CLICK/> <COMMENT Value="Paste from clipboard."/> <CLIPBOARD PASTE/> Otherwise, can you post your commands and code (using the code tool <>) which should help us look closer at your issue. Terry
  19. Hello Hannes, Sorry to hear about that discouraging start, but it’s almost certainly something very basic. The simplest way we might help is for you to upload your failed macro details. Use the Code icon <> and post the commands and then (after a gap) the actual macro code. But, although it's tempting when you start out, I'd recommend you generally avoid capturing as a macro creation method. It typically generates so much redundant code that - if it doesn't work immediately - troubleshooting can be hard work. EDIT: BTW, why are you holding down the Ctrl key? Terry
  20. I’m not sure exactly what you mean by structured programming? If not simply using ‘sub macros’ widely, as I expect most experienced users do, then could you give an example please? One downside in MX Pro is managing variables reliably across the constituent sub macros. I’m not a programmer but I assume that’s not an issue with modern programming languages.
×
×
  • Create New...