Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,232
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by terrypin

  1. I'm doing some work on my many pop up menu macros. But something odd has happened to the titles which Menu Builder displays. Only the very first one is correct. All subsequent menu macros opened are just titled 'MENUS'. Hopefully my screenshots will add any clarification needed.
  2. Sorted! I had been blindly oblivious to the need for the main macro X to have all variables defined! It is just a series of four Macro Run commands. Each individual submacro M1, M2, A and B creates and uses variables. These get used in successive submacros. All were defined (globally) in their respective submacros. But despite that, two variables dDeg and tDeg created in A were not recognised in B. Perhaps it should have been obvious, but now that I have added dDeg and tDeg to the main macro X, all is well.
  3. Thanks Alan, yes there certainly must be! As mentioned, other submacros in the same main macro are passing on values OK. And I too did a similar simple test like yours, with the expected correct result. I’ll get back on the case tomorrow. It has me completely baffled. I recall similar issues, but they always turned out to be because I hadn’t defined the variables, as @samrae suggested.
  4. @samrae Thanks, but they are correctly specified. If I use this macro // Use F5 after running this to show current state of ALL variables used in this session. Variable Restore: Restore All Variables the two variables in question tDeg and dDeg are reported correctly in the Variable window. I've temporarily resorted to Variable Save/Restore, but I won't rest until I fix this.
  5. In macro X I have these commands at the end. Macro Run: A Macro Run: B At the end of macro A several decimal and text variables are displayed correctly. At the start of macro B they are shown as zero or blank. I've tried all sorts of stuff over the last hour or so, such as renaming them, rewriting the TBD command, inserting dealys between A and B, restarting ME Pro, kicking the desk, etc. In vain. I could place a Variable Save and then in B a Variable Restore, but I shouldn't have to do that and I try to avoid those commands. There are other submacros before A and B, and their variables are being passed without a problem. Hair pulling time. Anyone have any ideas please?
  6. Alan, I got same behaviour on the couple of tests I had time for (Firefox and a folder). Strange. Speculative, but may be related to the other mouse cursor issue we were discussing? -------------------- EDIT at 08:40 Scrub that speculation! It's because the macro logic is wrong! The following does the job: Variable Set Integer %x%: Set to the Current Window's Width Mouse Move: %x%, 0 Relative to Current Window Mouse Move: -10, 10 Relative to Last Position // Nudge the mouse pointer a little so that it is visible in maximized windows <VARIABLE SET INTEGER Option="\x0A" Destination="%x%"/> <MOUSE MOVE Option="\x02" X="%x%" Y="0" _PROMPT="0x000A"/> <MOUSE MOVE Option="\x03" X="-10" Y="10" _PROMPT="0x000A" _COMMENT="Nudge the mouse pointer a little so that it is visible in maximized windows"/>
  7. Try this. Variable Restore: Restore Text Variables // Restores previously set status of the flag If Variable %T[99]% Equals "Stop" // If 'Stop' then end the macro Macro Stop End If Delay: 0.1 seconds Text Box Display: Macro is continuing Delay: 0.1 seconds // Your macro commands here // Set the 'flag' T[99] to 'Stop' now that the macro has been run once Variable Set String %T[99]% to "Stop" Variable Save: Save Text Variables // Saves the status of the flag CODE <VARIABLE RESTORE Option="\x01" _COMMENT="Restores previously set status of the flag"/> <IF VARIABLE Variable="%T[99]%" Condition="\x00" Value="Stop" IgnoreCase="FALSE" _COMMENT="If 'Stop' then end the macro"/> <MACRO STOP/> <END IF/> <DELAY Flags="\x01" Time="0.1"/> <TEXT BOX DISPLAY Title="Macro is continuing" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 T[99] = flag = %T[99]%\r\n\\par \r\n\\par The macro will now continue to run your commands, then set the flag T[99] to 'Stop'.\r\n\\par \r\n\\par So it will not run fully again unless you either disable the macro or write and run another macro to restart it.\r\n\\par \r\n\\par \\b Close this to continue.\\b0\\f1 \r\n\\par }\r\n" Left="505" Top="485" Width="594" Height="240" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <DELAY Flags="\x01" Time="0.1"/> <COMMENT Value="Your macro commands here"/> <COMMENT Value="Set the 'flag' T[99] to 'Stop' now that the macro has been run once"/> <VARIABLE SET STRING Option="\x00" Destination="%T[99]%" Value="Stop" NoEmbeddedVars="FALSE"/> <VARIABLE SAVE Option="\x01" _COMMENT="Saves the status of the flag"/> (Note: As described in my earlier post, it is best to place your code in a Code box, as I've done above.) The devil as usual is in the details. As you've found in this case, MEP's activation by 'Window is opened' is unfortunately unreliable. 'Window Gains Focus' usually works but adds complications. If my approach or @kunkel321's neat idea doesn't work then consider an additional macro to change the 'flag' under other conditions that meet your requirements, such as after a certain longish period of time, or when tab has been reactivated a certain number of times.
  8. What exactly happens when you - open that web page? - activate it again later? Ditto without the Lock/Unlock commands? Ditto in F9 mode? Ditto in F8 mode? Do any of those indicate the source of whatever problem you’re still having? I don’t want to subscribe to the WNBA League Pass site to test your macro. So please edit as requested to make it as short and simple as possible and using a web site widely accessible. But still exhibiting whatever symptoms you describe. EDIT: Include your script code for multiple macros in separate Code boxes.
  9. So now is the time to let us see your macro. 1. Edit/rewrite it to remove any private content and to make it 'universally accessible'', not needing any of your files or other applications. 2. Include any comments necessary to make its purpose and operation clear. 3. Run it to ensure it consistently exhibits the problem behaviour. 4. In the Script Editor: Select all your script (Ctrl+a)>Right click>Copy Command Text. 5. In the forum post you are preparing, on a fresh line: Click the code icon '<>' and in the resultant Code window paste the command text from the clipboard and click 'Insert into post'. 6. Back in your script, with all lines still selected: Ctrl+c to copy it to clipboard in its 'raw' form 7. Repeat step 5, this time pasting the actual code. We will then be able to see your script and duplicate your macro with minimal effort. -------------------- I took the above steps to show you my macro which appears to work reliably, running just once whenever this thread gets focus in my browser: // This macro displays a text message whenever a window containing the string // '8465-activate-a-macro' // has just gained focus. Text Box Display: Macro started Delay: 0.5 seconds <COMMENT Value="This macro displays a text message whenever a window containing the string\r\n"/> <COMMENT Value="'8465-activate-a-macro'\r\n"/> <COMMENT Value="has just gained focus."/> <TEXT BOX DISPLAY Title="Macro started" 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\\fs24 A Waterfox or Firefox or Chrome or Edge browser window title containing the string\r\n\\par \\cf1 '8465-activate-a-macro'\\cf0 \r\n\\par has just gained focus.\\b0\\f1\\fs20 \r\n\\par }\r\n" Left="660" Top="498" Width="477" Height="195" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <DELAY Flags="\x01" Time="0.5"/>
  10. Hard to advise without seeing an example macro. For instance, are you activating it when a window is opened with that title? Or when it gains focus as @acantor assumes? And must it be an exact title or a partial one? What operations is it performing after starting? If for instance it's using a Text Box Display (TBD) to give you a message then as soon as you close that TBD it will probably regain focus and start the macro again. However, I've found that MEP sometimes does not respond reliably to window title commands. Timing or other obscure conflicts with the OS may be the cause. In which case other 'recognition' methods may be needed. Could you share a very simple macro that consistently exhibits 'activating over and over'? (Ask if you don't know how to do that.)
  11. It all depends on how much flexibility you want. Your own code indicated that you may at least want to change the start and stop time. The start date in my code can be any date after you want the program to run, and the end date similarly sets the before target. If you run the macro exactly as it stands you'll quickly get it. But now that I understand your objective more clearly I'd suggest you use @acantor's much simpler method. EDIT: And I see that my macro has inverted the 'Off' period!
  12. It would be easier to use decimals. Try this: // Change the following start date and time to your requirement, e.g. 07/08/19 05:00:00 Date/Time: Set %dtStart% to "07/08/19 16:00:00" // Set start = 4pm = 16:00 Convert Date/Time to Decimal: %dtStart% => %dStart% // Change the following end date and time to your requirement, e.g. 07/08/19 07:30:00 Date/Time: Set %dtEnd% to "07/08/19 16:58:00" // Set end = 16:44 Convert Date/Time to Decimal: %dtEnd% => %dEnd% Date/Time: Set %dtCurrent% to the current date/time Convert Date/Time to Decimal: %dtCurrent% => %dCurrent% Text Box Display: // TEMP, remove after testing If Variable %dCurrent% Is Greater Than or Equal To "%dStart%" AND If Variable %dCurrent% Is Less Than or Equal To "%dEnd%" Text Box Display: Continue Else Text Box Display: Close // TEMP, remove after testing Macro Stop End If CODE <COMMENT Value="Change the following start date and time to your requirement, e.g. 07/08/19 05:00:00"/> <DATE/TIME Flags="\xB1" Date="07/08/19 16:00:00" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Prompt="What is the start time for macro running?" Left="Center" Top="Center" Monitor="0" Variable="%dtStart%" IsDateVar="TRUE" _COMMENT="Set start = 4pm = 16:00"/> <CONVERT DATE/TIME TO DECIMAL Source="%dtStart%" Dest="%dStart%"/> <COMMENT/> <COMMENT Value="Change the following end date and time to your requirement, e.g. 07/08/19 07:30:00"/> <DATE/TIME Flags="\xB1" Date="07/08/19 16:58:00" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Prompt="What is end time for macro running?" Left="Center" Top="Center" Monitor="0" Variable="%dtEnd%" IsDateVar="TRUE" _COMMENT="Set end = 16:44"/> <CONVERT DATE/TIME TO DECIMAL Source="%dtEnd%" Dest="%dEnd%"/> <COMMENT/> <DATE/TIME Flags="\xB0" Date="07/08/19 15:48:26" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Minute_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%dtCurrent%" IsDateVar="TRUE"/> <CONVERT DATE/TIME TO DECIMAL Source="%dtCurrent%" Dest="%dCurrent%"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 dtCurrent\\f1 = \\f0 %dtCurrent%\\f1 (Date/Time format)\\f0 \r\n\\par dCurrent\\f1 = \\f0 %dCurrent%\\f1 (Decimal format)\r\n\\par \r\n\\par dtStart = %dtStart% (Date/Time format)\r\n\\par dStart = %dStart%\r\n\\par \\f0 \r\n\\par \\f1 dtEnd = %dtEnd% (Date/Time format)\\f0 \r\n\\par \\f1 dEnd = %dEnd%\r\n\\par \r\n\\par \\f0 \r\n\\par \r\n\\par \r\n\\par \r\n\\par }\r\n" Left="584" Top="485" Width="515" Height="296" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE" _COMMENT="TEMP, remove after testing"/> <IF VARIABLE Variable="%dCurrent%" Condition="\x04" Value="%dStart%" IgnoreCase="FALSE"/> <AND/> <IF VARIABLE Variable="%dCurrent%" Condition="\x05" Value="%dEnd%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Continue" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Current time is inside the allowed period of\r\n\\par %dtStart% to %dtEnd%\r\n\\par \r\n\\par so run the rest of your macro here.\\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"/> <ELSE/> <TEXT BOX DISPLAY Title="Close" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Current time is outside the allowed period, so the macro will now stop.\\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="TEMP, remove after testing"/> <MACRO STOP/> <END IF/>
  13. It looks as if you're stopping the macro if it meets the conditions for running? And presumably those TBD commands at the end are temporary? (BTW, why such an odd time delay? Come to that, why a delay at all?)
  14. That's a difficult one! No single macro would warrant the title of 'my best' and if I compiled a short list of 'most useful' from the couple of thousand I've written it would cover a wide spectrum. Used up to scores of times a day - Sizing and positioning windows (mainly File Explorer folder) - Opening frequently used folders - Typing frequently used text with shortkeys (file and folder paths, signatures, email addresses, my name and address, phone numbers, regular phrases like 'Best wishes', etc) - Typing date & time with shortkey '=dt' Wednesday 7 August 2019, 1402 - When saving a series of files (such as when browsing images or text etc that I need for videos), a click close to the right of 'Save As...' (or variations) saves it as xyz-05 if the previous was xyz-04 - In all my applications, middle clicking its title to display a menu of macros, sometimes via subfolders - When creating a Text Box Display command, generate 'VariableName = ' to the left of '%VariableName%' with a single click -Etc Infrequently used but invaluable - During my frequent work in Google Earth, Google Maps, Memory-Map, etc: finding/copying/moving places and tracks between them; changing properties of multiple tracks, etc - On average once or twice a week, but many more directly after a walking holiday: from the GPX file of a walk recorded on my iPhone, automatically creating an Excel spreadsheet like that I showed in the recent thread about VBA, plus a profile like this: https://www.dropbox.com/s/63dwbplk410mj80/20190709Falmouth-Portscatho-r483-m6.7-PS.jpg?raw=1 (That's one of my most complex macros, calling a dozen submacros, some of which use VBA and some use Python scripts I've written in PaintShop Pro. I'd say it's probably the one I'm most proud of.) - One of Cory's, with only minor adaptation by me: 'Search and report on macro text'. - Etc -------------------- I'd like to have used the 'Last run time' column to give a more objective reply on the first category, but (a) It doesn't include submacros (b) It gets destroyed when a new version is installed
  15. I sent a formal ‘bug report’, referring to this thread for further detail.
  16. Here it still doesn't do what it should. In Firefox and Waterfox always going to (8,31), relative to the window. In MS Edge it goes to (0,0), the TL corner of the screen, regardless of where the Edge window is placed. In Google Chrome it goes to screen (8,0), regardless of where the Chrome window is placed. In Google Earth it always goes to (8,31), relative to the window. In Notepad and my regular text editor, TextPad - it works correctly!
  17. Thanks both. The Meproc version worked this time, although I'd have sworn it did not do so earlier! Yes, the Macexp version (used in Help) still does not work.
  18. Thanks Alan but I had tried meproc. There was no space after 'A' in my example, although that was yet another variant I tried.) Does either macexp or meproc work for you?
  19. Came across this thread today and would appreciate re-opening the discussion. I tried the same syntax options as Nathan - all in vain. If it ever did work, that no longer does so in Win 10 version 1903. Would welcome contradiction! I think there's some ambiguity about the correct syntax. I interpret Help Command Line Parameters as meaning that to run a macro called 'Test Open Notepad' we should use the following in either the Run box or (with extra effort to change directory as Samrae says) at a Command Prompt: "C:\Program Files (x86)\Macro Express Pro 6\Macexp.exe" /ATest Open Notepad That fails here in both, as do variants of it. Does it work for others? The only reliable way I've found to run a macro externally is to first export it with R-Click>Export>Export as Playable For example, having done that, placing the following in the Run Box will open Notepad: C:\Users\terry\Dropbox\MXE files\Test Open Notepad.mxe
  20. OK, so that arrow is unrelated to MEP: https://support.microsoft.com/en-gb/help/975785/guided-help-customize-the-notification-area-in-windows-7 Try to get a consistently repeatable situation in which the running man icon disappears while a macro is demonstrably running (e.g. a message is being displayed by it). Then show us full details so that we can pursue further. I'm sure you've eliminated the possibility that the customisation arrow, being closely alongside, is getting accidentally clicked? I've had my share of intermittent and inconsistent quirks with MEP over many years (with Win XP and Win 10) so I know how exasperating they can be!
  21. I cannot reproduce as I don't see any arrow icon like yours. What did you do to get that displayed? What are its properties? Here's what my notification area looks like.
  22. Yes, relative to the window is better than to the screen for this stuff, so I've changed to that too. But I can't reproduce your latest mystery. In both Firefox and Waterfox the mouse cursor destination is always (8,31) regardless of whether there's been any typed entry or not. Wherever the text cursor is placed. (I find the most convenient locations are the Address or the Search box.) Did you note that 'always'? Incredibly, this is suddenly no longer dependent on whether FF or WF are at (0,0)! You didn't tell me what you meant by 'top left corner'. Knowing that (and your screen resolution) might offer clues about what's going on. I just pop up the MEP Mouse Locator for confirmation, before doing anything else, with this macro, which I activate with Alt+Shift+7. (Preceding it with a Mouse Left Click command would avoid the negative results you get against 'Active Window'. That's why I originally worked in 'relative to screen'.) Keystroke Speed: 10 milliseconds Program Launch: "MSLocate.exe" (Normal) Parameters: -hex Delay: 100 milliseconds <KEYSTROKE SPEED Delay="10"/> <PROGRAM LAUNCH Path="C:\\Program Files (x86)\\Macro Express Pro\\MSLocate.exe" Mode="\x00" Parameters="-hex" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/> <DELAY Flags="\x02" Time="100"/>
  23. And that includes when Firefox is not maximised and not located at (0,0)? By 'top left corner' do you mean exactly (0,0)? All very baffling! 🙂
  24. Thanks Alan. (And I hope Kirkcaldy always will be!) I decided last night to bite the bullet and 1903 build 18362.267 is now installed. Some minor things awaiting resolution but generally looks OK so far. But disappointingly it hasn't miraculously resolved a couple of MEP issues (or a couple of others) as I'd tentatively hoped.
×
×
  • Create New...