Jump to content
Macro Express Forums

kunkel321

Members
  • Posts

    214
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by kunkel321

  1. A system that I've used for a long time is that typing ; in front of a string is a trigger for an autotext entry.  For example

    ;brb = be right back

    For dates I use 

    ;d

    Also I have a number that indicates offset though...

    ;d0 = today

    ;d1 = tomorrow

    ;d3 = day after tomorrow.  

    ...

    ;d9 = nine days from now. 

     

    At first I used 

    ;d-1 for yesterday

    ;d-2 for day before yesterday, and so on.  

     

    Over the years it evolved into 

    ;dd1

    ;dd2

    ;dd3

    Which is easier to type.  

     

    Unfortunately these have to be created as separate macros.  

     

    I'm in the process of changing computers, so I've uninstalled MEp, otherwise I'd post an example.  The code is not complicated though... 

     

  2. On 3/3/2020 at 9:15 AM, acantor said:

    When you press the arrow key to navigate to a line of text, does pressing Ctrl + c copy the entire line to the clipboard without the need to select the line?

     

    I think so(?)  Here's a quick screencast.

    https://www.screencast.com/t/9zClrYOvVC

     

    EDIT: In the screencast I click on the top line, then arrow-down, then ctrl+c, then ctrl+v.  The clipboard contents are shown in the Ditto clipboard extender.

  3. 13 hours ago, acantor said:

    The reason the script isn't working is that there is no code to select the current line. You need to do something like this:

     

    <HOME><SHIFT><END> to select the line before copying it to the clipboard

     

    Are you sure this is right Acantor?  If I navigate manually, I can just do <down arrow> then <ctrl>c, and it copies the line of code to the clipboard.  

     

  4. For fun I tried to combine Acantor's two scripts (code box below).  

    WARNING -- It doesn't stop looping at the end like it's supposed to.  

    It's supposed to ...

    Set clipboard to %currLine% at the start of the loop,

    then set %prevLine% to %currLine% at the end.

    And keep looping until prevLine = currLine.  

    So once the last line is checked twice in a row, they should be the same.. 

     

    It think that logic is correct(???)

     

    Anyway, the coloring part works (there has to be a message box and/or comment for it to do anything).   Assign a hotkey to the macro, then open your other macro (that you want to color) and click on line 1, then do the hotkey. 

     

    Note:  Acantor's "If %x%" macro above looks to 4 different things.  I only used 2 of them....  I guess in theory a person could colorize as many different types of things as they wanted.  If you had a bunch though, it would probably be good to have most of that code in a different macro, then call it with the main macro.  Maybe(?)   

     


     

    Repeat Until %currLine% Equals "prevLine"
      Clipboard Copy
      Delay: 100 milliseconds
      Variable Set String %currLine% from the clipboard contents
       
      If Variable %currLine% Contains "<MESSAGEBOX"
        Text Type (Simulate Keystrokes): <ALT>e // Activate &Edit menu
        Delay: 100 milliseconds
        Text Type (Simulate Keystrokes): <END> // Go to last item on menu
        Repeat Start (Repeat 6 times) // Select "Background Color"
          Text Type (Simulate Keystrokes): <ARROW UP>
        End Repeat
        Text Type (Simulate Keystrokes): <ENTER>
        Wait for Window Title: Color
        Text Type (Simulate Keystrokes): <HOME> // Go to top left corner...
        Text Type (Simulate Keystrokes): <ARROW RIGHT> // Navigate to Yellow
        Text Type (Simulate Keystrokes): <SPACE> // Select Yellow
        Text Type (Simulate Keystrokes): <ENTER> // Done!
      End If
       
      If Variable %currLine% Contains "<COMMENT"
        Text Type (Simulate Keystrokes): <ALT>e // Activate &Edit menu
        Delay: 100 milliseconds
        Text Type (Simulate Keystrokes): <END> // Go to last item on menu
        Repeat Start (Repeat 6 times) // Select "Background Color"
          Text Type (Simulate Keystrokes): <ARROW UP>
        End Repeat
        Text Type (Simulate Keystrokes): <ENTER>
        Wait for Window Title: Color
        Text Type (Simulate Keystrokes): <HOME> // Go to top left corner...
        Text Type (Simulate Keystrokes): <ARROW RIGHT><ARROW RIGHT> // Navigate to Green
        Text Type (Simulate Keystrokes): <SPACE> // Select Yellow
        Text Type (Simulate Keystrokes): <ENTER> // Done!
      End If
       
      Variable Set String %prevLine% to "%currLine%"
      Text Type (Simulate Keystrokes): <ARROW DOWN> // Down to next line of code.
    End Repeat
    MessageBox: All lines checked.

     

    <REPEAT UNTIL Variable="%currLine%" Condition="\x00" Value="prevLine"/>
    <CLIPBOARD COPY/>
    <DELAY Flags="\x02" Time="100"/>
    <VARIABLE SET STRING Option="\x02" Destination="%currLine%" NoEmbeddedVars="FALSE"/>
    <COMMENT/>
    <IF VARIABLE Variable="%currLine%" Condition="\x06" Value="<MESSAGEBOX" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<ALT>e" _COMMENT="Activate &Edit menu"/>
    <DELAY Flags="\x02" Time="100"/>
    <TEXT TYPE Action="0" Text="<END>" _COMMENT="Go to last item on menu"/>
    <REPEAT START Start="1" Step="1" Count="6" Save="FALSE" _COMMENT="Select \"Background Color\""/>
    <TEXT TYPE Action="0" Text="<ARROW UP>"/>
    <END REPEAT/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>
    <WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="2"/>
    <TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Go to top left corner..."/>
    <TEXT TYPE Action="0" Text="<ARROW RIGHT>" _COMMENT="Navigate to Yellow"/>
    <TEXT TYPE Action="0" Text="<SPACE>" _COMMENT="Select Yellow"/>
    <TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Done!"/>
    <END IF/>
    <COMMENT/>
    <IF VARIABLE Variable="%currLine%" Condition="\x06" Value="<COMMENT" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<ALT>e" _COMMENT="Activate &Edit menu"/>
    <DELAY Flags="\x02" Time="100"/>
    <TEXT TYPE Action="0" Text="<END>" _COMMENT="Go to last item on menu"/>
    <REPEAT START Start="1" Step="1" Count="6" Save="FALSE" _COMMENT="Select \"Background Color\""/>
    <TEXT TYPE Action="0" Text="<ARROW UP>"/>
    <END REPEAT/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>
    <WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="2"/>
    <TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Go to top left corner..."/>
    <TEXT TYPE Action="0" Text="<ARROW RIGHT><ARROW RIGHT>" _COMMENT="Navigate to Green"/>
    <TEXT TYPE Action="0" Text="<SPACE>" _COMMENT="Select Yellow"/>
    <TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Done!"/>
    <END IF/>
    <COMMENT/>
    <VARIABLE SET STRING Option="\x00" Destination="%prevLine%" Value="%currLine%" NoEmbeddedVars="FALSE"/>
    <TEXT TYPE Action="0" Text="<ARROW DOWN>" _COMMENT="Down to next line of code."/>
    <END REPEAT/>
    <MESSAGEBOX Caption="All lines checked." Message="All lines checked." Icon="0"/>

     

     

    EDIT LATER....

    There were missing %% on the "Repeat until" command.  

    I fixed that, but it's still not working correctly. 

     

     

  5. Conditional formatting to colorize lines of code based on different properties would be pretty cool.  I thought maybe saving snippets would work too, but that doesn't seem to retain the colors.  Maybe Acantor's script could be adapted to look for properties (like whether the line of code is a message box.)

  6. Others are more knowledgeable than me...  But I will say that your form looks like it can probably be navigated via <Tab>.  It might take extra tabs to get past those little buttons on the right.   So <Paste Variable 1><Tab><Paste Var 2><Tab><Tab><Tab><Tab><Tab><Paste Var 3><Tab><Paste Var 4>  etc.  However, getting your table out of a PDF document, will be a bit trickier.  I'm not even sure how to approach that. 

  7. I'm not seeing this... But I am seeing another (possibly related?) error...

    MEpro 6.1.1.1

    Win 10

     

    I don't use the menu builder, but I did have a couple up sample popup menus built.  I built a couple more. 

    Top of screenshot is one of the new ones and the editor title bar does show "Menu Builder[Name]."

     

    Oddly, the older menu (that was disabled) cannot be opened or enabled...  If I try to do either, I get the error report shown on the bottom of the image.  I've emailed it to ... 

    Bloody hell!  I tried to re-create the error so I could see who I emailed it too, and this time the debugger tool crashed too!  See below image.

     

    Anyway...  The errant menu *does* work if I use the blue 'Run' button from the toolbar.  I can run it -- just can't edit it, or enable it via right-click context menu.  

     

    lW3l3fO.png

     

     

    LJFJe0S.png

  8. One kludgy workaround might be to not have it activated by window title.  Instead just have a link on the desktop.   Then the macro is like:

     

    1 open webpage

    2 wait for window to be active

    3 check boxes and stuff

     

    Then use that link as a shortcut to the website.  It runs only once, only when you click on it.

     

    EDIT: 

    -You can then (optionally) right click the link link and change its icon to look like your web browser.   

    -Also note: As has been pointed out before on this forum, it is usually best to do web checkboxes via TextType <Tab><Tab><Space> rather than MoveMouse, Click, when possible.  

     

  9. Do note that the "EndIf" command does not mean "end the macro if xyz is true."   Rather is marks the end of a logic statement, similar to how "End Repeat" marks the end of a loop.  I suspect that your macro would need something like:

     

    -Set variable to current date/time.

    -Convert variable to decimal

    -IF variable is greater than 6 

    - -IF variable is less than 7

    - -End Macro

    - -End IF

    -End IF

     

    I haven't actually tried this however, so I'm not sure.  

     

    EDIT:  Scratch that.  It's wrong.  Maybe this?

     

    <MESSAGEBOX Caption="Starting" Message="Macro Stated." Icon="0"/>
    <DATE/TIME Format="h" Flags="\xB0" Date="7/29/2019 7:41:26 AM" 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="%timeTexTVar%" IsDateVar="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x04" Destination="%timeTexTVar%" Variable="%timeIntegerVar%"/>
    <MESSAGEBOX Caption="Progress" Message="Variable is %timeIntegerVar%" Icon="0"/>
    <IF VARIABLE Variable="%timeIntegerVar%" Condition="\x04" Value="6" IgnoreCase="FALSE"/>
    <AND/>
    <IF VARIABLE Variable="%timeIntegerVar%" Condition="\x02" Value="8" IgnoreCase="FALSE"/>
    <MESSAGEBOX Caption="Logic TRUE Result" Message="The hour is 6 or greater, but less than 8." Icon="0"/>
    <ELSE/>
    <MESSAGEBOX Caption="Logic FALSE Result" Message="The hour IS NOT 6 or greater, but less than 8." Icon="0"/>
    <END IF/>


    This one checks for a 2 hour time window (6 to 8).  Important:  I'm not sure, but I think it won't know the different between AM and PM.  

  10. Hi All.

    I'm trying to learn to use arrays--which I've never done. 

     

    My experimental setup is as follows:  I have a file on my Desktop called 4MacExp.txt.  It contains four lines.  

    foo
    bar
    bip
    wam

     

    I have a Text Variable called ProcessedFile that is an array variable with 10 parts.  

     

    My (not working) code is as follows:  
     

    <TEXT FILE BEGIN PROCESS Filename="C:\\Users\\SWKunkel\\Desktop\\4MacExp.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%ProcessedFile%"/>
    <TEXT FILE END PROCESS/>
    <TEXT BOX DISPLAY Title="Variable results" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 ProcessedFile[1]\r\n\\par ProcessedFile[\\f1 2\\f0 ]\r\n\\par ProcessedFile[\\f1 3\\f0 ]\r\n\\par ProcessedFile[\\f1 4\\f0 ]\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    
    
    

    My textbox at the end has

    ProcessedFile[1]
    ProcessedFile[2]
    ProcessedFile[3]
    ProcessedFile[4]

     

    It seems like the processed parts of the text file should get saved into the first four components of the array, then get displayed in the textbox like

    foo
    bar
    bip
    wam

     

    It doesn't work though.  I get an error:  

    Undefined variable or the variable is the wrong type
    "%ProcessedFile%"
    Macro Name: ReadWriteIni
    Line Number: 1

     

    I also tried ProcessedFile[] but that didn't work either.

     

    Ideas?  

     

  11. What do you mean by "image recognition?"  Do you really need it to look at a picture and say, that's a house.  That's a tree.  That's a face.  Or is it actually Optical Character Recognition (OCR) that you want?  Or do you actually want to compare multiple images against each other?  Of course ME can't directly do any of that directly, but maybe you could get it to talk to other apps that can.  If you want OCR, there's a pretty cool freebie http://capture2text.sourceforge.net/   I used to have an AutoHotkey script that called Cap2Text.  I'm not sure if you could programatically get information back from it though..  There are free image-comparison tools too.  I don't know if any are automatable though.  

  12. If you want to visually see LTimer's value decrease, then I think you'll need a loop within a loop, where the inner loop shows your countdown once for ever time the outer loop loops.  

    For example  if VarNum gets set to 14, then that LTimer will appear 14 times.  Each time it appears, it will count down from some value between approx. 54 and 57 seconds. 

    Question: Do want LTimer to be reset with a different number 14 times?  Or do you want it to keep using the same start value for each of the 14 loops of VarNum?   

     

    Edit:  Actually... I'm not positive if MacExpPro can even do a loop within a loop (sub-loop).  Experimenting now....

     

    Yes you can.  It hurt my brain a little...  Notice in screenshot, that yellow highlight shows the outer loop.  Everything inside that loop is tabbed over to the right a few pixels.  Then blue highlight shows the inner loop.    At the bottom of the blue section is the inner "End Repeat" and at the bottom of the yellow is the outer "End Repeat".

     

    se7N57j.png

     

    <VARIABLE SET INTEGER Option="\x05" Destination="%VarNum%" Minimum="4" Maximum="12"/>
    <TEXT BOX DISPLAY Title="Current Value" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs28 The variable, \"VarNum\" currently has the value %VarNum%.  \\f1 (BEFORE LOOP)\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
    <REPEAT UNTIL Variable="%VarNum%" Condition="\x02" Value="1"/>
    <DELAY Flags="\x01" Time="1"/>
    <TEXT BOX UPDATE Header="Current Value" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs28 The variable, \"VarNum\" currently has the value %VarNum%.  \\f1 (DURING LOOP)\\f0\\fs20 \r\n\\par }\r\n"/>
    <VARIABLE MODIFY INTEGER Option="\x01" Destination="%VarNum%" Value1="%VarNum%" Value2="1"/>
    <VARIABLE SET INTEGER Option="\x05" Destination="%VarSub%" Minimum="50" Maximum="100"/>
    <TEXT BOX DISPLAY Title="Current Value Sub" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n{\\colortbl ;\\red0\\green120\\blue215;}\r\n\\viewkind4\\uc1\\pard\\cf1\\f0\\fs28 The variable, \\f1 VarSub\\f0  currently has the value %Var\\f1 Sub\\f0 %.  \\f1 (BEFORE SUB LOOP)\\cf0\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
    <REPEAT UNTIL Variable="%VarSub%" Condition="\x02" Value="1"/>
    <DELAY Flags="\x02" Time="10"/>
    <TEXT BOX UPDATE Header="Current Value Sub" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n{\\colortbl ;\\red0\\green120\\blue215;}\r\n\\viewkind4\\uc1\\pard\\cf1\\f0\\fs28 The variable, \"Var\\f1 Sub\\f0 \" currently has the value %Var\\f1 Sub\\f0 %.  \\f1 (DURING SUB LOOP)\\cf0\\f0\\fs20 \r\n\\par }\r\n"/>
    <VARIABLE MODIFY INTEGER Option="\x01" Destination="%VarSub%" Value1="%VarSub%" Value2="1"/>
    <END REPEAT/>
    <TEXT BOX CLOSE Header="Current Value Sub"/>
    <END REPEAT/>
    <TEXT BOX CLOSE Header="Current Value"/>
    <MESSAGEBOX Caption="Done" Message="Macro finished. " Icon="0"/>

     

    This example is resetting VarSub (LTimer, for your purposes) each time the outer loop runs.  If you wanted it to use the same value each time, I suspect you'd need to "hand-off" the value to yet another variable.  Like

     

    Set VarNum

    Set LTimer

    -Begin Outer Loop

    -Set LTimerTemp (make it equal to LTimer)

    -Begin Inner Loop, Loop while LTimerTemp < 1.

    --blah blah

    --Decrement LTimerTemp = LTimerTemp -1

    -End Repeat

    End Repeat

     

    Note that I think it's best practice to use a single Variable Array, rather than a bunch of individual variables...  I'm not really sure how to do that though.   😕 

  13. Ellinarac, I'm curious if Line 62 is working as expected.  It seems like it is going to actually type MacExp code into something(?)  

    <TEXT TYPE Action="0" Text="<UPDATE TEXTBOX Header=\"Current Value\" Content=\"{\\\\rtf1\\\\ansi\\\\ansicpg1252\\\\deff0\\\\deflang1033{\\\\fonttbl{\\\\f0\\\\fnil\\\\fcharset0 Tahoma;}{\\\\f1\\\\fnil Tahoma;}}\\r\\n\\\\viewkind4\\\\uc1\\\\pard\\\\qc\\\\b\\\\f0\\\\fs20 Mining Cycles Remaining\\r\\n\\\\par \\\\f1 %VarNum%\\\\b0\\\\fs16 \\r\\n\\\\par }\\r\\n\"/>\r\n"/>
     

    So it's actually going to send "<UPDATE TEXTBOX Header=\"Current...." to the keyboard, if I'm understanding correctly.  

    As I paste it into this forum post, I'm noticing extra backslaches \\\\ not sure what's up with that.  

     

    Also note:  It looks like you've recorded a bunch of mouse moves and pauses...  Would the macro still work if those were culled-out, or are they needed?  I'm not sure what "cellinarac Atruin" even is, so I don't know if they are needed...  BTW Google thinks you spelled it wrong....   Did you mean: cellinarac Atrium  LOL. 

     

×
×
  • Create New...