Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,232
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by terrypin

  1. Here's my macro to achieve the result we've discussed. It does work here although it's still pretty crude. In particular note my inclusion of Delays and Wait for Text Playback, as I'm still unsure whether the Waits work on their own. I've been forced to split it into two parts for a reason I'll explain later. // This first section exports all scripts in the current MEX file to an existing text file called CurrentMacroScripts, replacing its current contents. Window Activate: Macro Express Pro - Explorer Keystroke Speed: 10 milliseconds Text Type (Simulate Keystrokes): <ALT>feo // File > Export > Export Macros... Wait for Text Playback Delay: 100 milliseconds, without ability to halt Text Type (Simulate Keystrokes): <SPACE><TAB><TAB><SPACE><TAB><SPACE><ENTER> // Configure the export appropriately Wait for Text Playback Delay: 1 seconds Text Type (Simulate Keystrokes): C:\Docs\SUNDRY\Macro Express\CurrentMacroScripts.txt Wait for Text Playback Text Type (Simulate Keystrokes): y Wait for Text Playback Wait for File to Exist: C:\Docs\SUNDRY\Macro Express\CurrentMacroScripts.txt Text Box Display: File created Delay: 100 milliseconds Macro Return <COMMENT Value="This first section exports all scripts in the current MEX file to an existing text file called CurrentMacroScripts, replacing its current contents."/> <WINDOW ACTIVATE Title="Macro Express Pro - Explorer" Exact_Match="FALSE" Wildcards="FALSE"/> <KEYSTROKE SPEED Delay="10"/> <TEXT TYPE Action="0" Text="<ALT>feo" _COMMENT="File > Export > Export Macros..."/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <DELAY Flags="\x03" Time="100"/> <TEXT TYPE Action="0" Text="<SPACE><TAB><TAB><SPACE><TAB><SPACE><ENTER>" _COMMENT="Configure the export appropriately"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <DELAY Flags="\x01" Time="1" _ENABLED="FALSE"/> <TEXT TYPE Action="0" Text="C:\\Docs\\SUNDRY\\Macro Express\\CurrentMacroScripts.txt\r\n"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="y\r\n"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <WAIT FOR FILE TO EXIST Filename="C:\\Docs\\SUNDRY\\Macro Express\\CurrentMacroScripts.txt" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT BOX DISPLAY Title="File created" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 The full data has been exported to the file CurrentMacroScripts.\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <DELAY Flags="\x02" Time="100"/> <MACRO RETURN/> // This part gets the macro name entered as a target. It assumes you have the name selected in ME Pro Explorer. Keystroke Speed: 50 milliseconds Mouse Right Click: 50 milliseconds Delay: 100 milliseconds Text Type (Simulate Keystrokes): p Wait for Text Playback Text Type (Simulate Keystrokes): <TAB> Wait for Text Playback Clipboard Copy Variable Set String %Target% from the clipboard contents // This part searches that file for all commands containing at least one Macro Run for the target macro xyz. Variable Set to ASCII Char 13 to %CR% // Set CR Variable Set to ASCII Char 10 to %LF% // Set LF Variable Set String %CRLF% to "%CR%%LF%" Variable Set Integer %N[1]% to 1 Text File Begin Process: C:\Docs\SUNDRY\Macro Express\CurrentMacroScripts.txt If Variable %Text% Contains "Name: " // Test for current macro name Variable Set String %Macroname% to "%Text%" Variable Modify String %Macroname%: Delete a substring starting at 1 and 6 characters long Goto:End End If If Variable %Text% Contains "<MACRO RUN Use_ID="FALSE" Name="%Target%" // Test if this command is a MACRO RUN of target macro And If Variable %Macroname% Does not Equal "%OldName%" // Test if this command is a MACRO RUN of target macro // Do whatever is necessary for a hit Variable Modify String %Results%: Append Text String Variable (%Macroname%) Variable Modify String %Results%: Append Text String Variable (%CRLF%) Variable Modify Integer %Hits%: Increment Variable Set String %OldName% to "%Macroname%" End If :End Variable Modify Integer %N[1]%: Increment Text File End Process Text Box Display: Results List Variable Modify String: Save %Results% to "C:\Docs\SUNDRY\Macro Express\Results.txt" Macro Return <COMMENT Value="This part gets the macro name entered as a target. It assumes you have the name selected in ME Pro Explorer."/> <KEYSTROKE SPEED Delay="50"/> <MOUSE RIGHT CLICK/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="p"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<TAB>"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <CLIPBOARD COPY/> <VARIABLE SET STRING Option="\x02" Destination="%Target%"/> <COMMENT Value="This part searches that file for all commands containing at least one Macro Run for the target macro xyz."/> <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CR%" _COMMENT="Set CR"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%" _COMMENT="Set LF"/> <VARIABLE SET STRING Option="\x00" Destination="%CRLF%" Value="%CR%%LF%"/> <VARIABLE SET INTEGER Option="\x00" Destination="%N[1]%" Value="1"/> <TEXT FILE BEGIN PROCESS Filename="C:\\Docs\\SUNDRY\\Macro Express\\CurrentMacroScripts.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%Text%"/> <IF VARIABLE Variable="%Text%" Condition="\x06" Value="Name: " IgnoreCase="FALSE" _COMMENT="Test for current macro name"/> <VARIABLE SET STRING Option="\x00" Destination="%Macroname%" Value="%Text%"/> <VARIABLE MODIFY STRING Option="\x0A" Destination="%Macroname%" Start="1" Count="6"/> <GOTO Name="End"/> <END IF/> <IF VARIABLE Variable="%Text%" Condition="\x06" Value="<MACRO RUN Use_ID=\"FALSE\" Name=\"%Target%" IgnoreCase="FALSE" _COMMENT="Test if this command is a MACRO RUN of target macro"/> <AND/> <IF VARIABLE Variable="%Macroname%" Condition="\x01" Value="%OldName%" IgnoreCase="FALSE" _COMMENT="Test if this command is a MACRO RUN of target macro"/> <COMMENT Value="Do whatever is necessary for a hit"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%Results%" Variable="%Macroname%"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%Results%" Variable="%CRLF%"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%Hits%"/> <VARIABLE SET STRING Option="\x00" Destination="%OldName%" Value="%Macroname%"/> <END IF/> <LABEL Name="End"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%N[1]%"/> <TEXT FILE END PROCESS/> <TEXT BOX DISPLAY Title="Results List" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red255\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs16 The target macro \\cf1 %Target%\r\n\\par \\cf0 is used (at least once) in the following %Hits% macro(s):\\b0 \r\n\\par \\pard \r\n\\par %Results%\r\n\\par \r\n\\par \\pard\\qc\\b These have been saved to the file Results.txt (replacing previous contents).\\b0\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="600" Height="800" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <VARIABLE MODIFY STRING Option="\x11" Destination="%Results%" Filename="C:\\Docs\\SUNDRY\\Macro Express\\Results.txt" CRLF="TRUE"/> <MACRO RETURN/> Notes/Queries 1. Obviously the filenames or at least their path will need changing to suit. 2. Here the creation takes less than a second, generating a file of 12,200 lines (for 573 macros in FULL.mex). 3. I'm not sure why a Script Editor window sometimes gets displayed at the end of the search, taking the focus from the message. 4. When I consolidated both the creation and the search into a single macro I hit an obscure snag. The macro crashes (hard - cannot be aborted except by terminating ME Pro) consistently when the search reaches this command line: <VARIABLE SET STRING Option="\x00" Destination="%OldName%" Value="%Macroname%"/> That is, of course, a command in the macro that is actually running. But I still haven't fathomed exactly why it fails. I'm wondering if Joe's suggestion up-thread is relevant, but haven't really grasped how to use it in this context. So the only way I can run the search part is to first delete that line of script from the text file. 5. The search then takes a few seconds, finishing with this message window: -- Terry, East Grinstead, UK
  2. Thanks Cory, that's another puzzle sorted! Had me stumped for half a day. With that obstacle cleared, I've now been able to finish the macro we've been discussing in 'Filtering for "Called by Macro" List, Does such a feature exist?'. I'll post about it in that thread. when I've tidied up some loose ends. -- Terry, East Grinstead, UK
  3. Yes. 'Click in the box on the right...' is probably an unnecessary instruction. But, as always, if it doesn't say right-click or middle-click it means a plain left click, so it can never do any harm. Perhaps sometimes the cursor might not be in that box by default. You still haven't spelt out exactly what you are doing and what you are seeing. But I think you have misunderstood how to use this dialog. Simply do as I said in my earlier post, at step 1. As it says at the top of that window, 'Select an initial activation on the left.' So just left click None at bottom left if that's what you want. -- Terry, East Grinstead, UK
  4. Thanks all, appreciate those helpful replies. It's becoming clearer now but the main thing I'm still hung up on (and which really prompted my post) is #3. Within aText Begin Process loop on a plain text file, I'm testing my empty line for CR, LF, CRLF and null, but don't get a hit with any of them. -- Terry, East Grinstead, UK
  5. From your screenshot, the window you get is not my second window. Look more carefully at their respective titles. My first screenshot shows the situation when None is selected, not the default Hotkey. You are getting the correct Create New Macro window. So that's not the issue. Are you saying that when you left click the None checkbox the Hotkey checkbox stays selected and is assigned to Left mouse? And similarly if you click the None checkbox with the right mouse you get Right mouse activation? If so, then that does indeed sound bizarre. I'm assuming you've re-booted your PC and are not getting any odd behaviour from your mouse in ME Pro or any other application? Have you tried Tools > Restore Keyboard & Mouse Hooks ? If the problem persists I'd try re-installing ME Pro. Steve: Left mouse is apparently valid, although it has to be selected from the list. -- Terry, East Grinstead, UK
  6. No harm in posting the details here so that we can take a look. You'll need to provide at least 4 things: 1. Copy all the command lines from the Script Editor and paste them into your post in the normal way. (I like to format mine with bold and dark blue, so they stand out.) 2. Click Insert: CODEBOX on the left. Then copy all the code from the Direct Editor (toggled with the button below the green arrows) and paste them into the codebox 3. Explain fully what your macro is supposed to be doing. Include details or examples of any input or output files (edited if they're confidential), web pages, etc. Hopefully this should all be in the job definition you gave to your elusive author in India. 4. Explain fully what your macro is actually doing at present. Include full details of any error messages, output files, etc. -- Terry, East Grinstead, UK
  7. Can someone please clarify various points about the clipboard with null contents please? 1. Does 'null' mean 'nothing' and is that always the same as 'empty'? 2. If not, what are familiar examples of each, to drive the distinction home? 3. Is an empty line of text null? IOW, suppose I have a text file with groups of lines, with each group separated by an empty line. When I copy that to the clipboard why does it still contain the previous value, instead of nothing? 4. How could I therefore test for such an empty line? For example, while using Text File Begin Process? 5. How do you get null as the contents of the clipboard, apart from using Clipboard Empty? Of course, if all of this is documented somewhere I haven't yet found, I'd appreciate a pointer please. -- Terry, East Grinstead, UK
  8. I'm not following you either. I don't see why you "have no chance to click somewhere" with your mouse. For a hotkey type of activation, just enter your macro name and choose the hotkey (in any order) and click OK. If this still doesn't answer your question, please provide more details, including a screenshot or at least a step-by-step description of what you are doing and seeing. -- Terry, East Grinstead, UK
  9. This was the first time I'd used it too! -- Terry, East Grinstead, UK
  10. Yes - Kevin will be along in a minute to tell you off! But who knows, they might be related? I eventually managed to reproduce your problem after progressively reducing the value in Options > Preferences > Playback > Delays > Delay after keystrokes in the Text Type command from my 2000 microsecs to the default of zero. Here's what the final part of my result looked like: Here is test number 12. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text. And a small Quantity of Text Done 12 Here is test number 13. And a small Quantity of Text. And a small Quantity o YTXUT ENAO TEMLU D UERLAA TF>IUYLSDL TEI OSTA ERE OE LAADL> D MALLN A >OT > XD D% Hmm, strange. -- Terry, East Grinstead, UK
  11. This works fine normally, but when I try to step through it with F8 why doesn't it get past the Wait please? Control Panel Open Wait for Window Title: Control Panel Macro Return <CONTROL PANEL OPEN/> <WAIT FOR WINDOW TITLE Title="Control Panel" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <MACRO RETURN/> -- Terry, East Grinstead, UK
  12. That fails because macro reports error message. But prompted by your general idea I wrote the following which seems to work OK. Get Mouse Position into (%N[1]%, %N[2]%) Relative to Screen // Capture existing position so that it can be restored later if required Move Mouse to Tray Icon to AWC // Move mouse cursor to tray icon with a name including the string 'AWC' On Error Catch Error: The system tray icon does not exist Text Box Display: Result // Message if tray icon is not present End Catch Error End Error Mouse Move: %N[1]%, %N[2]% Relative to Screen // If mouse did move, return it to its original position. (May instead want to leave it there, ready to click the icon.) Macro Return <GET MOUSE POSITION Option="\x00" X="%N[1]%" Y="%N[2]%" _COMMENT="Capture existing position so that it can be restored later if required"/> <MOVE MOUSE TO TRAY ICON Icon="AWC" Exact="FALSE" Center="TRUE" Left="0" Top="0" _HANDLE="0x002F" _COMMENT="Move mouse cursor to tray icon with a name including the string 'AWC'"/> <ON ERROR/> <CATCH ERROR Code="47"/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 That tray icon does not exist\\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" _COMMENT="Message if tray icon is not present"/> <END CATCH ERROR/> <END ERROR/> <MOUSE MOVE Option="\x01" X="%N[1]%" Y="%N[2]%" _PROMPT="0x000A" _COMMENT="If mouse did move, return it to its original position.\r\n(May instead want to leave it there, ready to click the icon.)"/> <MACRO RETURN/> -- Terry, East Grinstead, UK
  13. I used to follow any Text Type with a Delay (typically 100 ms) and seemed to get fair results. But recently, reasoning that it should be even better (possibly infallible), I've switched to using Wait for Text Playback. However, I seem to be getting erratic results. With a simple test macro such as Text Type (Simulate Keystrokes): <ARROW DOWN> // Move down to next line Wait for Text Playback frequently it will continue running indefinitely. But on the next run it might work OK. Anyone else having similar behaviour please? Or able to confirm my tests? Or perhaps I've misunderstood the capabilty or purpose of this command? Come to think, why wouldn't such a command be built-in to every Text Type anyway? -- Terry, East Grinstead, UK
  14. OK Cory, understood. I wish you could put your hands on your macro! I've been trying for an hour or so but have given up for now. I was placing command script lines into a text variable where I then intended to test it with If Variable %Command% Contains "<MACRO RUN" But that's getting screwed up sometimes when the command script line contains strings like '%T[1]%' etc. They get converted to their current values, instead of just being left as plain text. Is there some way to avoid that sort of thing? -- Terry, East Grinstead, UK
  15. Bob, Interesting approach, must try it. I've got into the (possibly bad?) habit of using plain Text Type: Keystroke Speed: 10 milliseconds // Etc Text Type (Simulate Keystrokes): <CONTROL>c Wait for Text Playback // Recently changed. Previously I've been using a 100 ms Delay // Etc And at present I have Options > Preferences > Playback > Delays set to 2000 microsecs, 250 ms, 250 ms respectively. Presumably your subroutine empties the clipboard before each copy? -- Terry, East Grinstead, UK
  16. Cory, Not sure I'm following you there? The above just exports all scripts, using the same Export facility you mentioned. No text editor involved. I vaguely assumed that the search macro would just prompt for a 'target' macro and then simply ASCII process/search the file, displaying the results as a list of macros in a Text Display, or a file if preferred. Again, no text editor. Both macros would then be combined. -- Terry, East Grinstead, UK
  17. Not really. As Cory said, the file creation macro is pretty simple. My hasty attempt below is probably a bit crude but it works OK here and produces a 12,000 line file from the 562 macros in my FULL.mex file in under a second. // This will export all scripts to an existing text file called CurrentMacroScripts, replacing its current contents. Window Activate: Macro Express Pro - Explorer Keystroke Speed: 10 milliseconds Text Type (Simulate Keystrokes): <ALT>feo // File > Export > Export Macros... Wait for Text Playback Text Type (Simulate Keystrokes): <SPACE><TAB><TAB><SPACE><TAB><SPACE><ENTER> // Configure the export appropriately Wait for Text Playback Delay: 1 seconds Text Type (Simulate Keystrokes): C:\Docs\SUNDRY\Macro Express\CurrentMacroScripts.txt Wait for Text Playback Text Type (Simulate Keystrokes): y Wait for Text Playback Macro Return (BTW, I've left that paste unedited apart from the formating. Why do I often get apparently blank lines in my script, usually (but not always) after a Text Type command? Such as between commands #9 and #10 above?) <COMMENT Value="This will export all scripts to an existing text file called CurrentMacroScripts, replacing its current contents."/> <WINDOW ACTIVATE Title="Macro Express Pro - Explorer" Exact_Match="FALSE" Wildcards="FALSE"/> <KEYSTROKE SPEED Delay="10"/> <TEXT TYPE Action="0" Text="<ALT>feo" _COMMENT="File > Export > Export Macros..."/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<SPACE><TAB><TAB><SPACE><TAB><SPACE><ENTER>" _COMMENT="Configure the export appropriately"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <DELAY Flags="\x01" Time="1"/> <TEXT TYPE Action="0" Text="C:\\Docs\\SUNDRY\\Macro Express\\CurrentMacroScripts.txt\r\n"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="y\r\n"/> <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <MACRO RETURN/> Hopefully you or Cory can now write the complementary search macro! -- Terry, East Grinstead, UK
  18. David, I (correctly) get what sounds similar behaviour with applications in which there are files open that I've not yet saved at the time of closing Windows. Could it be that one or more unsaved macros in Script Editor are the cause? -- Terry, East Grinstead, UK
  19. Thanks Cory, duly reported as a bug. -- Terry, East Grinstead, UK
  20. Steve, Maybe I've misunderstood, but it looks to me as if that was just a temporary glitch (maybe a delay updating the site) and is now fixed. Your second screenshot shows that you are up to date with the latest version, 4.0.1.1, yes? -- Terry, East Grinstead, UK
  21. Thanks Steve, duly reported as a bug. -- Terry, East Grinstead, UK
  22. My normal method of copying a couple of commands (typically a Text Type followed by a Delay or a Wait for Text) is to hit Ctl+d to duplicate them and then use Ctl+ArrowDown to move them to the new position. But unlike ME3, ME Pro does not keep the selection of both. After the Ctl+d only the first command is selected. Anyone able to confirm that behaviour please? -- Terry, East Grinstead, UK
  23. I'm trying to add a Repeat Prompt Start command. I don't want to use variables. I just want to get a simple prompt as I do in ME 3. But on clicking OK I get: "Invalid variable entered. Please make sure that there are % signs on either side of the variable. Please correct." -- Terry, East Grinstead, UK
  24. Steve, Yes, I too have often wanted a search facility like that, along the lines that Joe describes. On occasions I've even resorted to opening my main MEX file (FULL.mex) in Hex Workshop Editor and using its search to find relevant text strings. So one line of attack would be to generalise that. Another sledge-hammer approach might be to periodically run a macro that successively copies all your scripts to a file, allowing you to then search it. -- Terry, East Grinstead, UK
  25. Thanks both. Unless someone comes up with something clever, I'm beginning to think perhaps I'd be better off ignoring the possibility that it's already open in an existing tab. After opening the page (easy enough) I could then possibly find a way to remove the duplicate if there is one. -- Terry, East Grinstead, UK
×
×
  • Create New...