Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. If I hover the mouse over a blank part of my desktop, I get a hex value of 0x3D9C91 for the colour. This is confirmed by the equivalent AutoIt tool.

    However, Mouse Locator states this equals decimal 9542717. Does anyone agree with this? AutoIt, and Windows Calculator, reckon the decimal value is 4037777. So do I!

    The Get Pixel Color command also returns 9542717.

    Am I missing something?

     

    Curiously, for an all-white area of 0xFFFFFF, everyone seems to agree that this equals decimal 16777215.

  2. I don't think VbScript is being developed any more; you may not care, but it's not going anywhere.

    The problem with any VbScript approach is that it's written by Microsoft, whereas the AutoIt stuff has been developed by a first-class guy who has done this not for money - I know which approach I prefer! I've worked a bit with this developer, and can personally vouch for him - he's first-class.

  3. im not sure that would work...

     

    say he was looking for color 0. say the first pixel he finds is 654321. that does not equal 0 and the macro would stop

    But that was what was requested, n'est-ce pas?

    ... how to stop a repeat if a part of a screen did not contain a certain color pixel
  4. In pseudocode:

    Repeat Until %n1% not equal 0
     Get Pixel at location x, y into %n1%
    End Repeat

    The trick here will be to determine what values x and y should have each time you execute the Get Pixel command.

    If the values of x and y remain the same, then this macro will simply run until the pixel located at x, y is no longer 0. If that pixel never changes, then your macro will run for ever!

    If you want to move along a row of pixels, or down a column of pixels, then you need to add 1 to x or y respectively.

  5. Really? I didn't see any options in the scripting editor that sounded like it would work. If you mean using the IE section to wait for web page to load, that's not really do-able since the website is showing as loaded all the time, the changes I have to wait for are in some type of flash or script or something.

    I was simply addressing the feature you wanted Insight to create for you:

    One thing I think would be really, really useful would be if Macro Express could compare a portion of the screen to a saved image

    which is nothing much to do with waiting for a web poage to finish loading, though it could be used for that purpose.

    You'd need to create a text file of all the colours in the screen portion of interest using the same format as ME, e.g.

    16777215,5387805,0
    1677210,5384001,0

    which would represent an area of 2 rows of 3 pixels.

     

    Then you'd write a macro to compare the contents of this text file against the desired portion of your screen, one pixel at a time (you could omit the commas, though they do help readability).

    I do something similar quite often.

     

    If you're interested in waiting for an IE page to complete, then you should take a look at AutoIt, which contains a user-defined library of functions written specifically for IE (only IE, no other browser). For example you could use this AutoIt code:

    #include <IE.au3>
    $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php")
    _IELoadWait ($oIE, 0, 300000)

    which would load the web page "http://www.autoitscript.com/forum/index.php", and return control to you only when the page has loaded, or it fails to load within the specified timeout of 300,000 milliseconds. I don't use IE myself, so don't know whether this will detect Flash-based activity; but I do know the author of all the AutoIt IE stuff, and would guess it does.

  6. Question: If all file names in a given folder are integers: (How do I get the largest integer folder name or the last file “name/integer” created?)

     

    Macro Description: Using the middle mouse button, individually select and save source files to given folder and name them using integers starting with 0001 counting by step 1 until folder reaches 9999.

     

    Note: The folder will be populated over time as the source files are created one at a time using a hotkey activated by the middle mouse button. Macro needs to continue counting from last integer step folder name!

     

    I'm not sure how to get the macro to always start counting from the last created integer folder name?

    I'm confused as to whether you want to return the largest integer folder name, or the largest integer file name!

  7. This discussion leads to an interesting question. When is it appropriate to use the Save/Restore for variables? I have used these commands successfully, and although they may be limited and/or buggy, they are, in certain circumstances, the path of least resistance.

    Never (except when using MeProc with parameters).

    Save/Restore works perfectly for me when I use Integer or Text variables. Generally, I am flagging whether a condition was met, and then checking the flag with another macro.

     

    I wish I could use Boolean variables in this way, but apparently, they do not work when set in one macro, and read by another.

    Boolean variables work exactly in the same way as any other variable. The trick is specifically to create the boolean variable as Boolean in the macro that needs to access a boolean value.

    For example, Mac1 runs Mac2, then checks if boolean bTrueFalse = True (Mac2 sets bTrueFalse to True or False). Create bTrueFalse as a boolean variable in Mac1, and you'll find this all works.

  8. Ok, so here's my situation. My boss bought this excel addin that asks for a filename, and then after you type in the filename a dialog box opens that allows many choices. Drop down lists to choose items, radio buttons, checkboxes, etc, and then a submit button. you pick all the options you want, and then submit it, wait a few seconds, and the spreadsheet is filled. I then save the spreadsheet based on the name of the file used, concatenating "_processed.xls" to the filename (and stripping the old extension off of it.) So for example if the data file is "test_run.dat" the processed file is saved as "test_run_processed.xls"

     

    First question, Macro expresss [pro] can script this all up with a record and save as macro ability correct?

    You will not be able to batch up all your responses and have them fed to Excel one by one. For example, assume 3 questions, each of which requires a Y or N answer. You can't supply a script containing Y, N, Y and expect that to work.

    MEP will need to recognize a question and then respond accordingly. In order to recognize a question, MEP will need to "see" a window containing that question (i.e. a window named "Enter response" appears [which MEP can probably recognize]; then MEP needs to position itself on the Y or N response button and press it - or type Y or N into the appropriate text box, followed by Enter. I say "probably" because MDI windows, e.g. MS Access, tend not to work well).

     

    Now MEP will need to recognize the next question or input form, etc.

  9. Set the appropriate ME option to allow nested variables (refer to Kevin's response here: Variable Evaluation Level).

     

    Then store the repeat counter into a variable (let's use %n99% in this example), and reference the source variables for %n31% in your repeat loop with:

    Variable Set Integer %n31% to %n%n99%%

    When %n99% is 1, this command sets %n31% to the value of %n1%; when %n99% is 28, this command sets %n31% to the value of %n28%.

  10. IMHO one should never use variable save or restore.

    For the sake of those who are relative newcomers to Macro Express, I think you should modify this statement to reflect the fact that use of the Variable Restore command is mandatory when you invoke a macro with MeProc.exe and wish to pass in parameters, as in Meproc /AMyMacro /VMyString:Now is the time. This runs a macro called MyMacro, placing "Now is the time" in a text variable called MyString.

  11. The problem here is that MEP has various bugs to do with not defining variables properly; I've reported several (e.g. Run Macro in variable fails to recognize any user-defined variables), but none of the problems has been fixed, and I haven't received any feedback from Insight for quite a long time.

     

    Your problem is to do with boolean variables. Take a look at your variables in any macro that calls Black_Test, and you'll see that the variable %IsBlackPixel% is defined as a text variable. You'll have to change that manually, after which your logic should work.

     

    Text and Integer variables don't usually have these problems, but I'm not guaranteeing that!

×
×
  • Create New...