Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Everything posted by paul

  1. Well, since the character is called NUL, why not use that name instead of the confusing Null? To reiterate what has been stated before: in pure computer terminology (whatever that is when it's at home!), ME does not support NULL. A string variable contains a zero-length string before its first use; therefore a comparison of the string variable with "" will yield True. This is not a NULL, since a NULL is unknown and cannot be compared with anything else, not even another NULL, since that's also unknown. Even in real life, we would not claim that one unknown is equal to another unknown. And, of course, a zero-length string is not the same as a space (" "); a space is simply a character, just like "A" or "a". And, finally, in MEP, a zero-length string appears not to be expressed at all: Thus, Variable Set String %t[1]% to "A" is written as <VARIABLE SET STRING Option="\x00" Destination="%t[1]%" Value="A"/> while Variable Set String %t[1]% to "" is written as <VARIABLE SET STRING Option="\x00" Destination="%t[1]%"/> Note the absence of the Value= clause. The same hold true for comparison tests.
  2. Do you have any way of discovering whether HPSM is an mdi application? And are you saying that the handle of a particular window or control changes? I'd be very surprised if this were so. In Microsoft Access (an mdi application) I have seen indexes change - the currently active 'window" always seems to be #1. But I have never seen handles change. In fact, if handles do change, how can Windows identify anything with any degree of certainty? If your application is mdi, then the rules change, and it becomes much harder to manage. But I'll wait to hear from you about HPSM before providing more details about mdi.
  3. See KeyPress macros for a similar technique, except that the desired key presses are waited for all at the same time, instead of serially as in the example above.
  4. Au contraire! You can impose a waiting time of as little as 1 second on ALL Wait For commands in MEP AND handle the error condition that is raised when the timeout occurs. This means you can usefully include any of them in a Repeat loop.
  5. You can't do this in ME v3. But in MEP, you can get pretty close. You'll need 2 macros; one for waiting for your user input (Macro M1), and one to detect the closing of the specified window (Macro M2). In reverse order, Macro M2 is activated when the relevant window title is closed. It creates a file called, say, StopMacro.txt in, say, your temp folder (e.g. C:\Temp). Macro M1 looks like this: 1) Repeat Until %n[1]% Does not Equal "%n[1]%" 2) Wait for Key Press: ENTER -- waits for one second only, and handles the error that occurs when Enter is not pressed within one second 3) On Error -- this code (lines 3 - 11) executes only when Enter was not pressed within one second 4) Catch Error: The condition was not met within the specified amount of time 5) If File Exists: "C:\Temp\StopMacro.txt" -- stops the macro if this file exists 6) Macro Return 7) Else 8) Continue -- repeat waiting for one second for the Enter key 9) End If 10) End Catch Error 11) End Error 12) Repeat Exit -- This code executes only if Enter was pressed within one second 13) End Repeat 14) macro code to execute when Enter was pressed within one second
  6. Did my earlier post, part of which I repeated above, also not address this very issue?
  7. Did my earlier post, part of which I repeat above, also not address this very issue?
  8. From time to time MEP misses activating a macro based on a window title. It's impossible to reproduce because the behaviour is not consistent. For example, I have a macro that runs only when Roboform issues a request for its master password. In my normal environment, I have control over when Roboform issues this request because I deliberately log out of Roboform in order to force this very request to occur (this is the only way I have discovered to insert macro code specific to a particular Roboform passcard). In this circumstance, MEP seems 100% reliable. But sometimes Roboform issues a request for its master password simply because I haven't used Roboform for some time, and it logs itself out. In this circumstance, MEP is not 100% reliable.
  9. Huh? The Contains sub-command doesn't need the entire string. It's sufficient simply to look for the word "notepad". Your "Untitled - Notepad" string certainly does contain the characters "notepad", which is all I was interested in!
  10. You're right in saying my pseudo-code doesn't show whether I used the Case Insensitive setting. But I think my description above the code does show this information, doesn't it? (Yes, I used Case Insensitive).
  11. I confirm your finding. If the Scope is set to program instead of window, it all works correctly. I then changed your sophisticated macro to repeat with all windows, check the variable set each time to see if it contains the case-insensitive characters notepad, and append to a 2nd variable if it does. After all windows had been evaluated, the displayed result was blank. I did this just to make sure that MEP wasn't finding some spurious window name containing notepad. Variable Set to ASCII Char 13 to %tCr% Variable Set to ASCII Char 10 to %tLf% Repeat with Windows: All Windows: Store in variable %t[1]% If Variable %t[1]% Contains "notepad" Variable Modify String %t[2]%: Append Text (%t[1]%%tCr%%tLf%) End If End Repeat Text Box Display: Actually, I wonder whether this is a scope bug, or a window bug because I don't think I find windows activation as reliable in MEP as it was in ME3.
  12. I am thinking of developing one or more add-in libraries for Macro Express Pro. My initial idea is for a library to allow you to design and implement forms for use in your macros. Before I start any serious work on this, I thought I'd conduct a straw poll to establish whether there's any real interest in such a facility. At its simplest, the forms facility would offer to both basic and advanced users a straight-forward way of "designing" a form; basic use might consist of a Graphical User Interface (GUI) allowing users to define various form controls (e.g. text box, label, combo box, list box) by pointing, clicking, dragging and dropping. More advanced use would allow direct editing of various values, e.g. x and y position, colours, enable/disable, visible/invisible, the ability to define data validation rules, and even some event-handling (e.g. data lookups, control branching depending on entered values, etc.). I would aim to make this as much a part of MEP as possible. For example, when writing a macro, you might press a function key to invoke forms design, the result of which could be a self-contained AutoIt script that handled everything. When running your macro, the form would appear and allow you simply to enter whatever values you need in the fields you have designed, with the data being returned seamlessly to a user-specified location, e.g. an array or an external file. My initial question to you is this: would you buy a library that offered this kind of functionality, and what price would you consider reasonable? What other libraries might also be of interest? In other words, what would you most like to be able to do in MEP that you are currently unable to achieve?
  13. So you're suggesting that computers are more like humans than we realized? I'm usually not at my best in the mornings either!
  14. Of course, you're quite right. Consider applying OCR to 100,000 words and obtaining a result with 99% accuracy. Sounds good, eh? Most of us are happy with a 99% success rate. But 1% of 100,000 is of course 1000 - that's a lot of words to correct, especially if numbers are involved. I've used Snagit's OCR in very limited circumstances - no more than a page of text. And I don't get 99% success!
  15. I disagree. "Normal thought" is often unclear or badly articulated. Given that most of us are familiar with the concept of operator precedence, e.g. AND often takes a higher priority than OR, then "normal" thought may be ambiguous, depending on how it is expressed, and on whether there is a hidden assumption that AND takes precedence over OR. Consider simple arithmetic. What does "normal" thought understand by this? 2 x 3 + 4 Is the answer 10 or 14, and why?
  16. This thread reminds me of my first program I wrote before the dinosaurs were destroyed! I wrote this IF statement in COBOL, which went to 9 levels of nesting and occupied a printed page and a half. The astonishing thing was that it worked almost first time after much testing. But I eventually paid the price. Some 6 months later I was required to alter some of the logic... and I simply couldn't do it! In the end, I had to rewrite the logic into something much more digestible.
  17. I though I'd found a kludgy work-around! Display a floating text box containing your field names, positioned precisely somewhere, then display as many prompts as there are data fields, positioning each prompt next to its field name. Unfortunately there seems to be a bug (reported) which prevents the prompt from being visible while the text box is displayed.
  18. I think this code looks a bit clearer: If Variable %n[11]% Equals "23" If Variable %n[1]% Equals "0" Variable Set String %t[40]% to "run1" End If Else If Variable %n[1]% Is Greater Than "%n[11]%" Variable Set String %t[40]% to "run1" End If End If Here it is more obvious that the condition n1 > n11 is independent of the other conditions. Or you could try this: Switch( %n[11]% ) Case: 23 If Variable %n[1]% Equals "0" Variable Set String %t[40]% to "run1" End If End Case Default Case If Variable %n[1]% Is Greater Than "%n[11]%" Variable Set String %t[40]% to "run1" End If End Case End Switch
  19. And if you think AutoIt's syntax is unfriendly, take a look at AutoHotkey, which is more powerful than AutoIt with respect to what you can control via the keyboard!
  20. Then I certainly advise you to avoid APL (A Programming Language). Originally created as a notation methodology for mathematicians, it parses its syntax in the order received, but from right to left (unless brackets intervene)! So 12 = 2 x 4 + 2 is true.
  21. AFAIK, there is no concept of nulls in MEP. An integer variable equals 0 before it is used for the first time. A text variable equals a 0-length string, i.e. "", before it is used for the first time. I do not believe you can distinguish between the values of %t[1]% before it is ever used, and Variable Set String %t[1]% to "". In which case, that's not a Null value in any sense of the word, neither programming nor engineering. If the value of a variable is unknown, then you cannot compare it with anything, neither blank nor an empty string. Thus, in SQL, you cannot compare 2 null variables with one another. All you can do is test the variable to see if its value is unknown, i.e. IF MyVar IS NULL, not IF MyVar = NULL. Your earlier example of the blank page is just that: a blank page, and not a page with an unknown value.
×
×
  • Create New...