Jump to content
Macro Express Forums

Samrae

Members
  • Content Count

    407
  • Joined

  • Last visited

  • Days Won

    20

Posts posted by Samrae

  1. If you intended to have your macro wait 15 seconds after the Bookmarks window closes you should not use Macro Stop. No macro commands, including the Delay command at the end, will run after the Macro Stop command.  Instead use Break. That skips to the macro command after the End Repeat. However, in this case, neither Break nor Macro Stop is needed because setting T77 to Done will stop the repeat loop. Try something like this:

    // Run the macro until the window is closed.
    Variable Set String %T[77]% to "Not"
    Repeat Until %T[77]% Equals "Done"
      If Not Window "Bookmarks - Google Chrome" is running
        Variable Set String %T[77]% to "Done"
      End If
      Delay: 100 milliseconds
    End Repeat
    Delay: 15 Seconds

    You still need some delay inside the repeat loop for the reason stated above.

  2. The delay after End Repeat will never be used. It should look like this:

        Macro Stop
      End If
      Delay: 15 Seconds
    End Repeat

    Without the delay inside the repeat loop Macro Express will run these macro commands as quickly as possible without slowing or stopping. It will use 100% of one of your CPU cores. This puts your macro into what your computer considers an infinite loop. I wouldn't be surprised if more than Chrome freezes. And Terry is right, your delay command contains 15 milliseconds instead of 15 seconds.

  3. Another way to accomplish this is to not let the macro halt until the window has been closed. If a specific macro is running it cannot be activated again. This demonstrates using Notepad.

    Text Box Display: Note_pad  is running
     
    Repeat Until %Done% Equals "Done"
      If Not Window "Notepad" is running
        Variable Set String %Done% to "Done"
        Macro Stop
      End If
      Delay: 1000 milliseconds
    End Repeat
    <TEXT BOX DISPLAY Title="Note_pad  is running" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue255;}\r\n\\viewkind4\\uc1\\pard\\qc\\cf1\\f0\\fs28 Notepad is running\\cf0\\fs20 \r\n\\par \\pard \r\n\\par }\r\n" Left="Center" Top="Top" Width="455" Height="76" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
    <COMMENT/>
    <REPEAT UNTIL Variable="%Done%" Condition="\x00" Value="Done"/>
    <IF NOT WINDOW Option="\x01" Title="Notepad" Partial="TRUE" Wildcards="FALSE"/>
    <VARIABLE SET STRING Option="\x00" Destination="%Done%" Value="Done" NoEmbeddedVars="FALSE"/>
    <MACRO STOP/>
    <END IF/>
    <DELAY Flags="\x02" Time="1000"/>
    <END REPEAT/>

    In this example the text box display has a window title of "note_pad" because if that window title is "notepad" the macro never ends.

  4. 16 hours ago, jon said:

    I must say that it's very strange that v4.7.1.1 did not work with Windows 10, considering that support for this version didn't end until well after Win 10's release. 

    That issue was fixed in a later version of Macro Express Pro 4. The latest version of Macro Express Pro 4 is v 4.9.0.1 available here. However, in the long run, I think you''ll be happy having upgraded to Macro Express Pro 6.

  5. Here are some suggestions that may help:

     

    1. There is a command to extract the filename from a full path. Take a look at the "Variable Set From File path" macro command.

    2. Add a "Wait for File to be Ready" macro command before the "If File Exists"" macro command. Macro Express may get to the If File Exist command before Windows has finished copying the file.

    3. Since you already have the filenames and file paths consider using the "Copy File/Files" macro command to copy the files. It is generally easier to copy the files using Macro Express instead of manipulating Windows File Explorer to copy files.

    4. If you were to use descriptive variable names it would make your macro easier to understand. For example maybe %SourceFile%, %DestFolder%, or %Filename% instead of %T3% and %T4% in addition to %nPos%. %Input%, and %Output%.

     

  6. 17 minutes ago, UAMike said:

    I am not getting the desired outcome. Where do you put the %LF% and %CR% variable within the Modify String command? I tried putting it in 'text to replace' ("-A%LF%%CR%") but then it ends up trying to replace %LF%%CR% as a string value.

    Generally, in Windows, this appears as CRLF, not LFCR.  Try this:

      Variable Modify String: Replace "-A%CR%%LF%" in %Temp% with ""

    • Like 1
  7. acantor:

     

    3 hours ago, acantor said:

    When I have used updating text boxes, Macro Express created a new text box each time. So if the updates occur every second for five minutes, Macro Express opens 300 new windows. All windows close when the script completes, but I prefer not to see dozens (or hundreds or thousands) of extra windows. So I usually incorporate a "Text Box Close " into the loop.

     

    To avoid having 300 new windows put the first Text Box Display before the Repeat Start command:

    Variable Set Integer %Count% to 1
    Text Box Display: Progress    <--- BEFORE Repeat Start
    Repeat Start (Repeat 10 times)
      Delay: 1000 milliseconds
      Variable Modify Integer %Count%: Increment
      Text Box Update: Progress
      Text Box Close: Progress
    End Repeat

     

  8. Something like this might work:

    Variable Set Integer %MacroNumber% to a random value between 1 and 8
    Switch( %MacroNumber% )
    Case: 1
      Macro Run: Macro 1
    End Case
    Case: 2
      Macro Run: Macro 2
    End Case
    Case: 3
      Macro Run: Macro 3
    End Case
    Case: 4
      Macro Run: Macro 4
    End Case
    Case: 5
      Macro Run: Macro 5
    End Case
    Case: 6
      Macro Run: Macro 6
    End Case
    Case: 7
      Macro Run: Macro 7
    End Case
    Case: 8
      Macro Run: Macro 8
    End Case
    End Switch

     

  9. 1 hour ago, kunkel321 said:

    Another idea I had was (when the application is already open) right-click on the Minimize button, top right of window. 

    This is a great idea! I just created a macro that does just that. It is going to be very handy. 

    FYI: I could not get this technique to work with Visual Studio 2017 because it uses non-standard minimize, maximize and close buttons.

    Thank you for the idea. Here is what I have so far. This is activated by a Mouse Event, right-click, area on screen, minimize button.

    Variable Set String %WindowTitle% to topmost window title
     
    If Variable %WindowTitle% Contains "Macro Express"
      Web Site, "https://www.macros.com", using Default Web Browser
    End If
     
    If Variable %WindowTitle% Contains "Microsoft Outlook"
      Web Site, "https://answers.microsoft.com/en-us/outlook_com/forum?sort=LastReplyDate&dir=Desc&tab=All&status=all&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=All&isFilterExpanded=false&page=1", using Default Web Browser
    End If
     
    If Variable %WindowTitle% Contains "- Microsoft Visual Studio"
      Web Site, "https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=visualstudio", using Default Web Browser
    End If
     
    If Variable %WindowTitle% Equals "FileZilla"
      Web Site, "https://forum.filezilla-project.org/", using Default Web Browser
    End If
     
    If Variable %WindowTitle% Contains "- Eclipse"
      Web Site, "https://www.eclipse.org/forums/", using Default Web Browser
    End If
     
    If Variable %WindowTitle% Contains "- Google Chrome"
      Web Site, "https://accounts.google.com/signin/v2/sl/pwd?service=groups2&passive=1209600&continue=https%3A%2F%2Fproductforums.google.com%2Fforum%2F&followup=https%3A%2F%2Fproductforums.google.com%2Fforum%2F&authuser=0&flowName=GlifWebSignIn&flowEntry=ServiceLogin#!categories/chrome", using Default Web Browser
    End If
    <VARIABLE SET STRING Option="\x05" Destination="%WindowTitle%"/>
    <COMMENT/>
    <IF VARIABLE Variable="%WindowTitle%" Condition="\x06" Value="Macro Express" IgnoreCase="TRUE"/>
    <WEB SITE URL="https://www.macros.com" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/>
    <END IF/>
    <COMMENT/>
    <IF VARIABLE Variable="%WindowTitle%" Condition="\x06" Value="Microsoft Outlook" IgnoreCase="TRUE"/>
    <WEB SITE URL="https://answers.microsoft.com/en-us/outlook_com/forum?sort=LastReplyDate&dir=Desc&tab=All&status=all&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=All&isFilterExpanded=false&page=1" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/>
    <END IF/>
    <COMMENT/>
    <IF VARIABLE Variable="%WindowTitle%" Condition="\x06" Value="- Microsoft Visual Studio" IgnoreCase="TRUE"/>
    <WEB SITE URL="https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=visualstudio" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/>
    <END IF/>
    <COMMENT/>
    <IF VARIABLE Variable="%WindowTitle%" Condition="\x00" Value="FileZilla" IgnoreCase="TRUE"/>
    <WEB SITE URL="https://forum.filezilla-project.org/" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/>
    <END IF/>
    <COMMENT/>
    <IF VARIABLE Variable="%WindowTitle%" Condition="\x06" Value="- Eclipse" IgnoreCase="TRUE"/>
    <WEB SITE URL="https://www.eclipse.org/forums/" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/>
    <END IF/>
    <COMMENT/>
    <IF VARIABLE Variable="%WindowTitle%" Condition="\x06" Value="- Google Chrome" IgnoreCase="TRUE"/>
    <WEB SITE URL="https://accounts.google.com/signin/v2/sl/pwd?service=groups2&passive=1209600&continue=https%3A%2F%2Fproductforums.google.com%2Fforum%2F&followup=https%3A%2F%2Fproductforums.google.com%2Fforum%2F&authuser=0&flowName=GlifWebSignIn&flowEntry=ServiceLogin#!categories/chrome" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/>
    <END IF/>

     

  10. As acantor said, displaying each iteration will slow down the macro. When I have a long macro I update the iteration counter every 25, 50, 100 or 1000 times. Yes, experiment to decide what you like best.

    Text Box Display: Test
    Variable Set Integer %DispCount% to 0
    Variable Set Integer %DispInterval% to 25
    Repeat Start (Repeat 100000 times)
      Variable Modify Integer %DispCount%: Increment
      If Variable %DispCount% Is Greater Than or Equal To "%DispInterval%"
        Text Box Update: Test
        Variable Set Integer %DispCount% to 0
      End If
    End Repeat
    <TEXT BOX DISPLAY Title="Test" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\b\\f0\\fs28 %Count%\\b0\\fs20 \r\n\\par }\r\n" Left="701" Top="409" Width="116" Height="103" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x01" Delay="0"/>
    <VARIABLE SET INTEGER Option="\x00" Destination="%DispCount%" Value="0"/>
    <VARIABLE SET INTEGER Option="\x00" Destination="%DispInterval%" Value="25"/>
    <REPEAT START Start="1" Step="1" Count="100000" Save="TRUE" Variable="%Count%"/>
    <VARIABLE MODIFY INTEGER Option="\x07" Destination="%DispCount%"/>
    <IF VARIABLE Variable="%DispCount%" Condition="\x04" Value="%DispInterval%" IgnoreCase="FALSE"/>
    <TEXT BOX UPDATE Header="Test" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\b\\f0\\fs28 %Count%\\b0\\fs20 \r\n\\par }\r\n"/>
    <VARIABLE SET INTEGER Option="\x00" Destination="%DispCount%" Value="0"/>
    <END IF/>
    <END REPEAT/>

    Also, instead of managing the repeat counter %Count% I suggest you tick the box in the Repeat Start command and enter %Count% there.

×
×
  • Create New...