Jump to content
Macro Express Forums

stevecasper

Members
  • Posts

    570
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by stevecasper

  1. I didn't read the whole thing but are you trying to poll a web page? I have, in most cases, given up on actively using a browser and instead use a utility called Downloader. It's a standalone EXE that requires no installation and the usage is simple as shown below. There are many like this but I just want the HTML so I can use it as a variable in MEP to find things or do things with it. The example below downloads the "High Group" list from the SSA every day for validating SSNs. Another nice thing about it is the whole "Wait for" problem with web browsers goes away as you can wait for the file to exist and be ready. And with MEP you can actually use it's appearance as an activation. In this case I actually run it form the Windows Scheduler so even if MEP isn't running on this machine new versions will be downloaded for all the other users on a routine basis.

     

    Downloader.exe -download http://www.ssa.gov/employer/ssns/highgroup.txt C:\IPData\Apps\Macros\highgroup.txt

    Hey Cory,

     

    Somebody on they ME3 board had asked for an easy way to run a macro that would find specific text on a web-

    page, and then the macro would continue differently based on whether or not the text was present on the page.

     

    I had given an example of a macro that would prompt for the text, Select All, save to variable, and then compare

    the prompted text against the contents of the variable. The macro worked fine in ME 3, but erred in ME Pro... but

    only on some web-pages.

     

    And now it looks like that error will be fixed with the new release - Thanks Stan!

  2. I've copied this post from (what should be) the end of the following thread on the ME 3.x forum:

    http://pgmacros.invisionzone.com/index.php...amp;#entry13351

     

    Terry and Steve -

     

    I have used the <CTRL>a technique with Internet Explorer, never with Firefox. On some IE screens I found it is necessary to click once with the mouse, somewhere inside the window, before doing the <CTRL>a. Without the click, nothing gets highlighted and therefore nothing is copied to the clipboard. Depending how the browser screen was built, it might be necessary to click in different areas, say near the top as opposed to the middle, etc.

    Hi Bob,

     

    I hadn't been using Firefox for this macro (even if I had, the macro should still work, though). However, after your post, I felt it best to give other browsers a try. I have duplicated the error in IE, Google Chrome, Firefox, and Opera.

     

    I am clicking in the window before running the macro, and the Ctrl+a is highlighting the entire page. The error is occurring because the macro is not recognizing Text variable %T[1]%, which is just silly.

     

    Steve,

     

    That error about variable type is exactly what I was getting earlier. Yet as you probably saw from my subsequent reply to Stan, a repeat run of the same macro a few hours later did not give the error. This sort of inconsistent behaviour is why I feel that ME 3 Pro is still flakey in the variables area, but without being able to pin it down.

     

    --

    Terry, East Grinstead, UK

    Hi Terry,

     

    I am back after several hours and at first it ran fine, but then I realized that ME 3 was running again (I'd rebooted

    in the mean time). As soon as I suspended ME 3, the error returned. When your macro started working again, are

    you sure it wasn't ME 3?

     

    What really gets me is that the error does not occur if I run the macro within the message box. Just the

    regular web-page. The macro works in Notepad as well. The error seems to be HTML-related, I guess. It's late,

    I'm confused.

  3. Terry and Steve -

     

    I have used the <CTRL>a technique with Internet Explorer, never with Firefox. On some IE screens I found it is necessary to click once with the mouse, somewhere inside the window, before doing the <CTRL>a. Without the click, nothing gets highlighted and therefore nothing is copied to the clipboard. Depending how the browser screen was built, it might be necessary to click in different areas, say near the top as opposed to the middle, etc.

    Hi Bob,

     

    I hadn't been using Firefox for this macro (even if I had, the macro should still work, though). However, after your

    post, I felt it best to give other browsers a try. I have duplicated the error in IE, Google Chrome, Firefox, and

    Opera.

     

    I am clicking in the window before running the macro, and the Ctrl+a is highlighting the entire page. The error is

    occurring because the macro is not recognizing Text variable %T[1]% which is just silly.

     

    I'm going to copy this thread in the Macro Express Pro forum as I think it has grown beyond the scope of ME 3.x

  4. Works perfectly here Steve - and a lot neater than my roundabout method!

     

    Oddly, so far I haven't got it working in ME Pro. Here's my code.

     

     

     

    --

    Terry, East Grinstead, UK

    Hey Terry,

     

    I just now got a chance to look into my macro and experiment with why it isn't working in ME Pro. My first thought

    was that it was a timing issue; and, in fact, it was - at least initially. ME Pro is so fast that it tried to find the required

    text before my computer had been able to complete the Clipboard Copy. So I incorporated a pair of .5 second

    delays (I always start with a big delay and then work my way down).

     

    On the very first run with the delay I got an error. I will be bug-reporting it in a few minutes. The error says:

     

    Script Error

    Date: 1/14/2009 1:55:30 PM

    The following error was encountered:

    Undefined variable or the variable is the wrong type

    "%T1%"

    Macro Name: Find Word

    Line Number: 7

     

    Line 7 is:

    If Variable %T[2]% Contains "%T[1]%"

     

    Here is the macro as it stands:

    <VARIABLE SET STRING Option="\x01" Destination="%T[1]%" Prompt="What Word are you looking for?" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
    <TEXT TYPE Action="0" Text="<CONTROL>a"/>
    <DELAY Flags="\x01" Time=".5"/>
    <CLIPBOARD COPY/>
    <DELAY Flags="\x01" Time=".5"/>
    <VARIABLE SET STRING Option="\x02" Destination="%T[2]%"/>
    <IF VARIABLE Variable="%T[2]%" Condition="\x06" Value="%T[1]%" IgnoreCase="FALSE"/>
    <TEXT BOX DISPLAY Title="Peform \"Yes\" function" Content="This box represents what will happen if the search-for word exists." Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <ELSE/>
    <TEXT BOX DISPLAY Title="Peform \"No\" function" Content="This box represents what will happen if the search-for word does not exists." Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <END IF/>

     

    There is nothing different about this macro and its ME 3.x counterpart, other than the delays.

     

    This was a straight up Copy/Paste from the Editor in ME 3 to the Editor in ME Pro.

     

    I'm going to toy with the script and see if changing the variable names fixes it, but I don't see why it would make

    a difference.

     

    If it matters, I was searching for the word "Mouse" on this very thread. Worked fine with ME 3, erred with ME Pro.

  5. So, the issue here is that when writing Macro2 I'm not getting access to the variable I defined in Macro1. Is that what others are finding?

     

    If so, is that a bug or what you could generously call a design flaw? IOW, that you have to create the variable again in every new macro (with exactly the right name)?

     

    --

    Terry, East Grinstead, UK

     

    Hey Terry,

     

    I had the same problem with a different macro that I posted back a while ago. It would work fine, pulling the correct info when the 2nd

    macro was still just a line or two, but once the macro got complex, macro 2 forgot that the variable it was pulling was a Date/Time variable

    and started treating it as a Text variable. It was inconvenient, but I just went in and defined the variable as a D/T within the 2nd macro.

     

    After that it worked fine.

     

    Honestly, it should have worked without reiterating its definition in the second macro (once defined and Saved/Restored, it should stay

    defined), but that was a work-around that didn't really change the macro, just took an extra step in the building of it.

  6. Any Firefox users around please? I'm sure this must be easy but so far inspiration eludes me! With a Firefox window active, what's the simplest way to count how many tabs are open please?

     

    --

    Terry, East Grinstead, UK

    Hi Terry, the simplest would be to look, count, know.

     

    But using ME... that's a tough one. I would probably try something like this:

    Variable Set String %T1% from Window Title
    Variable Set Integer %N1% to 1
    Repeat Until %T1% <> %T1%
     Text Type: <CONTROL><TAB>
     Variable Set String %T2% from Window Title
     If Variable %T1% = variable %T2%
    Break
     Else
    Variable Modify Integer: Inc (%N1%)
     End If
    Repeat End
    Text Box Display: Tabs Open = %N1%

    <TVAR2:01:06:><IVAR2:01:01:1><REP3:08:000002:000001:0001:1:01:T1><TEXTTYPE:<CONTROL><TAB>><TVAR2:02:06:><IFVAR2:4:01:1:T2><BREAK><ELSE><NMVAR:08:01:0:0000001:0:0000000><ENDIF><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:Tabs Open = %N1%There are Currently %N1% tab(s) open.>

     

    Of course, add delays as necessary. I have not tested this out at all as I don't have FF at work, but even if the code isn't right (I almost never

    build a macro actually works without at least a few trial runs and changes), the idea should work. Oh, and even if the code does work right (fingers

    crossed), it still won't work if two of the same page are open, or two pages with the same title... so good luck :)

     

    Now, if there is an even cleaner way to do it, that would be nice to know.

  7. Hi I'm trying to run a macro that start automatically at 13:00 and then repeats until 10am the following morning. The macro takes 27 mins to run.

    I have set-up and "Other" schedule to start at 13:00 13/01/09 and end at 10:00 13/01/10 with a repeat of every 30 minutes. The problem is that the macro doesn't start automatically, and if I start it manually it doesn't repeat. I have left the default setting of 10secs for checking scheduled macro's and other macro's do seem to work, what's going on?

    That's an interesting problem.

     

    I just built a simple test macro:

    Text Box Display: hi

    Delay 50 Seconds

     

    This macro was set to run at a specific time and to run every 1 minute. I wanted to find out if the 1 minute started when the macro started

    or when the macro ended. My results were consistently neither.

     

    The macro, idealy, was taking 50 seconds to run. I timed it and it was pretty close to that (about 51 seconds, which is an acceptable dev-

    iation considering other tasks and the fact that my computer is sluggish). I then timed how long it took for the macro to run again. It should

    have been either 10 seconds (if the 1 minute started at the beginning of the macro) or 60 seconds (if the minute started at the end). It turns

    out that the macro ran again at 19.xx seconds on each trial run.

     

    Weird to say the least.

     

    A work-around you might look into, though ideally the scheduling should work, would be to incorporate a Repeat Loop that encompasses

    the entire macro. If you want the macro to run over and over and over for 21 hours straight and the macro takes 27 minutes to run, we

    calculate how many minutes are in 21hours (1260) and then divide that by 27 to get 46.666. So you would want to set your Repeat com-

    mand to repeat about 46 times.

  8. Forget the Find command from your browser. It's way easier than that.

     

    Variable Set String %T1% from Prompt
    Text Type: <CONTROL>a
    Clipboard Copy
    Variable Set String %T2% from Clipboard
    If Variable %T2% contains variable %T1%
     Text Box Display: Peform "Yes" function
    Else
     Text Box Display: Peform "No" function
    End If

     

    <TVAR2:01:02:FWhat Word are you looking for?FFCenter:Center><TEXTTYPE:<CONTROL>a><CLIPC><TVAR2:02:03:><IFVAR2:4:02:7:T1><TBOX4:T:1:CenterCenter000278000200:000:Peform "Yes" functionThis box represents what will happen if the search-for word exists.><ELSE><TBOX4:T:1:CenterCenter000278000200:000:Peform "No" functionThis box represents what will happen if the search-for word does not exists.><ENDIF>

     

    Admittedly, I am in a hurry, so may have missed something in the above posts, but I do similar functions all the time (assuming I understood

    correctly), and this is how I do them.

     

    -EDIT (1hr later)

    I've had a minute to look over the original question and the other replies, and I'm still confident that my example should work fine for what you

    are trying to do. Keep in mind that you may need to add delays between the CTRL+A function and the Clipboard Copy command. You might

    also want to consider adding a Mouse Move command to a position relative to the window you're going to copy and a Left Click command to

    ensure the CTRL+A highlights the correct area of the window (I have had trouble with Ctrl+a and tables in web-sites before), but probably won't

    need it.

  9. I ran the following simple macro written in ME 3 60 times. It always behaved as expected:

    Window Activate: Untitled - Notepad

    Text Type: Text1 //Paste "Text1" using the clipboard

    Text Type: Text2 //Enter "Text2" by simulating keystrokes

     

    I ran the same macro written in ME Pro 60 times. 44 of the times it worked correctly; 16 of the times it wrote "Text2" but not "Text1"

     

    There seem to be problems of stability of ME Pro vs. ME 3. See also my earlier post, "Macro responds sporadically or not at all to window gaining focus." Are others experiencing this problem?

    I built the following macro to test whether or not I had similar problems to those you describe.

    Repeat Start (Repeat 60 times)
     Window Activate: untitled - notepad
     Delay: .5 seconds
     Text Type (Use Clipboard and Paste Text): Text1
     Text Type (Simulate Keystrokes): Text2
    
     Window Minimize (Simulate Keystrokes): Text2
    : Untitled - Notepad
    End Repeat

    <REPEAT START Start="1" Step="1" Count="60" Save="FALSE"/>
    <WINDOW ACTIVATE Title="untitled - notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <DELAY Flags="\x01" Time=".5"/>
    <TEXT TYPE Action="1" Text="Text1"/>
    <TEXT TYPE Action="0" Text="Text2\r\n"/>
    <WINDOW MINIMIZE Option="\x01" Title="Untitled - Notepad" Partial="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <END REPEAT/>

    My experience was a very smooth run. After running it as built above, I removed the .5 second delay and

    still had no problems with the macro.

     

    I'm running a pretty fast system: Vista Ultimate 32, SP 1, Intel Quad core 2.6 GHz, 4G RAM, so that may

    be why I can do it without the delay, but even on a slower system the macro should have no problems

    with a built-in delay.

     

    I don't personally understand why the same macro would work on ME 3.x but not on ME Pro, but I don't

    think it is a problem inherent in ME Pro.

  10. Can you run more than one macro in Macro Express Pro if you are calling a Web Site. ( If so how do you do it?)

    Macro Express Pro does allow you to run multiple macros at the same time. This should work even

    when calling a web site. However, it's important to keep in mind how macros work (many macro

    commands just simulate key-strokes or mouse-moves). So if you are trying to have two different

    macros typing or clicking on a web site, you're going to have some complications as one macro

    types/clicks one thing and the other tries to do something else.

     

    Maybe a more specific example of what you're trying to do with your two macros would help us to

    help you figure out if two separate macros would be the simplest and most efficient way to build

    your macro process.

  11. I created a snippet which contains some incorrect code. How do I delete or modify it please? I tried to simply create it again but ME won't let me give the corrected version an existing name.

     

    BTW, the mistake I made is one I make frequently. Is there any way I can change the default delay from 100 seconds to 100 milliseconds?

     

    --

    Terry, East Grinstead, UK

    The intuitive thing (barring the existence of a Right-click Snippet menu with an Edit option), would simply

    to change the code and then "Add to Snippets" using the same name, then selecting Yes on a "Do you

    wish to replace the existing snippet with that name" type prompt.

     

    Unfortunately the prompt simply says "A Snippet with that name already exists."

     

    What happens when you have a bunch of snippets that you thought you would use but then never do,

    or don't need anymore? Your snippet list could get out-dated and unmanageable.

     

    I have not found a way to get rid of the simple one that I created to test this feature (fortunately it's a

    snippet that I may actually use on a regular basis).

  12. The ADD, PROPERTIES, and DELETE button shortcuts in the Variable Tab do not work. You can push ALT+A, ALT+P, or ALT+D OR CTRL+A, CTRL+P, or CTRL+D, but you won't get the desired effect.

     

    ALT+A opens properties (not sure how this happened as there is no A in properties)

    ALT+P opens the Scope Tab (ALT+P also represents the Scope Tab shortcut)

    ALT+D opens the Debug Menu (ALT+D also represents the Debug Menu shortcut)

    I have duplicated some of this, but first the Add window does open with Alt+A. The confusion is that the

    Add window and the Properties window are identical. The only difference is that the Properties window

    should contain the information from an already existing and selected Variable. The Add variable window

    is blank (you can double-check this by manually clicking the Add button to see that the window opened is

    a blank Properties window).

     

    On the other hand, however, I did have the same problem with Alt+P and Alt+D. I would almost suggest

    Alt+A as a work-around for Properties, except that it opens a blank Properties window, not the Properties

    of the selected variable. And I would recommend the "Delete" key on your keyboard as a work-around

    for the Delete function (it works).

     

    Here is a link to the bug-report form:

    http://www.macros.com/bugreport.htm

  13. Wow...

     

    Cory, you are friggin' brilliant!

     

    I've been playing around for a few minutes now with a DoB averaging macro (found the average DoB between my wife and me; among my wife, myself, and our little girl; and the average between all of my brothers). Don't know when I'd ever need this, but it's fun to play with, and gives the Modify command some practical scope.

     

    Though I wasn't actually able to use the Modify D/T command to calculate the average: there is no "Divide" in the Modify D/T, so I had to convert it to decimal and back.

    You just have to think Decimal just like you do in Excel. 5:29PM

    LOL, I just barely found out about the Excel decimal-time relationship... I'm going to need to start learning how to

    think in decimal. I'll definitely take your advice and play with it in Excel... well, I actually don't have Excel, I use

    Sun's OpenOffice.org but it's pretty much the same, so it hopefully has the same decimal-time set-up.

     

    Thanks a bunch for opening my eyes a bit to the power of this new macro command. As I play with it (if I can find

    good, practical reasons to do so) I'll be sure to post here looking for suggestions as I'm bound to hit some brick walls.

  14. I too am having trouble getting anywhere with Date/Time. But in any case it seems to me that ME's Date/Time function is very limited

    compared to say Excel, which would be my obvious choice of application for such calculations. In Excel:

    =INT(A2-A1) would give you the number of whole days between two date/ time values (which you would typically format as Number or General).

    =MOD(A2-A1,1) would give you the remaining time (format with Custom to say hh:mm:ss).

    Interesting stuff, I've never used Excel for time modifications. I'm going to have to play around with that.

    Another stumbling block I encountered while trying to write the following simple macro to subtract two dates was that ME wouldn't let me use the name I'd used earlier but mistakenly assigned as a text variable, even though I'd deleted all commands and started again.

    I had this same problem (discussed at painful length in another post). Turns out you just have to make sure that you've "Added" the

    variable under the correct variable-type.

    (BTW, these new formating features sure do make the Codebox entries here long! Is there any clever forum feature to wrap them?)

    You know, I stopped using the built-in [ codebox ] tags and started using [ code ] tags. There is a little difference, but I don't know that

    it affects the wrap-around.

  15. A minor cosmetic point. With a Comment command selected in the Script Editor, if I use R-click > Set Text Color to change the text colour to black, it also changes the background to black.

     

    Also, Clear Colors on a Comment doesn't change the blue to black as I'd expect. Presumably blue is the default?

     

    --

    Terry, East Grinstead, UK

    Hehe, that's funny.

     

    Easily enough to fix the background color, but I don't imagine it should be changing to black when you change the font color.

     

    Blue is the default, so I would guess that the Clear Colors option isn't so much designed to change the command to black as it is to

    remove any customization the user may have affected.

  16. Ok thanks guys!

     

    Samples.mex didn't install with my download (but honestly, I don't remember if there was a "cusomized" download option in which case

    I may have arrogantly chosen not to download the samples).

     

    I did find the ones on the Shared Macros page, but recognized them as the old ones from ME 3.x.

     

    If there aren't any specific samples for MEP, yet, then I shall forebear.

     

    Thanks again!

  17. Oh, that 12/30/1899 thing is correct. That's the Delphi negative one rule I was talking about. In MS land zero is 12/31/1899 2400 (same as 1/1/1900 0000) but in Delphi zero equates to 12/30/1900.

    Cory, you may just be smart/tech-educated enough to make this Date/Time thing work.

     

    Any chance you could give an example of when a person would want to know what "today at 5:45:01 PM + tomorrow at

    3:42:32 AM" equals? (or any arbitrary dates). I mean, they went to a lot of trouble to create the modify D/T command, and

    God bless 'em for it. I am certain that they wouldn't have done so if there weren't a pretty global desire for it. A basic real-

    world example would probably help me figure out whether or not I would ever need it in my life.

     

    And here all I wanted to do was calculate the difference between two separate times (I know I can build a macro that does it

    using a relatively lot of code, but I was hoping this would do it for me and be easy).

  18. I just realized I don't have any sample Macros on my system. A C: drive search pulls up a few "sample" titles, none of

    which are related to Macro Express. The "Tutorial" menu refers to sample macros, but I wonder if ME Pro has any?

     

    If so, where might I find them? I am pretty sure they didn't download with my copy, in which case, where would I be

    able to get them on the Macro Express website (if possible)?

  19.   12/30/2008 6:52:14 PM 
    + 12/30/2008 6:52:13 PM
    -----------------------------
     1/1/2118 1:44:27 PM

    Confusing!

     

    The best I can figure is the time adds up like time should. 13+14=27. 52+52 = 1:44. 6+6+1(carried) = 13.

    13:00 = 1:00. I was confused by the fact that the result is PM, but then I though that maybe it's really calculating in 24 hr

    time.

     

    6:52 PM is 18:52. So 18:52 + 18:52 = 37:44, right? Subtracting 24 hours leaves us with 13:44 (1:44 PM). Ok so that

    works.

     

    But we've added only 1 day.

     

    (12/30/2008)*2 somehow gives us 1/1/2118.

     

    2008+2008 = 4016, so it's not a direct addition of the years.

    12+12 = 24 (2 years) would bring 2008 to 2010, again, not a direct addition of the months.

     

    I'm at a complete loss as far as comprehending how the Modify Date/Time function works, or in what way its current fun-

    tionality could be of any possible use.

     

    Subtracting is also a joke.

     

       12/30/2008 7:10:41 PM
    -  12/30/2008 7:10:38 PM
    ------------------------------
      12/30/1899 12:00:03 AM

     

    What I thought this command would do is help do calculations of the passage of time. Unfortunately, there is no way to

    capture the time without also capturing the date (Date/Time modifications require D/T variables, which require date and

    time).

     

    This way one could figure out how much time elapsed between one D/T capture and another (which would, admittedly) only

    require the use of the subtract function. I don't know why anybody would need to add one captured D/T to another.

     

    Interesting note: If you subtract a D/T variable from itself, the result is the creepy 1899 date with no time:

       12/30/2008 7:10:41 PM
    -  12/30/2008 7:10:41 PM
    ------------------------------
      12/30/1899

     

    After my tests, I am not convinced there is any actual bug associated with this function. I just don't think I understand what

    its point is. The Help files weren't very useful for understanding function, either. Can anybody illuminate me, please?

  20. Just prior to the release of Macro Express Pro a change was made to the Save/Restore Variables commands. These now only affect Global variables. Make sure your variables are defined as Global before using these commands. The documentation is being updated to reflect this change.

    Hmm,

     

    The Scope of the macros I described above are all set to Global (I rarely change that when testing unfamiliar commands).

     

    The problem, it seems, was simply that a variable (%Start%) was "understood" by Macro 1 to be a Date/Time variable, and

    kept it's identity as such when Macro 2 was very basic. As soon as Macro 2 became a little more complex, Macro 2 decided

    to default %Start% back to a Text variable.

     

    It was a nuisance, but once understood, easily remedied.

     

    Now my concern is that the Modify Date/Time doesn't seem to be working correctly (or if it is, it is very confusing and not

    immediately intuitive).

     

    I will review the help pages in depth, build some different test macros, and if I think necessary, I'll start a new thread or just

    file a bug report.

  21. Hello,

     

    i have tried to import my old macros from Version 3.7. But when i import the old file the new MacroExpress Pro stops working. Then it is no longer possible to click any part of the window. Only the Trayicon remains active and when i exit MEPro and restart it there are none of my old macros.

     

    Does anyone else have this problem?

     

    Best Regards

    Kosti

    Yes, several other posts have addressed this issue. For some people it's a matter of minimizing or Alt+Tabbing to a window

    that is hiding behind ME Pro.

     

    For me, that doesn't help. I have taken to just copying the ME 3.x code and pasting it into an ME Pro edit window. It is certainly

    slower, especially if there are hundreds of macros you need to move over, but it at least works.

×
×
  • Create New...