Jump to content
Macro Express Forums

kunkel321

Members
  • Posts

    214
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by kunkel321

  1. I'm not knowledgable about decompiling image files, But I'll take a stab at the looping idea... THere is an ME function called "Get Pixel Color" (let's apprev it with "GPC") where you put in the coordinates of the pixel you want to evaluate. As an example, lets say my computer screen is 1000 pixels wide and 800 pixel high (i.e. resolution is 1000x800). If I have my "GPC" command (cmd) set to look in a "Specific Coordinate Relative to Screen" and I use the values X=1, Y=1, then it would return the color value of the pixel in the top/left of the screen. At X=1, Y=800, it's on the bottom left corner. X=1000, Y=800 is the bottom right. X= 500, Y=400, is approximately the middle of the screen. Note that the GPC cmd returns the color value by placing it in an Integer Variable. Let's put it in N1. Note also, that you can dynamically assign the "X" and "Y" using ADDITIONAL integer Variables. Let's make X=%N24% and Y=%N25%. There's a specific color you want to look for... Let's use the example "16777215," which the ME Mouse Locator tool is telling me is the background color of this text field I'm typing into.... Let assign N2=16777215. At this point we have N1 is the color that the GPC cmd is assessing. N2 is the target color to compare it to. N24 is the X coordinate of the GPC location and N25 is the Y coord. We’ll create a macro that systematically checks each of the pixels one at a time, going left-to-right on the top row, then drops to the second row and repeats left-to-right until we get to the bottom-right corner. We’ll do this by creating a loop within a loop. The first loop will increment X by “1” until it gets to “1000,” then start over. This will be imbedded in another loop that increments Y by “1” until it gets to “800” then the entire screen will have been searched, pixel-by-pixel. (For now we’ll just do the loop—then we’ll add the GPC assessment. So the code is: Set N24=1 Set N25=1 Loop until N25 = 800 N25 = N25+1 //this part gets played 800 times, once for each row. Loop until N24=1000 N24 = N24+1 //This part gets played 800,000 times, once for each pixel. Repeat Loop Repeat Loop =============== Note: The loop thing has to make sense before the following will makes any sense… ================ There’re two more important parts. 1. We have to compare each pixel (i.e. N1) with the target color (i.e. N2). We’ll use the GPC cmd to capture each pixel. 2. We need to do a mouse click or some other command, then to stop (break) the loop if we find the desired color. We’ll do this with an “IF” statement. So the code is Set N2=16777215 Set N24=1 Set N25=1 Loop until N25 = 800 N25 = N25+1 Loop until N24=1000 GPC at coordinate N24,N25 and save to N1 IF N1=N2 THEN click the mouse or some other command… BREAK from loop //macro ends ELSE N24 = N24+1 Repeat Loop Repeat Loop I think the point Cory was making is that if the thing you’re looking for is only one pixel in size, you’ll need to assess each of the (in our example) 800,000 pixels. HOWEVER, if it’s the size of an icon, then the target patch of color might be 10x10 pixels in size. If that’s the case, you could safely skip, only assessing every fifth pixel, and not have to worry about accidently “jumping” over it and missing the taget. If the color patch is 5x5 pixels, then assessing every 4th pixel should be safe. Having “N=N+1” increments by one, so “N=N+5” increments by 5. If incrementing by 5, you'd only have to assess 1000/5=200 pixels by 800/5=160 pixels for a total of 32000 pixels (which is only 4% as many). If any of you gurus see any errors or can clarify, then please do so…. =========== Question for the gurus: If you where looping until N24=1000, but then were to increment such that N24 never actually equaled exactly “1000,” Would the loop still terminate once N>1000???? -steve
  2. My thought with the loop is that if the macro will reliably work on the second time through, then some action (or sequence of actions) must occur the first time through that makes it so the macro can 'see' it. If this action (or sequence) is inside the loop, then maybe the macro would fail the first time through the loop, but would work the second time through(??) This may well be an incorrect assumption though... Hmmm... Surely one of the If Control commands is the ME equivalent to this.. I've used the "Snap to..." Windows option in the past. As I recall the control that is "active" in this sense, can also by chosen/clicked by simply pressing the <Enter> key. Also don't forget the you can <Tab> <Tab> <Tab> through most Windows forms, then <Enter> to select the desired control.... Have to run off to work. Good luck!
  3. Maybe this is already possible? I've had several times when I put a <Ctrl Down> in my code and forget to follow it up with a <Ctrl Up>. I'm careful not to do this, but it still happens occasionally. When it does happen it's inevitably during some high pressure moment at work. I'll run the macro, then a few moments later try to use my keyboard and it'll start doing some crazy junk like opening dialogs or deleting things. The question then becomes, "how much damage will I do to my documents before I realize what I've done?" The answer is often, "Quite a bit!" Please consider "Steve-Proofing" Macro Express. I propose that, durring a Save operation, the ME Editor ALWAYS scan a macro's code for any Ctrl, NumLock, Alt, or Shift -down commands that are left unresolved. When you try to save the macro, perhaps it could through up a warning dialog: WARNING You have left the %% Key in a down position! [Continue with save] [Cancel] [Go to Last<%% Down> Command] Thanks for considering this -steve
  4. I think your question might be a bit over my head (especially since I'm unfamiliar with Illustrator or FLASH) but I thought I'd throw out some thoughts.... As you've said, not all controls can be read by ME. (At work our main database is FileMakerPro which runs in a JavaRun time and the controls are invisible to ME -- very annoying!) I believe that if ME *can* see the control when you're building the macro, then it should *always* be able to see it. THat is, the control won't assume properties at runtime that will make it invisible to ME. (you gurus please correct me if this is wrong!). THerefore your problem is caused by something other than a control problem--per se. Iv'e had similar things happen and been able to remedy it with "wait fors" and and "delays." For example: (I'm assuming that the control you're talking about is a pop up dialog that the FLASH application needs the user to respond too.) Note the window title of the dialog, and have: 1. Do the text manipulations that you already have 2. Then do a "Wait for Text" command (this will cause ME to wait until the keyque is done before it does anything else.) 3. Then "Wait for Window Title to be Active." 4. Then "Delay 250 milliseconds. 5. Then "If Control C1 Visible." and so on ... Is it possible that when you're running the macro, somehow the FLASH application is shut down or dormant? THen you execute the macro, but it gets to the "IF Control," but the app is still loading, so then you get an error message? I think this is not the case because you said you 1. shut down FLASH, 2. restarted FLASH, 3. The macro errored. However this *would* explain why the macro would work the second time it's run, but not the first.... Other thoughts... -ME has a variety of "Launch Program" commands. Consider a 'Launch FLASH' command at the beginning of the macro. -The workaround I use for FileMakerPro is to just do a 'move mouse' and 'mouse click' on the screen (relative to active window) instead of finding the control. THis works on standard dialogs if the message on the dialog is static (and hence the size/shape of the dialog doesn't change). I find that (assuming I have the timing down) it is very reliable. Windows are much easier to work with then controls. -Maybe a loop... 1. You text manipulations. 2. Loop until T1<>T1. 3. If Control C1 Active THEN Click C1 Break from loop. 4. Loop. and so on.... -steve
  5. Another workaround might be to setup a hotkey that's conveniently located near (but doesn't conflict with) your flight controls... The hotkey would be for a macro that simply turns off your NumLock. If you ever think you might've accidentally bumped the NumLock, or left it on, just quickly hit the hot key. YOu could even scope it to only work when your simulator was running .... Also, you could have it with dual activation: the hot key, or the window title of the application (THough I'm not sure if you can activate a macro with the presence of a window/application and simltaneously scope it for when the window/application is already funning ??? ) -steve
  6. How does the webpage 'tell' your macro the correct amount of time to wait? Do the contents of the webpage actually change in someway after the elapsed time? I think MacEx can "watch for" changes in a webpage by using "get pixel color."
  7. I could probably do part-time beta testing too, only if you really need 2007 folks. My Resume: -Excel 2003; tons of experience, some of it with VBA. -Excel 2007; quite a bit of experience, a little with VBA. -Windows Vista; Just got my first Vista machine, still learning, but it's pretty similar to XP. Okay with reg tweaks, etc. -General Geek time; painfully too much--only for the last 10 years though. (You have to be a 20-year geek before you're an "UberGeek," right?) Currenlty running Vista and 2007. Only looking to volunteer part-time. -steve
  8. Hi Developers, On this other thread http://pgmacros.invisionzone.com/index.php?showtopic=2940 we've been brainstorming ways to integrate a receiving text variable into a loop. This quote sums it up well: Hi Blopib and Developers, I too, was surprised when I realized this wasn't possible. Compared to some of the things MacExp is capable of, this actually seems somewhat basic. I suspect that there might be some limitations in the Win32 platform that have prevented MacExp from having this feature. If not, please consider it for your "features to add" list. Thanks.
  9. Hi again Sun, Well it took quite a bit of tinkering, but I've been meaning to learn about .INI files anyway so... Note that I'm far from a computer expert, but I'll explain as best as possible how I got this thing to work, and maybe you or others can built on the info... First you need an .ini file. This is a system file, so none of your text editors will have a "Save As INI" option. Nevertheless, I was able to use Notepad and simply Save As a plain old txt file, but I *named* it "MyINIfile.INI" and Windows XP seems to have excepted the change in extention. By putting my browser on View = Details with the Extention and Name collumns showing, I was able to confirm that it's named "MyINIfile" and is of type ".INI" For simplicity, I saved it at C:\Program Files\Macro Express3\MyINIfile.INI. The next step is to prepare the INI with the appropriate skeleton. For my example, use the following (i.e. everything between, but not including, the double lines) ================ [MySection] param1= param2= param3= param4= param5= param6= param7= param8= =============== Note that the INI should open right up in Notepad. If it doesn't try "open with"(?) Now paste this into a macro with Shortkey activation = ##<MyShortkey>. <IVAR2:01:01:1><REP3:08:000001:000002:0001:0:01:9><REM2:Note: To repeat 160 times, set this to "Until N1 = 161".><TEXTTYPE:<ARROW UP><HOME><SHIFTD><END><SHIFTU>><REM2:Move to and select line that is right above cursor.><WAITPB><REM2:Wait for the key que.><CLIPT><TVAR2:01:03:><REM2:"Cut" the selected text and save it to T1.><TMVAR2:18:01:00:000:000:C:\Program Files\Macro Express3\MyINIfile.INIMySectionparam%N1%><REM2:First we assume there is an .INI file waiting for us... See Help section.><REM2:Send the text from T1 to the .INI file.><REM2:It is saved to whatever key number var N1 is durring loop.><NMVAR:01:01:1:0000001:2:0000001><ENDREP><REM2:After looping "Repeat Until" number of times Excel is launched><REM2:Make sure the path is correct. ><LAUNCHYES3:0:0112Microsoft Excel<LAUNCH:C:\Program Files\Microsoft Office\Office12\EXCEL.EXE><WAITWIN2:000010:000000:Microsoft Excel><REM2:The first loop saved to the .INI file... Now this loop will read from it.><IVAR2:01:01:1><REM2:Reset N1 to 1 so we can increment it again.><REP3:08:000001:000002:0001:0:01:9><TVAR2:01:08:C:\Program Files\Macro Express3\MyINIfile.INIMySectionparam%N1%><TEXTTYPE:Item %N1% is: %T1%.><WAITPB><TEXTTYPE:<ARROW DOWN>><WAITPB><NMVAR:01:01:1:0000001:2:0000001><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:Macro Finished.> Now go to Notepad, Word, etc and type 8 lines (that are separated with carriage return/new line/<ENTER>) and then hit <ENTER> (so that the cursor is below the list) and type your Hotkey. So it looks like this (but without the double lines) ================ This here is my list of 8 items ##<MyShortkey> ================ The macro has two loops. The first one progresses up the list (and increments N1), saving each line to the INI Key named "param%N1%." The second loop starts at 1 again and *reads* from "param%N1%." Obviously this sample uses 8, but it should work the same with a list of nn items and nn number of Keys. Note: I was hesitant to even try this, because I was afraid that MacExp would have to open the INI file, read/write the variable to the key, then close the file again for each loop. This does not appear to be the case.. The reading and writing apparently are done covertly. *However* The macro does take at least 8 or 10 seconds to execute. I suspect this is because the read and writes don't just happen in RAM, they need to access the Hard drive. This makes it take a long time-especially the 'read' part in the second loop. If your people at work have old computers that haven't been defragged in a while, 160 loops could take quite a long time. I'm not sure, but if you use T1, T2, T3 and T4, like you were originally suggesting, it might help because the hard drive would only have to locate the file once per 4 items (?) The loop would be something like: ======= Set N1 =1 Loop until N1 = 160 Get and copy data Save to T1 From T1 to INI key = %N1% Increment N1 + 1 Get and copy next data Save to T2 From T2 to INI key = %N1% Increment N1 + 1 Get and copy next data Save to T3 From T1 to INI key = %N1% Increment N3 + 1 Get and copy next data Save to T4 From T4 to INI key = %N1% Increment N1 + 1 Repeat loop. This still not the solution that I think you were looking for, which was to treat var T1 dynamically like "Save Clipboard to var T%N1%" then increment N1, thus changing the which T var is used .... Note also though, that if you *were* able to do this, you'd still have to swap back and forth between your first application and Excel, which would also be somewhat time consuming... Last note: I had a difficult time getting the macro to correctly "pluck" each line and save them to the INI without skipping lines, so if anyone has the time to just try this, I'd be interested to know if it works on other people's machines.... Thanks. Hope this help -steve okay one more note: Google spellcheck isn't working, so apologies for typoes....
  10. For the 'specific window' example you would want to use Scoping -- which in essence does create a both-or-none requirement. (i.e. macro only will run if such-n-such window is active, otherwise the triger is ignored) -steve
  11. I was just tinkering with MacExp and I also couldn't see how to increment the *receiving* variable. Perhaps our local experts will have some ideas, but I'll bet your best approach will be to just automate the switching back and forth from your starting app and Excel. Set N1 = 1 Loop until N1 = 20 Set T1 from Something Move to Next Field Set T2 from Something Move to Next Field Set T3 from Something Move to Next Field Set T4 from Something Move to Next Field Set T5 from Something Move to Next Field Set T6 from Something Move to Next Field Set T7 from Something Move to Next Field Set T8 from Something Move to Next Field Activate or focus on Excel Type out T1 Move to Next Row Type out T2 Move to Next Row Type out T3 Move to Next Row Type out T4 Move to Next Row Type out T5 Move to Next Row Type out T6 Move to Next Row Type out T7 Move to Next Row Type out T8 Move to Next Row Activate or focus on the First Application Increment N1 = n1+1 Repeat Loop This assumes that the applications will remember where the cursor was when it lost focus last time .... I don't know... What do others think? -steve
  12. Maybe these text variables (all 160 of them) could be stored using an .ini file, then accessed as needed (??) Depending on your purpose, this might not be very efficient though... Also though, depending on your purpose, maybe you can 'reclaim' t1 t2 t3 and t4 and use them over and over (??) Can you tell us more about what you'rre trying to do?
  13. I was thinking about this last night.... I use prefix-mode, so I don't know ... But, I wonder if it's possible to use suffix-mode, but stop using the ## as global keys. That way whenever you hit the spacebar or a punctuation character the macro would activate.. IN ADDITION to this, change your existing shortkeys to include the ## as part of the shortkey. So if you used to have: addy (the shortkey) + ## (the global trigger) = Your name and address Now you would have: addy## (the shortkey) + <space> (the global trigger) = Your name and address This way you could just leave off the ## when you wanted, thus: wkr (the shortkey) + <space> (the global trigger) = With Kind Regard ===== Incidentally, I was just toying around with the MacExp Editor, and I don't see where you define the global suffix characters ... Is it in the preferences dialog? ===== Other side note: I still recommend checking out ShortKeys because of it's "global spell check" capabilities... (see the post "MacroExpress vs. ShortKeys vs. Both") -steve
  14. Maybe Frans could use the Lite version of MacroExpress's sister program--Shortkeys? http://www.shortkeys.com/lite.htm -steve
  15. Bummer .... I sortof didn't think it was possible. Thanks for the reply though -steve
  16. Cool, I didn't realize that--thanks Incidently, I was thinking about the issue of automating the entry of Remarks.... If I only had some tool that could be used to automate repetitive tasks ... Golly gosh geewiz I should use MacroExpress !!! <TEXTTYPE:<TAB><TAB>mac<ENTER>><WAITPB><MSD:100><TEXTTYPE:rem><MSD:100><TEXTTYPE:<ENTER>> I scoped it for "MACEDIT.exe only" and made it activate with the shortkey "//". CLick in the Script Editorwindow, then active it. It sortof works. I must say though, I'm not sure about the safety of using a macro to automate another macro. What next? If I find myself making lots of macros to automate the creation of other macros, will I then attempt to automate those "macro-creating" macros? And what if I succeed at this? Will I eventually have macros that automate the creation of other macros used to create them in the first place? Will it be like that famous MC Estcher lithograph of the two hands drawing each other? Well, I'll give it a try... If the Universe suddenly implodes, you'll know why
  17. Okay, last post for today.... I don't know if this is even possible ... MS Outlook seems to be one of the most-used calendar and task-management (as well as email) products. I would love being able to read and write directly Outlook's .pst files without having to launch the Outlook application. For example there could be a MacExp dialog with ================= Make New Outlook 2007 Task Set %T1% as Subject Set %N1% as Priority etc. ================= Did that makes sense? Side note: It *is* currently possible to call Outlook with MacExp and use Outlook's hidden command-line switches as "parameters" in MacExp. For example, Program Launch: Outlook.exe with Program Parameters: /c ipm.task will create a new Task without launching the entire Outlook GUI.... Thanks -steve
  18. Just an idea, Some folks might find this to be cluttered, but I think it would be helpful... In the Macro Editor, when in Edit Mode, is the "tab bar" which contains [script][Properties][scope][security][Notes] To the right if it is an unused empty space. I propose having a "Label" in that location that displays the Nickname of the current macro. If the Nickname hasn't been added yet, then the Label reads <Undefined> or somesuchthing. Make the Label "hot" so that clicking it will activate the [Properties] tab and activate the Nickname edit box. Did that makes sense? Thanks -steve
  19. Hi All, I just wanted to throw out a couple of ideas, so folks could comment on them... About two-thirds of the macros I make are actually 'Text Type' shortkeys. I think it would be great if I could just click in the Macro Script window and start typing and MacExp would launch the Text Type entry dialog and automatically enter my text into it. Another idea is that if I click in the window and type "//" then some text, MacExp would launch the Remarks dialog. Does that make sense? Thanks. -steve
  20. I was surprized I was able to use the "or" command in the manner.. Here, I recreated the script: <REP3:08:000002:000001:0001:1:01:T1><WAITKEY2:000010:000000:23><OR><WAITKEY2:000010:000000:25><TBOX4:T:1:CenterCenter000278000200:000:Either X or Z has been pressed.><ENDREP> NOTE: that iit continues to keep looping and there's no was to stop it. I recommend running it from the Macro Editor so you can just hit the red 'kill' button. Yes, the macros run linearly, so for your previous setup, the bottom ones can't run untill the top ones finish... ==== It ocurrs to me that you'll need some type of macro activation. I was playing around with this script: <REP3:08:000002:000001:0001:1:01:T1><WAITKEY2:000100:000000:25><TBOX4:T:1:CenterCenter000278000200:000:You pressed "z."><ENDREP> and tried to scope it to only run in Notepad.exe and to be activated via the window title "Notepad -- Untitled." It did activate and would correctly, but I was having trouble with the scoping (i.e. it kept running even when Notepad was closed). My thought was to just have two separate macros--one waiting for "Z" and one wiating for "Y." This would avoid having to deal with the "OR" command. You might not ba able to do this though, there are rules about not having multiple macros going at the same time. What about have two separate non-looping macros that are activated with Hotkeys??? Alt-x to click 'here' Alt-z to click 'there' -steve
  21. This is a good challenge... I've been tinkering, but haven't figured it out. Let me confirm your meaning though: You want it to wait until Z *or* X is pressed--step one. If Z it pressed it clicks "here." If X is pressed it clicks "there." Either pressing Z or X completes step one. Once step one is completed any key can be pressed... Question: Once the last key is pressed, the macro stops? or it continues to loop? From you post it sounds like it continues to loop... If it continues to loop, maybe you don't need the, third, 'any' key. Just continue pressing X or Z (?) If this were the case though, you'd have to have a kill command to tell MacExp when you're done and want to stop looping. I was experimenting and tried: -Loop until T1 <>T1 -Wait for key press Z --OR- -Wait for key press X -Display text box "Z or X pressed" -End Loop. This was syntactically correct, and if I pressed either X or Z I'd get the text box, but it was a continual loop. The macro kept running until I aborted it. I then tried: -Loop until T1 <>T1 -Wait for key press Z -Display text box "Z pressed" --OR- -Wait for key press X -Display text box "X pressed" -End Loop. The debugger told me this is an incorrect use of "OR." It seems like you could capture a keypress and send it straight to a variable, then use logic to compare the variable. (If this then that) I can't see how to do this without the use of a GUI dialog box though... Maybe others have an idea. steveK
  22. Thanks for pointing that out Kevin... In my original post I shouldv'e pointed out that it's more of a companion product by the same company, and not a competing product... Also I wanted to note that in my OP I mentioned occasional misfires. It occurred to me that this mostly happens in Word and when composing emails in Outlook. I disabled the native autocorrect in these applications and I think that fixed it. I'm sortof embarassed to admit it now, since it's such a no-brainer .... I thought it would be good to document it in the forum though. Thanks for the replies everyone.
  23. I'm just curious how many folks out there run both MacEx and ShKeys at the same time? Several years ago I learned about the Lite version of SK, and was impressed enough that quickly bought it. Some time after that I was perusing the Insight website and found ME; so now I own both. Obviously ME is in a class of it's own, so SK can never replace it, but ME can replace about 98% of the functionality of SK... SK is unique though, because you can import a Word autocorrect file. By doing this, and having its activation set to Suffix mode, you have a veritable system-wide autocorrecter/spell-checker. (Note that at one time I had converted the Word autocorrect file into ShortKeys, then exported them, then imported them into ME, but it didn't work well.) A couple of times I've had both installed at the same time. My previous work computer had low memory, so I uninstalled SK. My new one has 2GB though, so I'm thinking of putting it back on. It does worry me having too many busy backgroud applications go all the time though... I'm always afraid Windows XP will freakout. Also, I've noted that I do accasionally get misfires in the middle of long words when using SK as a autocorrecter... Do any of you guys and gals run both? Any special setups that you can share (tell about)? Thanks -steve
  24. You've got my curiosity ... How are you using this feature? You must have a heavily scoped macro--like it only executes under very specific situations, yes? Also curious: What's the other application you're using? steve
  25. Johnboy, this is awesome--thank you or the reply! I took your model and tweeked it and came up with this <CLIPC><TVAR2:04:03:><IVAR2:04:01:1><IVAR2:05:12:4><REP3:08:000002:000001:0005:1:01:T5><TMVAR2:10:05:04:N04:001:><IFVAR2:1:05:1:0><OR><IFVAR2:1:05:1:1><OR><IFVAR2:1:05:1:2><OR><IFVAR2:1:05:1:3><OR><IFVAR2:1:05:1:4><OR><IFVAR2:1:05:1:5><OR><IFVAR2:1:05:1:6><OR><IFVAR2:1:05:1:7><OR><IFVAR2:1:05:1:8><OR><IFVAR2:1:05:1:9><OR><IFVAR2:1:05:1:/><OR><IFVAR2:1:05:1:-><TMVAR2:08:06:05:000:000:><ELSE><ENDIF><IFVAR2:5:04:5:N5><EXITREP><ENDIF><NMVAR:08:04:0:0000001:0:0000000><ENDREP><TEXTTYPE:The number is %T6%.> Directions BEGIN Just a "test" macro that extracts numbers from a bit of text. 1. From an editable text field, such a Note Pad, 2. Use mouse to highlight a line of text that contains numbers and letters. 3. Activate macro. (Hotkey activation recommended) Marco will extract the characters "1,2,3,4,5,6,7,8,9,0,/, and -" then type them out. END This still needs a lot of work before it can actually "recognize dates" ... but it's pretty cool nonetheless! -steve
×
×
  • Create New...