Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. *(Someday I'll get up the nerve to learn how to use the registry variables. :) )

    It's really not a big deal! The dire warnings that usually accompany some registry tweak are, IMHO, way over the top! Yes, you can make your machine unusable by changing the wrong registry settings, just as you can destroy all your data by passing a magnet over or near your hard disk. And driving a car is pretty dangerous too!

    I recommend you create a key in the registry, e.g. HKCU\Doreen (that's HKEY_CURRENT_USER\Doreen in long-hand), and save any new keys and values under that key. Then there's no way you can do any damage.

  2. I have done quite a lot of reading on AUtoHotkey but have not used it much yet. From what I see it looks very promising. It's got a very active forum (far busier than this one) and seems to be very powerful. It's a direct descendant of AutoIt v2. And yes, it's got the ability to build GUIs, so you can certainly do menus. In fact, you could almost certainly do pretty well anything Stiletto using AHK.

    It's also got the ability to talk directly with COM objects.

  3. I too use the approach of checking the colour of the X in Firefox. But do be warned that this is not 100% reliable.

     

    I have one site I visit most days for which I have written a script to take me to the page I need to be on, involving passing through 4 other pages first. 2 of these pages work simply by checking the X, one page requires an additional 1 second delay, and one page requires a delay of anything from 0 to 5 seconds. In other words, the X indicates that this last page has loaded, but I must wait longer until I can actually navigate in it - and there's absolutely no visible indication of any change during the wait. It's a mystery to me, but my script works reliably 99% of the time. It's always the 1st visit after I have loaded Firefox that is unreliable (I keep Firefox loaded in memory using Actual Window Minimizer).

  4. I reproduced your two macros (code would have been useful!) and show my results below.

    How delicious! I believe I made exactly the same comment to you only last week! Mind you, in your case you were asking for help, in mine I was simply showing what I'd done. Unfortunately I no longer have the code (I know, I should have kept it :rolleyes: ).

    Yes, I agree these results require some explanation, and, hopefully, more work from Insight.

  5. Well, consider this!

     

    Macro Test1

    Text Box Display: Counter Display (Timed floating box for 10 seconds)

    Delay: 10 seconds

     

    Macro Test2

    Date/Time: Set %t[1]% to the current date/time using "hh:mm:ss" as the format

    Repeat Start (Repeat 1000000 times) (Storing counter in %n[1]%)

    End Repeat

    Date/Time: Set %t[2]% to the current date/time using "hh:mm:ss" as the format

    Text Box Display: (Started at %t[1], Ended at %t[2]%)

     

    Case 1

    If I run Test2 (not with F9!), it consistently takes 17 seconds.

     

    Case 2

    If I insert the command Macro Run: Test2 (do not wait for test2 to terminate before proceeding)

    into Test1, and disable the rest of the macro, it takes a consistent 17 seconds (no overhead).

     

    Case 3

    If I insert the command Macro Run: Test2 (wait for test2 to terminate before proceeding)

    into Test1, and disable the rest of the macro, it takes a consistent 27 seconds (an increase of 59%).

     

    Case 4

    If I insert into Test1 (at the top of the macro) the command Macro Run: Test2 (do not wait for test2 to terminate before proceeding)

    into Test1, and enable the rest of the macro, it takes a consistent 25 seconds (an increase of 47%).

     

    And here's the absurdity. Insert the command Macro Run: Test2 (do not wait for test2 to terminate before proceeding)

    at the end of test1, i.e. after that 10-second pause during which nothing is happening, and the overall execution time remains the same at around 27 seconds! (that's 10 seconds for Test1 plus 17 seconds for Test2).

     

    I think Insight has a lot of work still to do on MEP.

  6. I'm getting consistent results, Terry. Utter garbage! In either macro, the mouse will move varying amounts, never landing where it should, and displaying a result that is manifestly false.

     

    Good find.

     

    Perhaps we shouldn't be so surprised. I still have a Firefox problem where the Mouse Locator utility registers no mouse movement whatever in part of the toolbar area.

  7. The way I read it is that opening the folder creates the window. As you can't be sure how long that will take, you then wait for the relevant window title to appear. Once it's present, you then activate it. If the window doesn't yet exist, then there's nothing to activate, which is the purpose of the waitfor command. I don't see that putting a waitfor command after the window has been activated achieves anything. I do agree with you that opening the folder should (and probably does) activate the window, but a belt and braces approach does no harm, and is good practice, especially with MEP.

  8. 1 Open Folder to "C:\Docs\Downloads"

    2 Delay: 100 milliseconds

    3 Window Activate: C:\Docs\Downloads

    4 Delay: 100 milliseconds

    5 Wait for Window Title: C:\Docs\Downloads

    6 Delay: 100 milliseconds

     

    Well, on my computer (XP Professional SP3), this never works because the window names are wrong!

    My window is called Downloads instead of C:\Docs\Downloads!

    Once I make this adjustment, it works perfectly every time.

     

    And shouldn't lines 5 and 6 precede lines 3 and 4?

  9. I think this is yet another case (pun intended) of needing to resort to AutoIt or VBScript to do real work! But that doesn't work so nicely in ME3 - ME4 gives you seamless integration with several scripting languages.

  10. I wrote a macro to create ExclusionNums.txt to contain 2000 random numbers between 1023663 and 90221448233, each terminated with char(13) and char(10).

     

    I then ran your macro (modified to remove unnecessary commands), and it worked perfectly!

     

    All I can suggest is that you check that the variables you are using are of the expected type, and that the variable %ExclusionFileTrue% is equal to True. I believe I may have read of a bug regarding boolean variables - that might be worth searching for.

     

    Variable Set to ASCII Char 13 to %crlf%
    Variable Set to ASCII Char 10 to %x%
    Variable Set String %crlf% to "%crlf%%x%"
    Repeat Start (Repeat 2000 times)
      Variable Set Integer %num% to a random value between 1023663 and 90221448233
      Variable Set String %output% to "%output%%num%%crlf%"
    End Repeat
    Variable Modify String: Save %output% to "d:\exclusionnums.txt"

     

    Variable Set String set %ExclusionNums% to the contents of d:\ExclusionNums.txt
    Variable Set Integer %ActiveNum% to 17220828
    If Variable %ExclusionNums% Does not Contain "%ActiveNum%"
      Text Box Display: 
    Else
      Text Box Display: 
    End If

     

    <VARIABLE SET STRING Option="\x03" Destination="%ExclusionNums%" Filename="d:\\ExclusionNums.txt" Strip="FALSE"/>
    <VARIABLE SET INTEGER Option="\x00" Destination="%ActiveNum%" Value="17220828"/>
    <IF VARIABLE Variable="%ExclusionNums%" Condition="\x07" Value="%ActiveNum%" IgnoreCase="TRUE"/>
    <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 %ActiveNum% not found\\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <ELSE/>
    <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 %ActiveNum% found\\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <END IF/>

  11. Text Box Display: TextBoxToCopy
    Window Activate: textboxtocopy
    Mouse Move: 50, 50 Relative to Current Window
    Delay: 250 milliseconds
    Mouse Left Click
    Text Type (Simulate Keystrokes): <CONTROL>a
    Text Type (Simulate Keystrokes): <CONTROL>c
    Delay: 500 milliseconds
    Variable Set String %clip% from the clipboard contents
    Delay: 500 milliseconds
    Variable Modify String: Replace "%" in %clip% with ""
    Text Type (Simulate Keystrokes): %clip%
    Text Box Close: textboxtocopy
    Text Box Display: TextBoxChanged
    Delay: 15 seconds

    <TEXT BOX DISPLAY Title="TextBoxToCopy" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 %My VariableA%\r\n\\par %My VariableB%\r\n\\par %My VariableC% \\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
    <WINDOW ACTIVATE Title="textboxtocopy" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <MOUSE MOVE Option="\x02" X="50" Y="50" _PROMPT="0x000A"/>
    <DELAY Flags="\x02" Time="250"/>
    <MOUSE LEFT CLICK/>
    <TEXT TYPE Action="0" Text="<CONTROL>a"/>
    <TEXT TYPE Action="0" Text="<CONTROL>c"/>
    <DELAY Flags="\x02" Time="500"/>
    <VARIABLE SET STRING Option="\x02" Destination="%clip%"/>
    <DELAY Flags="\x02" Time="500"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%clip%" ToReplace="%" All="TRUE" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="%clip%"/>
    <TEXT BOX CLOSE Header="textboxtocopy"/>
    <TEXT BOX DISPLAY Title="TextBoxChanged" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 %clip%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
    <DELAY Flags="\x01" Time="15"/>

  12. 1 Macro Playback Speed: Normal Speed

    2 Get Pixel: Screen Coords: 324,197 into %N1%

    3 Repeat Until %N1% <> %N1%

    4 Get Pixel: Screen Coords: 324,197 into %N1%

    5 If Variable %N1% <> variable %N1%

    6 Break

     

    1) Every If needs an End If command as soon as you have completed processing the If statements

    2) Same with Repeat

    3) Line 4 should place its results into N2

    4) Line 5 will never ever be true

    5) Line 5 should compare N1 with N2

    6) Line 5 needs an End If, probably after line 6

    7) Your Repeat End should probably be after the End If which you inserted after Line 6

     

    I think you have quite a lot of studying of programming, logic and Macro Express to do.

     

    I personally would rewrite the above lines as follows:

    1 Get Pixel: Screen Coords: 324,197 into %N1%
    2 Copy N1 to N2
    3 Repeat Until %N1% <> %N2%
    4 Get Pixel: Screen Coords: 324,197 into %N2%
    5 Repeat End

    The danger with this code is that if, for some reason, the pixel colour never changes, your Repeat loop will never end. I would therefore insert a counter, which, when exceeded, causes the macro to return.

  13. I put programs in my startup macro that would normally be started from one of the registry areas used for that purpose,

    e.g. HKCU\...\Windows\Run and HKLM\...\Windows\Run. I do this because they're easier to access in a macro, and easy to prevent tunning if I want (using my hover technique).

    In my particular case, that's various mouse utilities, a dialogue resizer utility, a drive substitution, Executor, ClipMate, UltraEdit and Firefox (the latter two remaining permanently in memory even when I click their Close buttons).

  14. Part of me (the part struggling to keep my To Do List from expanding uncontrollably) wishes I hadn't seen this. I'll now inevitably have to spend days installing and learning the rudiments of Autoit!

    ;)

    Well, I'm just learning about AutoHotkey

    AutoHotkey

    which for keyboard and mouse automation, appears to be streets ahead of anything else I've seen. Just consider the MEP "Text Type" command, equivalent to Sendkeys in VBA and Send in AutoIt. It turns out AutoHotkey has no less than 5 different Send commands!

    Send

    SendInput

    SendRaw

    SendPlay

    SendEvent

    Here's an excerpt from the documentation which I thought you might be interested in:

    SendInput and SendPlay use the same syntax as Send but are generally faster and more reliable. In addition, they buffer any physical keyboard or mouse activity during the send, which prevents the user's keystrokes from being interspersed with those being sent.

    SendInput is generally the preferred method to send keystrokes and mouse clicks because of its superior speed and reliability. Under most conditions, SendInput is nearly instantaneous, even when sending long strings.

    SendPlay's biggest advantage is its ability to "play back" keystrokes and mouse clicks in a broader variety of games than the other modes.

    We can only dream...

  15. Normally I avoid mouse manipulations like the plague but in this case I have found that they are far more reliable. Also I find that for text fields clipboard pastes for multiple characters are more reliable. The downside is that you need to make sure your fields are always in the correct place.

    Well, I suppose that, having moved your mouse to a "known" location where there was a text field last time you looked :rolleyes: , you could always then take one or more pixel measurements of some other (preferably related) area in close proximity so as to better ensure that the text field hasn't been moved. The problem with this approach is that each different graphics card (and who knows what other variables) will probably require different pixel values.

     

    What a mess we human beings have made of the web. Isn't it really hard to navigate programatically?

×
×
  • Create New...