Jump to content
Macro Express Forums

stevecasper

Members
  • Posts

    570
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by stevecasper

  1. Alright, I have it working the way it should based on the hidden window idea.

     

    Except now I want to have two windows with the same name.

     

    How does the program scope work? Both processes have the same names, but I didn't think the macro would run on BOTH processes even though only one was selected.

    I just tested it and it looks like when you have two windows open with identical names, it will go with which ever one was the one most

    recently "Active."

     

    I opened two notepads, then ran the macro. The window that took the "Hide" command was the second notepad. The first one just sat

    there. So the window that got hidden still took precedence when the macro activated notepad, and so the hidden window took the text

    as well.

     

    I tried having two separate "Hide" commands, so that both notepads would be hidden, and that worked fine. Only one of the notepads

    took the text (the first one opened, this time, since it became the "Active" window when it was hidden - the second notepad opened

    being the first to be hidden). At the end of the macro I set two "Show" commands, but only the notepad that had taken the text

    reappeared. In fact, I couldn't get the blank notepad to reappear until I closed the one that was visible. So that's kind of a problem.

    Not sure how to work that out without some obnoxious work-around command-builds.

  2. Terry,

     

    I'm at work now (work PC is a joke), but I'll be happy to try it as soon as I get home (couple hours). It looks like our systems are pretty

    close to identical (I'm running Vista Ultimate 32 bit is the only obvious difference I see). I was estimating the time it was taking to run the

    macro. Typing it "normally" was screaming fast, though. And using the paste function was so unbearably slow that I actually thought the

    macro had hung up on something, till I ran it on a visible notepad (so I could see that it really was doing the job, just slowly).

     

    Anyway, I'll actually time it and let you know what I find out once home.

    Ok Terry,

     

    I just ran your code on my machine at home, and it completed in 4:26 seconds.

     

    Interestingly enough, when I ran my code ("Macro Express Rules" 100 times), it completed in 3:84 seconds.

     

    Obviously there will be some discrepancy based on my own reaction times, but both instances are pretty dern fast.

     

    When I switch to using the clipboard to paste, my 100 repeats took just over 52 seconds.

     

    Yours, set to paste, took just over 8 seconds.

     

    It's strange that your computer takes so much longer than mine, when our specs are virtually identical. Unless Vista really is that

    much better than XP...

  3. Steve,

     

    I can't answer your question about the significant difference in text processing speed, but I'm sure one of the ME support guys will be able to do so. I haven't used the clipboard method yet, but will experiment some time soon.

     

    BTW, your processing seems much faster than mine. If I've understood you correctly your macro typed 100 lines of "Macro Express Rules", total 1,800 characters. Mine took 24 secs to type 10 lines of 99 (including the variable), just under 1,000 chars. Yours was 5 times faster for about twice the work - a factor of nearly 10 to 1!

     

    Could you run my macro as it stands and tell me how long it takes please? This PC is Intel CoreT 2 Quad Core Q9450 (2.66 GHz, 12 MB cache, 1333 MHz); 4 GB DDR2 667 MHz Memory (although, using XP Pro, not all of it gets utilised).

     

    --

    Terry, East Grinstead, UK

    Terry,

     

    I'm at work now (work PC is a joke), but I'll be happy to try it as soon as I get home (couple hours). It looks like our systems are pretty

    close to identical (I'm running Vista Ultimate 32 bit is the only obvious difference I see). I was estimating the time it was taking to run the

    macro. Typing it "normally" was screaming fast, though. And using the paste function was so unbearably slow that I actually thought the

    macro had hung up on something, till I ran it on a visible notepad (so I could see that it really was doing the job, just slowly).

     

    Anyway, I'll actually time it and let you know what I find out once home.

  4. I like the hiding window idea. Very creative.

    But I accidentally aborted the macro in between, and now the window is hidden.

     

    Is there a way to bring it back without restarting?

    Also, what if I wanted to unhide the window if I decided to abort? Not really sure if abort is simply stop running on the spot, or if there's anything in between I can do.

     

    Yes, this can be a little bit of a problem.

     

    What I would do is create a second macro that is nothing more than:

     

    Window Show: "specific window"

     

    That way if your window gets stuck hidden, you can un-hide it pretty easily.

     

    What I was doing with mine, was actually just changing the Hide command to a Show command, and then running the macro again.

     

    Either way will work.

  5. Hey Terry,

     

    Yeah, I had a similar problem.

     

    I stuck with the "Macro Express Rules" text and had it type 100 times on the hidden notepad, then I periodically clicked on an open

    word processor page (I used OpenOffice.org Writer, but I don't think it would make a bit of difference if I used Word or Word Perfect),

    and the macro continued running, it just happened to finish typing the 100 "Macro Express Rules" into the .odf document.

     

    So I modified the macro to have an "If/Else" clause. Essentially:

     

    If notepad active
     Text type ME Rules
    Else
     Activate notepade
     Text type me rules
    End if

     

    This worked better, but whenever I clicked into the .odf document there was a chance that the macro would already be within the "If/Else"

    clause. Sometimes it worked, but mostly it messed up a little, then went back to the notepad to continue. For most practical applications

    that I can think of, if you mess up a little bit, you've pretty much messed up the whole thing.

     

    However, it could be useful under certain circumstances... just none that I can think of specifically (beyond reading a blog, news page, etc.

    where you don't need to be clicking till after the macro has finished running).

     

    Still, I love playing with macros, so experimenting with this task has been enjoyable.

     

    PS - I've noticed something in the past, but haven't thought twice about it till now. When using Clipboard to paste in Text Type, it is

    considerably slower than having the text typed out normally. The above macro ran in about 5 seconds (give or take) when

    typed normally, but took as long as a minute when using the clipboard function.

     

    Is that because when using the clipboard function in the Text Type command, it is actually using a Ctrl+C type process, including all the

    pre-set delays within Macro Express? I had always assumed that using this function would be faster than typing normally (and I imagine

    it is faster when dealing with extaordinarily long bits of text), since I thought ME just took the information and pasted it in it's own right.

    But it is obviously much much slower, leading me to suspect it is using the outside clipboard to save/paste.

     

    Would manually reducing the delays increase the speed of text-type processes using the clipboard? Not that I necessarily would...

    clipboard commands need those delays, in my opinion (my work PC sucks), I'm just curious.

  6. Hi there,

     

    I'm having issues with my very first macros, and would appreciate some help.

     

    I'm launching an application (it has a message title of "Command Center"). At certain points, it will pop up a window called "Message"... I want to automate an Alt-O in order to clear the message.

     

    My first attempt was very easy, and worked reasonably well:

     

    - Scope, program specific (to my application),

    - Properties, activation based on Window Title ("Message"),

    - And the script itself: Alt key down, o, alt key up.

     

    But then I realized this only works with *modal* message windows. My application sometimes also pops up non-modal message windows which I also want to clear. (It will pop up 4 in parallel, which also seems to confuse things.) And I've noticed that the macros appears to still be executing whenever "Message" gets focused... but sometimes the Alt-O is sent to the main application window behind it, rather than the message window.

     

    What am I doing wrong...? I'm a little confused in terms of how to decide when/where the macros is executing... I tried to change my macros to add a "Activate Window - Message", but that didn't seem to have much effect.

     

     

    I'm not sure what a "modal" message window is, but you should be able to build a macro that can handle them. You just need

    to know what the message window's name is, then you build this script:

    Window Close: "specific window title"

    <WCLS:specific window title>

     

    Just set the macro to activate based on the Window title, and that should make it so that any time the window that you don't

    want is activated, this macro will run and close it.

     

    If several of the same window are popping up at the same time you may need to modify it a little bit:

     

    Repeat Until %T1% <> %T1%
     If Window Title "specific window title" is running
    Window Close: "specific window title"
     Else
    Break
     End If
    Repeat End

    <REP3:08:000002:000001:0001:1:01:T1><IFOTH:04:2:specific window title><WCLS:specific window title><ELSE><BREAK><ENDIF><ENDREP>

  7. Ha Ha!!!

     

    So I just tried another little experiment that worked surprisingly well. Still don't know if this will work 100% for what you need,

    but it is definitely something to check out, IMHO.

     

    It has to do with hiding the window. This worked perfectly. (I have the hidden window re-appear at the end of the macro, for

    simplicity, but I didn't originally... the text type happens while the window is still hidden.)

     

    Window Hide: "Untitled - Notepad"
    Activate Window: "Untitled - Notepad"
    Text Type: Macro Express Rules
    Window Show: "Untitled - Notepad"

    <WHIDE:Untitled - Notepad><ACTIVATE2:Untitled - Notepad><TEXTTYPE:Macro Express Rules><WSHOW:Untitled - Notepad>

     

    Now, depending on how much you have going on in the "hidden" window, if you end up clicking a different window, you may

    change the focus, screwing up your macro... but that will take a bit more experimenting.

  8. I want to open the help menu for some generic application using the F1 shortcut, but I want it to open up when the app is unfocused.

    Sending <F1> to the control ME doesn't seem to work in this case.

     

    When I tried it on notepad, it types <F1> instead.

     

    This example is closer to what I want, but I guess this is also one of the cases where the window itself must be on top in order to run.

    Here's the rough work-around I put together. I also thought about having the window momentarily gain focus, which would be mildly

    annoying, but sometimes you do what you have to do... but then I thought about hiding the window before activating it. I tested it

    on Notepad and also on Internet Explorer, and it seems to work. The only problem is deciding at what point to unhide the window.

     

    Here is my little test macro:

    Window Hide: "Windows Internet Explorer"
    Activate Window: "Windows Internet Explorer"
    Text Type: <F1>

    <WHIDE:Windows Internet Explorer><ACTIVATE2:Windows Internet Explorer><TEXTTYPE:<F1>>

    If I were going to just have the window activate, then go away, I would probably do something like this (depending on how fast your

    system is, this could go very quickly... on my computer (Vista 32, 4GB RAM, Intel Quad 2.6 GH, it screams, I hardly notice the window

    activating; whereas my work computer is XP Prof, 512 RAM, P3 or low-end P4, I can imagine it taking as long as a whole second

    depending on how many other processes are running):

    Activate Window: "Windows Internet Explorer"
    Wait For Window Title: "Windows Internet Explorer"
    Text Type: <F1>
    Window Minimize: "Windows Internet Explorer"

    <ACTIVATE2:Windows Internet Explorer><WAITWIN2:000010:000000:Windows Internet Explorer><TEXTTYPE:<F1>><WMIN:Windows Internet Explorer>

  9. Of course, the very specific thing you mentioned can be done, though it's certainly not what you actually intend to do.

     

    Repeat Until %T1% <> %T1%
     Repeat Start (Repeat 1000 times)
    Variable Set String %T1% "b"
    Variable Modify String: Append %T1% to Text File
     Repeat End
     Delay 5 Seconds
    Repeat End

     

    <REP3:08:000002:000001:0001:1:01:T1><REP3:01:000001:000001:01000:0:01:><TVAR2:01:01:b><TMVAR2:20:01:00:000:000:C:\Users\Steven\Documents\Macros\Macro Test Files\appendtext001.txtF><ENDREP><DELAY:5><ENDREP>

    This will cause Macro Express to add the letter b to a text file 1000 times, then wait 5 seconds before doing it again. It's set to run

    forever (or until canceled). While it is doing this, you can use your computer as you wish, but you won't be able to use any other

    macros.

     

    As far as I can figure, it is a completely pointless macro. I understand your example was simply to give an idea of what you want

    to do, but I hope that my response to your example can help you figure out a work-around for what it is you want to do (or help

    you come up with an idea of something similar but different, that you can figure out or we can help you figure out how to do).

  10. Repeat until N1=34

    Mouse move 123,123

    Get pixel into N2

    If var N2 >=1000

    and

    If var N2 <=1005

    text type F2 F3

    delay 60 seconds

    else

    delay 20 seconds

    (What command do i put here)(this is where i want to put in the counter to add 1 every time it completes the macro)

    end

    repeat end

     

    I have this macro running as intended but i want to add a loop and timer on it. I was reading last night and it says i can

    do it but i just dont know how to. To explain what i want is to add the macro counter on the ELSE part of the macro. So

    that it counts up to a certain number and then the loop will stop. I do understand that i have to put in "repeat width 1" so

    that i will get 01,02,03 etc... What i dont know how is the getting it from 01, 02 and so on.

     

    The help on it was a little confusing.

     

    also does anyone know what the PAUSE command it. I tried the "pause" and "Scroll lock" keys but it just kept going. The

    pause button really helps when testing out programs without having to what for the outside variable to happen.

     

    thanks

     

    MBone

    Add this code after the else (before or after the delay is up to you):

    Variable Modify Integer: Inc (%N1%)

     

    This command will increase N1 from whatever it started out as by 1. Once N1 = 34 your repeat will end (as indicated in

    the Repeat Until command.

     

    You'll probably also want to add a Variable Set Integer %N1% to 0 or 1 before beginning the repeat.

     

    I hope this answers your question. If not, I misunderstood and would be happy to take another crack at it.

     

    PS

     

    The key combination for pausing your macro mid-run is going to depend on your preferences. You can check it by

    selecting:

    Options -> Preferences -> Playback

     

    I have personally never found any use for the "pause" function like that. For debugging, I generally throw a Pause

    Command into the macro itself or use a Text Box Display to help me locate trouble-spots, then once I'm convinced

    the Macro is Working right, I either delete it, or de-activate that command (don't forget to save).

     

    Based on the info in your post, I would build my macro to look like this:

     

    Variable Set Integer %N1% to 1
    Repeat Until %N1% = 34
     Mouse Move Screen 123, 123
     Get Pixel: Under Mouse into %N2%
     If Variable %N2% >= 1000
    AND
     If Variable %N2% <= 1005
    Text Type: <F2><F3>
    Delay 60 Seconds
     Else
    Delay 20 Seconds
    Variable Modify Integer: Inc (%N1%)
     End If
    Repeat End

    Here's the direct editor script

    <IVAR2:01:01:1><REP3:08:000001:000002:0001:0:01:34><MMS2:123,123><GETPXM:2><IFVAR2:2:02:5:1000><AND><IFVAR2:2:02:6:1005><TEXTTYPE:<F2><F3>><DELAY:60><ELSE><DELAY:20><NMVAR:08:01:0:0000001:0:0000000><ENDIF><ENDREP>

  11. Kevin, you rock!

     

    Thank you for explaining the :01: ... and for all the clarifications! I generally am not happy with "it works

    because it works" explanations, so I try hard to figure them out on my own. But I still sometimes reach a point

    where my experiments and experiences stop helping me piece the puzzle together without a little nudge from the

    people who really know it.

     

    Thank you for the nudges! I feel smarter already :)

  12. I'm kind of very lost. I would like to do Scasper's suggestion, but I am not sure what is meant:

     

    Variable Set Integer %N1% to 10\\\\\\\\\\\\\\\\\\\\\\\\\\Sets N1 to 10 (this will cause your list to start on %T10%) What exactly starts at %T10%?

    Text File Begin Process: "textfileprocess001.txt"

    Variable Set String %T2% "<TVAR2:%N1%:01:%T1%\s>" \\\\\\\\\\\\\\\\\I don't know direct editing, what does this stand for (or look like) in scripting editor?

    Run Macro in Variable %T2%

    Text Box Display: Text File Process 001

    Variable Modify Integer: Inc (%N1%)\\\\\\\\\\\\\\\\\ Not sure what this is.

    Text File End Process

    I'll try to clear this up as much as possible, since it's my suggestion that is causing confusion. Some of this is very basic

    Macro Express code, though, so please bear with me. This post is going to be rather long, and specific. Terry is right, the

    Help files really are a good reference for figuring out the most basic commands. But I also like a challenge and I enjoy

    explaining ME in detail, because I often find that as I do so, I learn things I didn't know before (sometimes I suddenly

    understand why something works that I didn't understand before, even though I use it).

     

    An integral part of ME is the storing of information on "hooks" called variables. There are three basic types of variables in

    ME: Text Variables (indicated by a T), Integer Variables (indicated by an N), and Decimal Variables (indicated by a D).

     

    Each type of variable can have up to 99 possible hooks per macro. So, you can have Text Variables ranging from

    T1 through T99; you can have Integer Variables ranging from N1 through N99; and you can have Decimal Variables

    ranging from D1 through D99.

     

    Your indicated list consisted of "red white and blue." Assuming the list is in a list format:

     

    red

    white

    blue

     

    the macro I built for you would start your list by assigning red to T10, then it would assign white to T11, and finally it

    would assign blue to T12.

     

    The macro would work for longer lists as well, up to T99 (89 possible lines of text, since it started at T10, not at T1).

     

    You don't need to know Direct Editor script to make this work. I don't even begin to understand Direct Editor script. I

    just happen to know one particular function for building a macro into a text file that will do what it is you need the macro

    to do. I explained that in as much detail as I understood in my previous post.

     

    I also provided the Scripting Editor text in that post, so you can see what it looks like in the Scripting Editor (what you

    copied into this reply is the scripting editor text).

     

    The problem with running a macro from a Text Variable (which is what you have to do to make my macro work), is that

    the macro inside the Text Variable has to look like Direct Editor script. It's the only way. I looked for a long time

    before figuring that out about a year ago. The thing is, you don't really need to understand Direct Editor script. You just

    need to understand what each part of that command means. I tried to explain that in the original response, too. I don't

    understand more about it than I stated, but it should be enough for you to duplicate it in your own macro, depending on

    your needs.

     

    I will repeat the explanation of each step of this macro, and try do be more specific about what each step means.

    Step 1:

    <IVAR2:01:01:10><BTFBEG:001:000001:000000:C:\Users\Steven\Documents\Macros\Macro Test Files\textfileprocess001.txt><TVAR2:02:01:<TVAR2:%N1%:01:%T1%\s>><RUNMACVAR:2><TBOX4:T:1:CenterCenter000278000200:000:Text File Process 001T10 = %T10%
    T11 = %T11%
    T12 = %T12%><NMVAR:08:01:0:0000001:0:0000000><BTFEND>
    

     

    But in the scripting editor it will look like this:

    Variable Set Integer %N1% to 10
    Text File Begin Process: "textfileprocess001.txt"
     Variable Set String %T2% "<TVAR2:%N1%:01:%T1%\s>"
     Run Macro in Variable %T2%
     Text Box Display: Text File Process 001
     Variable Modify Integer: Inc (%N1%)
    Text File End Process

  13. I don't think this is doable. Macro Express hotkey macros, including those that are triggered by mouse buttons, activate not when a key is pressed, but when a key is pressed and then released.

     

    This is true. However, if you have the appropriate software for your mouse, I believe you could simply re-program the mouse button

    of your choice to the key of your choosing.

  14. This is what I have so far:

    ------------------------------------------------------

    Repeat Start (Repeat 10000 times)

    If Ping Successful: "www.yahoo.com"

    Else

    Web Site: http://www.jackalwireless.net/hotspot/index.php [Default Browser - Wait to load]

    Macro Playback Speed: Normal Speed

    Mouse Move Screen 854, 198

    Mouse Left Button Down

    Mouse Left Button Up

    Delay 6869 Milliseconds

    Mouse Move Screen 1010, 13

    Mouse Left Button Down

    Mouse Left Button Up

    Delay 3444 Milliseconds

    Mouse Move Screen 898, 745

    End If

    Repeat End

    -----------------------------------------------------

    I think you've just about got it. What you'll want to do is one of two things:

     

    1) This will ensure the macro runs over and over ad infinitum until you manually cancel it:

    Repeat Until %T1% <> %T1%
     If Ping Successful: "www.yahoo.com"
     Else
    Web Site: http://www.jackalwireless.net/hotspot/index.php [Default Browser - Wait to load]
    
    // Here you you will put your macro commands to log you back into your service.
    
     End If
    Repeat End

     

    <REP3:08:000002:000001:0001:1:01:T1><IFPING:00005:www.yahoo.com><ELSE><HTTP2:1:T:http://www.jackalwireless.net/hotspot/index.php><REM2:><REM2:Here you you will put your macro commands to log you back into your service.><REM2:><ENDIF><ENDREP>

     

    By telling the macro to repeat until %T1% does not equal %T1% you're essentially telling the macro to repeat forever, because T1,

    obviously, will always equal T1.

     

    2) Or you could drop the Repeat altogether and just set the "If/Else" statement macro to activate on a schedule (rather than with a

    hotkey or shortkey. Set the schedule for every, say, 5 minutes between the hours of 6:00am through 9:00pm (or indefinitely).

     

    If you stick with the Repeat option, you might want to add a Timing delay before the Else command, otherwise the ping will go out

    very rapidly as the macro repeats. This may or may not affect your performance (I honestly don't know).

    What I'm getting with the above script is just constantly acting as if the ping is unsucessful. Every 30 seconds the browser is opened up,

    the website gone to, and the button clicked, whether I have internet access at the time or not. So, basically, I don't know what I'm

    doing wrong with the above.

     

    Again, any help would be greately appreciated.

    As far as the "Else" being triggered, even when the Ping should have been successful, you may want to consider increasing

    the If Ping Successful maximum time to wait (the default is 5 seconds, but maybe 15 seconds would be better for your situation).

  15. I have developed a little macro for creating text macros on the fly. It works by automatically generating a new ShortKey macro

    that types out text.

     

    Once triggered (by hotkey), the macro prompts the user for two things: a word or phrase; and the ShortKey associated with that

    word or phrase. These values are stored as text variables.

     

    Then the macro launches the Macro Express editor, and manipulates the user interface to do the following:

     

    1. Pick the Category in which to keep the macro.

    2. Add a new ShortKey macro.

    3. Give it a nickname (based on the ShortKey).

    4. Generate the script.

    5. Save the new macro.

    6. Close the Macro Express editor.

     

    This macro is more reliable than it has any right to be, given its complexity. It takes about 5 seconds to generate. The macro

    works, although I am very aware of all of the ways that it could be made to fail.

     

    As a way to increase its reliability, I am wondering whether it is possible to perform the above steps without opening the Macro

    Express editor. For example, is there a way that I could get Macro Express to write all of the above information to a file, and then

    import that file?

     

    I've built similar macros for my mother-in-law and my wife who both work from home and don't have a programming bone to share

    between them, but Macros make their lives so much easier. Their job function is such that they need to create new macros that are

    essentially identical to all the others they use, just with different contents, and for sanity reasons (not to mention travel to go to my

    in-law's) it made more sense to build a macro that they can run which will gather what is needed for the new job-macro.

     

    The only way I've been able to do it, and possibly the only way at all, is to have the macro go through the same steps you would

    normally go through manually. I just make sure that they are aware that once they have put in all the information and the macro

    is being built, they don't touch anything. In fact, I have a text box pop up asking them not to touch anything until the window

    disappears.

     

    If there is a way to have a macro be built secretly in the background, I'm not certain it could be done with ME alone. But I'm not

    completely positive. Anybody else have any ideas?

  16. I am trying to use the cntrol key when i do the capture of a macro. I capture everything but the control press. Is there a way to

    do this with out having to go back and manually add it where i need it?

     

    Mbone

    I think you said you did this, but I want to be clear:

     

    Text Type: <CTRLD>
    Mouse Left Button Click
    Text Type: <CTRLU>

    <TEXTTYPE:<CTRLD>><LCLK><TEXTTYPE:<CTRLU>>

     

    If so, you might want to provide more information about your system, as there may be a compatibility issue. You may even need

    to contact Insight Support.

     

    I can't think of any function I have on my system where Ctrl+LMB is used, so I can't test the functionality to make sure it's working

    on my computer.

  17. When Vista originally was released, this command did not work. We made a change to fix this in a subsequent release of Macro Express. It looks like something has changed in Vista again that breaks this. We'll take a look at this and add a fix in the next release.

     

    For now, here is a low tech solution that will toggle the sound on or off.

     

     

    Move Mouse to Tray Icon: "Volume"

    Mouse Left Button Click

    Delay 250 Milliseconds

    Text Type: <ALT>m<ESC>

    Thanks Stan!

  18. I haven't tested Namino's method yet, but I'm going to very soon. I always prefer elegance to cleverness

    in my macros.

     

    I like it. I'm not particularly proficient with ACII Characters at this point in my macro-life, so I'm uncomfortable

    enough to not attempt them when trying to help other people, and yet this particular solution is, indeed, elegant.

     

    I just compared it mentally to the process I mentioned in my last post (the file that required 20+ variables), and

    I don't see any reason why this method would not be equally effective.

     

    In some ways it would be more effective: You wouldn't need to start at T10, for one thing.

     

    However, it may be less effective in other ways: If your list was made up of lines of text which include commas,

    for example, I'm not sure how that would effect the process.

     

    I guess that could be fixed by adding a bit more code: An "If Variable" statement such as "If Variable %T1%

    contains ',' then Replace ',' with '","' in %T1%".

     

    Like this:

    If Variable %T1% contains ","
     Replace "," with "","" in %T1%
    End If

    <IFVAR2:1:01:7:,><TMVAR2:21:01:00:000:000:,","><ENDIF>

     

    And this would need to be done before replacing %T95% (the CRLF) with "," (otherwise you'd screw up the whole

    thing). At least that's how I imagine it would work. Haven't tested my theory yet, but it looks right to me.

     

    Heck, you could probably just do away with the "If" statement altogether. If your text already has commas in it,

    you probably want them there, so drop the "If" statement and just throw in the Replace code.

  19. Namino's method is elegant and Scasper's is very clever and both have taught me some new things.

    But I think if I was doing the task from scratch myself I'd have just taken the most direct and (to me)

    intuitive approach.

     

    <REM2:RedWhiteBlue - an intuitive but inflexible method><BTFBEG:001:000001:000001:C:\Docs\SUNDRY\Macro Express\Test01.txt><BTFEND><BTFBEG:002:000002:000001:C:\Docs\SUNDRY\Macro Express\Test01.txt><BTFEND><BTFBEG:003:000003:000001:C:\Docs\SUNDRY\Macro Express\Test01.txt><BTFEND><TBOX4:T:1:CenterCenter000278000200:000:ResultT1 = %T1%
    T2 = %T2%
    T3 = %T3%
    ><MRETURN>

     

    This assumes, of course, that the text file has only a smallish number of lines, say 10 or fewer. In practice

    I expect the file would be larger and probably of unknown length. In that case I think it should be easy

    enough to add a Repeat loop containing a Run Macro in Variable command.

     

    --

    Terry, East Grinstead, UK

     

    Hey Terry,

     

    The simplest solution is often the best, and the most intuitive, too. I originally had a macro that was very

    similar to the example you give, but it was insanely cumbersome for what I needed. As you point out, the

    simple intuitive method isn't practical for longer files. I was processing a file of over 20 lines, each needing

    it's own variable. The macro was unbearably long. Discovering the Run Macro in Variable command

    smoothed my code out too sweetly not to share it whenever I can :) (I just wish I understood more of the

    Direct Editor code. That would, I'm sure, expand my ability to really make my macros sing and dance.)

     

    I haven't tested Namino's method yet, but I'm going to very soon. I always prefer elegance to cleverness

    in my macros.

  20. Hi I am using the Text File Process feature, and I would like to assign each loop to a new string variable.

    For example, I have a text file with three lines (i.e. red, white, and blue) and would like to assign these

    colors to variables T1, T2 and T3, respectively.

     

    Is there anyway to do this?

     

    Thank you.

     

    Are you trying to assign the colors to the Text Variables? Or just the words "red", "white", and "blue"?

     

    To assign colors, you may need to assign the hex number for the colors to the variable... but I'm not completely

    sure that's what you're actually trying to do.

     

    If, instead, you have a text file that looks like this:

     

    red

    white

    blue

     

    and you simply want your variables set up as: "%T1% = red", "%T2% = white", and "%T3% = blue", then

    the answer is simple in an advanced, and sort of complicated way:

     

    Variable Set Integer %N1% to 10
    Text File Begin Process: "textfileprocess001.txt"
     Variable Set String %T2% "<TVAR2:%N1%:01:%T1%\s>"
     Run Macro in Variable %T2%
     Text Box Display: Text File Process 001
     Variable Modify Integer: Inc (%N1%)
    Text File End Process

    <IVAR2:01:01:10><BTFBEG:001:000001:000000:C:\Users\Steven\Documents\Macros\Macro Test Files\textfileprocess001.txt><TVAR2:02:01:<TVAR2:%N1%:01:%T1%\s>><RUNMACVAR:2><TBOX4:T:1:CenterCenter000278000200:000:Text File Process 001T10 = %T10%
    T11 = %T11%
    T12 = %T12%><NMVAR:08:01:0:0000001:0:0000000><BTFEND>

     

    First I created a .txt file that is simply:

     

    red

    white

    blue

     

    and I saved it to my C: drive (I have a folder specific for testing macros). This macro does the following,

    step by step:

     

    • Sets N1 to 10 (this will cause your list to start on %T10%... for some reason I've found that this kind of
      process tends to fail if you start with a single digit Text Variable, and advances into double-digits, so I
      recommend starting no lower than T10).
    • Then you begin the text file process which scans your saved .txt file and places the first line into the
      selected variable (for simplicity's sake I have put mine in T1).
    • Next I create a macro within a variable (this is the part that says:
      Variable Set String %T2%"<TVAR2:%N1%:01:%T1%\s>" )
      There are a lot of resources about this... I don't understand the half of it. However, I do know that this
      process works. I put my macro within the text variable T2, and here is what that means (as much as I
      understand of it, that is):
       
      TVAR2 is code for "T" or Text Variable.
       
      %N1% indicates the value within N1, in this case N1 = 10,
       
      so "TVAR2:%N1%" is code for "%T10%".
       
      :01: = I have no idea
       
      %T1% is the code telling this macro what value to assign to %T10%.
       
      So, in other words, the macro within %T2% will assign the value (contents) of %T1% to %T10%.
      Hence, when I run my process for the first time, T1 will be "red", then the macro within T2 will assign "red" to T10.
       
      At this point, the macro within %T2% is created, but has not yet run (this "macro within T2" could technically
      be set at any previous point in the macro, I just happened to put it immediately prior to the code that runs it...
      the next step).
       
       
    • Now I run the macro that I put within variable T2.
    • At this point, my test macro will open a text box which gives me a running commentary of where I am
      in the process (completely optional, but useful for debugging).
    • Next, I increment the variable N1. Because N1 was originally equal to 10, I want the next item on the list
      to be assigned to T11, not T10... otherwise what was the point, right? So I increment N1 from 10 to 11.
    • Finally, I end the text file process, which is similar to a Repeat End command in that it starts the process
      over on the next line in the text file and will continue doing so until the list has been completed.

     

    Clear as mud? If any of this made sense to you... you're either way smarter than me, or I'm better than I

    thought. If you need clearer explanations, please don't hesitate to ask. I can try to do better, or (hopefully)

    somebody who is way smarter than me can do a better job of explaining it.

  21. Also, if you can figure out how to use the Wait For Web Page command, it might be better, because then you

    won't have to build a loop.

     

    This is what I'd recommend, too, but that will only work with IE (and even then it sometimes doesn't work right

    with IE 7 + Vista 32 - possibly other systems, as well, but I've never had a problem with IE 6 + XP Prof, nor

    IE 7 + XP Home with SP2 or SP3).

     

    If you don't use IE, the next best thing would be "Wait for Window Title to Appear".

  22. Here's what I'm trying to do.. Reply to an email, new window pops up. The 'title' will always be different since it's the subject of the email. Copy a piece of that email, switch to another program, run a command with that copied piece. Switch back to the reply and paste some text.

     

    I've got everything down but switch back to a window that changes it's name all the time. I can't put in a command to switch to "window X" since the name will be different. Here's what I've come up with. First, save the window name as a variable, do the other stuff, then use that variable for a window name to switch back to. Problem is, how? :)

     

    You are right on what to do. Here is how:

     

    // When you have the reply window open, set the variable to the Window Title
    Variable Set String %T1% from Window Title
    // Do other stuff with your macro
    // When you're done with the other stuff, recall the Variable you set to the window title
    Activate Window: "%T1%"

     

    Here is the Direct Editor Script

     

    <REM2:When you have the reply window open, set the variable to the Window Title><TVAR2:01:06:><REM2:Do other stuff with your macro><REM2:When you're done with the other stuff, recall the Variable you set to the window title><ACTIVATE2:%T1%>

  23. Thanks Scaspar, Kevin, Cory and all,

     

    Terrific examples! Terrific ideas. I think the text file(the last one) might be the best way to go especially if you use a Window cleaner that cleans out the %TEMP% files as Kevin mentioned and the SAMPLES have as an example.

     

    The only thing I am curious to know is the registry idea that Cory mentioned.

     

    Would anyone(including Cory) like to chime in on how to write it to the registry?

     

    Thanks!

     

    Pat

     

    I, too, would like to know more about writing to the registry without messing up my system.

×
×
  • Create New...