Jump to content
Macro Express Forums

wzeller

Members
  • Posts

    12
  • Joined

  • Last visited

wzeller's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. What I was told by Microsoft when I inquired about it (though they have been known to be self-contradictory on many occasions so I still wouldn't call it gospel) is this: The XP installation that comes with Windows 7 is provided due to the fact that some business applications that are not compatible with Windows 7 require the downgrade. (The warehouse I manage the IT for has one such software running their operations, for example.) If you choose to use the XP license, you agree to not use the Vista license. In other words you legally only have one license - for Vista OR for XP - not one for each. That they can both be activated is due only to the fact that this requirement was not foreseen by Microsoft when they created the Vista activation procedures. They wouldn't even be including that copy of XP if excluding it wouldn't land them in heaps of more lawsuits from corporate America. Further, they said that a single license of any Microsoft operating system is for installation on a single system at a time - be that system real or virtual. You can replace all your hardware and reactivate as long as the old hardware is no longer running it, or you can install it on a VM and then replace the VM as long as the old VM is gone forever, or you can even install it on a VM and then install it on a real machine provided that the VM is gone forever. But you can't legally have it on two machines at the same time regardless of the physicalness of either of the machines. It sounds kinda greedy until you realize that the alternative would allow companies with powerful enough computers to provide 50 virtual machines on a single server so that 50 employees with dumb terminals could all be using the same license of Windows at the same time. w
  2. <slap location="forehead" ownership="own">Doh!</slap> I get my brain into a mode sometimes where the blinders come out and the tunnel vision turns on. Thanks for the tip! Marshall
  3. I'm not sure I follow. If the mouse doesn't move then how can Get Pixel know where to get the color from? If you mean I should grab the color from "Specific Coordinates" instead of "Beneath the Mouse", then how would I know what coordinates to use? (If I knew that, then I'd just move the mouse there and click and wouldn't care about the color.) I want it to be as reliable and fast as possible, so I definitely want to understand what you mean, but I think I'm missing something. Thanks, w
  4. Thank you for all the replies! I actually got it working perfectly. Once I realized that I knew one dimension of where it would be and also knew within 200 pixels where it would be in the other dimension, I just set it to move the mouse to the upper-most possibility and then come down one at a time and check pixel color until it finds the color that Google Chrome outlines buttons with on a hover. That's the extreme edge of the button, so I skip down 6 more pixels for safety and left click. The hunt happens so fast you can't even see it. For others in the future that find this thread and decide to do the same thing, I should give one warning: On my first test I had the color number wrong and the mouse zoomed to the bottom of the screen and I couldn't break the loop. I ended up having to kill it with Task Manager. I solved that by making it read the mouse position into a variable each time through the loop and adding an "If Variable" that issues a "Repeat Exit" if the Y coordinate gets too high. So, for the benefits of those future thread finders: Mouse Move: 748, 379 Relative to Screen Repeat Until %COLOR% Equals "15462385" Mouse Move: 0, 1 Relative to Last Position Get Pixel Color from Beneath the Mouse into COLOR Get Mouse Position into (%mousex%, %mousey%) Relative to Screen If Variable %mousey% Is Greater Than "600" Repeat Exit End If End Repeat Mouse Move: 0, 6 Relative to Last Position Mouse Left Click Thanks guys! w
  5. <Deleted my own post for unwarranted snarkiness. Upon review later in the day, I can only assume I must have been in an un-noticed bad mood or something. I seemed to sense a lack of appreciation of Paul's time in the responses here, but looking at them now I'm not sure that was the case. So I retract.>
  6. There's another good thing to point out regarding using an external file to control this: There may be instances where stopping a macro in some random spot causes problems. For instance, if you have a macro that writes files for some other process you probably don't want those files half-written. If each macro looks for a stop signal in some external file then you can accurately control exactly when a macro becomes eligible for stopping. (In this example, check for the stop signal only after completing the writing of the file it's working on.) This is far more elegant than doing something that tells everything, "Drop whatever you're doing, no matter the consequences, right now, and die." w
  7. I'm writing a macro that interfaces with a website and loads several pages and processes a bunch of stuff. And, just when I thought I was almost finished, the very last button to click has a special challenge for me. There are a variable number of pop-up ads on the page at both the top and bottom (between 0 and 2, inclusively), and each of those will have at least one link. Which means that both tabbing from the top of the page down and shift-tabbing from the bottom up are unreliable ways to get the focus onto the button. The presence or absence of the top of the page popups also change the physical location of the button vertically so I can't use mouse motion. From what I've read in the forum here, the whole browser window is one big control, so using a control variable is probably not an option either. The browser I'm using is Google Chrome, and I did have one idea that might work but it seems ludicrously roundabout: I could hit Ctrl-F and then type in text matching a label that sits a fixed distance and direction from the button. That will perform a "find on page" search and highlight the label in orange. Then I could search a rectangular area for the first orange pixel and put the mouse there, and then move the mouse in the right direction for the right distance, and then click. But there has just GOTTA be a better way than that. (I'm already running ad blocking software, and if that was working perfectly then the pop-ups would be gone and the problem with them. But some get through, thus the challenge. I even tried disabling the popup blocker figuring at least I'd have a constant number of ads - but it turns out that the number of ads shown really is different from time to time.) Very frustrating. I've spent quite some time going through these forums but haven't found a solution. Any ideas/pointers? w
  8. Oops. Didn't know there was a difference. UI-design fail. So noted for future. I certainly agree that MEP is best suited for the simple stuff, but with just a few array functions it would be able to do a lot more of the things people might imagine. Sorting is certainly a good example. Sorting functions are so ubiquitous these days that even people new to the web know that they can often click on column headers to sort tables. And the other array functions I mention are in many ways just subfunctions of sorting. But I'll follow your cue and submit a feature request for a simple array-sorting function. I can't imagine that it doesn't exist in Delphi, so hopefully you're right that it would be a simple add. w
  9. That's awesome. After I posted my reply I thought to myself, "Wait, that's not really a bubble sort." I went to Wikipedia and looked up a few things and decided you were talking about an insert sort. One listed there that seemed more efficient and, actually, simpler was a "select sort" where you take the minimum value in the array and move it to the first position, then the minimum value in the array other than the first position and move THAT to the first position, then minimum value other than in the first two positions and move THAT to first... blah blah blah. But there's no function in Macro Express to return the key/value of the minimum value. Building a function to do that is an option - but by the time that function runs, a bubble or insert sort would have been done already. It's unfortunate that the scripting language for Macro Express doesn't have more in-built array functions. (Obviously, a sort function would be handy but that's not what I'm thinking of.) It would be nice to have functions that return the key/value of the maximum and minimum values stored in the array, a function to insert a value (reassigning keys of values subsequent to the insertion point), a function to remove a value with the same reassignment of keys for subsequent values, and a combination of those last two that lets you move a value within the array (read, remove, insert). With just those functions, array handling in Macro Express would instantly become far more powerful.
  10. I'd thought about using a bubble sort like that, but I haven't actually written a real bubble sort since I was in highschool. It's amazing how quickly you become dependent on functions like sort() when they're built right into the languages you use. I sort arrays all the time - without actually having written a function for it in over 20 years (yeah, highschool was a long time ago). When I thought about doing it this morning I quickly discarded the idea because I wasn't confident I'd even remember how it goes, much less how to make it work in Macro Express scripting. (Back then, I think I wrote it in Turbo Pascal.) Maybe I discarded it too quickly. It's always good for the brain to go back and study the fundamentals. If you decide today is rainy enough for you, then I'll gladly and happily skip the work because I'm not sure it's raining quite that hard here (especially since I already put together something that works). But if I do get a chance to go at it some time soon I'll be sure to post my results here. (Actually, I'm looking forward to the challenge now. If only I could justify shoving the rest of my work aside for an hour or two.) wayne (Oh, and yes: It was your post about sorting that got the ball rolling. So thanks!)
  11. Is it possible to stream a variable into the standard input of an external program and have it's standard output streamed into another variable? (Instead of writing a file, using that file as the standard input, having stdout write to another file, and then reading that file back.) I often find myself copying text to the clipboard, launching Excel, pasting it at A1, highlighting the column, clicking the sort button, cutting back to the clipboard, closing Excel, then pasting someplace. This morning I was in the middle of it and thinking my usual thought: Using Excel to sort a short list of text is like swatting a fly with a Buick. Then it occurred to me that I can't be the only one, and surely somebody has written a utility to simply sort the clipboard contents. To my surprise, a quick Googling only brought up one program and that one, if running, will ALWAYS sort the clipboard every time you copy to it. That would be bad. Then I realized I've got the world's coolest macro program! Somebody surely has written a macro for this. So I came to the Macro Express site and looked through the samples and the "Shared Macros" and, (once again) to my surprise, found that there doesn't seem to be one. Some forum hunting turned up a post on using the Windows sort command to sort a file into another file based on the third field of the input file. That got me rolling, and actually much of my task was just to simplify the example provided there. The result is this attached (and nicely-working) macro: CopySorted.mexIt checks for the existence of previous work files and deletes them, copies selected text to the clipboard, copies the clipboard to an input file, calls sort.exe via cmd using the input file as stdin and sending stdout to another file, waits for the output file to be ready, copies it back into the clipboard, and deletes the two work files. To use, I just highlight some text and hit Ctl-Shft-A to Alphabetize, then paste it wherever I want it. (An earlier version ended with a Paste, replacing the selected text, but I realized you don't always want it pasted into the same place you copied it from, so I removed the Paste.) It works fine, but seems very kludgy. Having to write and read and delete files for something as simple as sorting a string that's already in memory is, again, like swatting a fly with a Buick. (Okay, compared to using Excel for it, it's probably more like swatting a fly with a Schwinn.) Doing it without files would speed it up a LOT. It would get rid of over half the code, not to mention get rid of disk access delays. Surely there's some way to stream a variable directly into the stdin of sort.exe and have the stdout streamed back to another variable. ...? I'm sure others would find this macro useful, so I plan to post it to the shared macros area (where it might be especially helpful for newbies like me), but before I do I'd like it to be as streamlined as possible. Any thoughts? Wayne
×
×
  • Create New...