Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,532
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. You can do it, but you will not be able to use Ctrl + Alt + Shift to activate the macro. But there are more than a thousand other hotkeys that you could assign. In ME, you cannot assign modifier keys as hotkeys. The modifier key or keys need to be part of the key combination, e.g., Ctrl + Alt + Shift + X.
  2. Consider storing the most recent file name in an .ini file or in the registry.
  3. The "Create New Macro" window is slightly problematic for non-mouse users. The comparable screen in Macro Express 3 is much easier to operate by keyboard alone. The main problem, for me, is that it is not possible to use the arrow keys to select a radio button in the "Initial Activation" container. The expected behaviour, when a radio button has keyboard input focus, is to make one's choice by pressing the up and down arrow keys. Here, pressing these keys selects an item, and then moves the focus away from the radio button control. To restore focus to the radio buttons, you must press Shift + Tab each time. Too much work! As this is the screen where hotkeys are defined, I can understand the difficulties to make the screen obey standard keyboard conventions. It is extremely convenient to be able to press the key you want to assign, including the accelerator keys that appear on this screen, rather than selecting keys from a list containing approximately 1000 items. On the other hand, keyboard navigation on this screen was far less complex in Macro Express 3, so I know non-mouse interaction could be improved!
  4. If there is a "Macro Stop" at the end of your subroutines, I believe that the main macro that calls these subroutines will also stop. But it sounds like there are other bugs, given your description of how your script is failing. My rule for debugging complex scripts -- and even simple ones that are misbehaving -- is to simplify, simplify, simplify. Ensure that the script does the first action correctly. Test and test and test. Add the next step. Test more. And so on. My experience of developing complex scripts is that there may be many things that cause, or contribute to, each problem. It takes a lot of time and patience to sort things out.
  5. This discussion leads to an interesting question. When is it appropriate to use the Save/Restore for variables? I have used these commands successfully, and although they may be limited and/or buggy, they are, in certain circumstances, the path of least resistance. Save/Restore works perfectly for me when I use Integer or Text variables. Generally, I am flagging whether a condition was met, and then checking the flag with another macro. I wish I could use Boolean variables in this way, but apparently, they do not work when set in one macro, and read by another.
  6. True, but be aware that on some Web pages, a mouse pointer hovering over an element causes its colour to change.
  7. Congratulations! It's not an easy macro assignment.
  8. 1. Is it possible to double click the numbers to select them? Drag the mouse to select the numbers? Select the numbers via the keyboard? If yes to at least one of the above... 2. Can you copy the selected text to the clipboard, and paste it somewhere else? If yes, then it may be possible to automate the process with Macro Express. You will need to select the first number, copy it to the clipboard, and assign a variable to the value of the clipboard. Do this for all three numbers. Then move the cursor to the appropriate field, and spit out the three variables. The code might look something like this. (The Mouse Move statements are are theoretical. There may be more reliable ways to navigate to the numbers.) // Get first number... Mouse Move: 10, 10 Relative to Current Window // Position of first number Mouse Left Double Click Clipboard Copy Variable Set String %N1% from the clipboard contents // Get second number... Mouse Move: 20, 20 Relative to Current Window // Position of second number Mouse Left Double Click Clipboard Copy Variable Set String %N2% from the clipboard contents // Get third number... Mouse Move: 30, 30 Relative to Current Window // Position of third number Mouse Left Double Click Clipboard Copy Variable Set String %N3% from the clipboard contents // Move the cursor and spit out the three numbers... Mouse Move: 100, 100 Relative to Current Window // Position of field that takes the three numbers Mouse Left Click Text Type (Simulate Keystrokes): %N1%%N2%%N3%
  9. It sounds like a timing issue, particularly if the Web page has JavaScript running in the background. Try this: Mouse Move ... Wait a little Left Click Wait a little Text Type ... Don't bother with commands like "Move Mouse to Text Cursor Position" in IE or Firefox. They don't work the way you would expect. An approach I have started using with Web based forms is to get the focused control, left click (0,0)relative to the control (which is the upper left corner of the content viewport), and then do all manner of mouse clicks, tab presses, and pixel searches to do to what I want to do. The approach is proving to be more reliable than I would have thought. Certainly better than clicking relative to the window or screen. It feels like a hack, but the scripts work nicely.
  10. Hi Cory, Is there a way to get around using "Save" and "Restore" in cases when a macro evaluates a condition, and another script makes decisions at a later time, when it is no longer possible to check the condition? Which leads to a question. If I save a MEP variable, and then shut down my computer, will MEP be able to restore the value after I reboot?
  11. Paul, I see that it is NOT necessary to save and restore variables in this situation. I tried using a Text variable as a Boolean, and so far, it works beautifully. Thank you for alerting me to the bug.
  12. Thank you, Paul, I will check. But your suggestion suggests another solution. If Boolean variables are buggy, maybe I should use Text variables. Why not set values of text variable to either True or False? In other words, create ersatz Boolean variables using Text variables.
  13. I have not quite figured out how to script a macro that returns a value to another macro. For example, here is a macro nicknamed "Black_Test" that tests if pixel colour = 0: Get Pixel Color from Beneath the Mouse into %PixelColour% If Variable %PixelColour% Equals "0" Variable Set Bool %IsBlackPixel% to "True" Else Variable Set Bool %IsBlackPixel% to "False" End If Other macros call "Black_Test" to obtain the value of %IsBlackPixel%: Macro Run: Black_Test If %IsBlackPixel% = "True" // Do this Else // Do that End If My assumption has been that %IsBlackPixel% should be defined as "Global" in "Black_Test." In the macros that run "Black_Test," there should be no need to make "IsBlackPixel" global. Is this correct? Probably not, because sometimes I can make it work, sometimes not. I have tried adding commands to save and restore variables (see below), but it's still not reliable: Get Pixel Color from Beneath the Mouse into %PixelColour% If Variable %PixelColour% Equals "0" Variable Set Bool %IsBlackPixel% to "True" Else Variable Set Bool %IsBlackPixel% to "False" End If Variable Save: Save Boolean Variables // COMMAND ADDED Macro Run: Black_Test Variable Restore: Restore Boolean Variables // COMMAND ADDED If %IsBlackPixel% = "True" // Do this Else // Do that End If I must be missing something. I look forward to learning a solution on this seemingly simple yet perplexing problem! Or a better approach.
  14. I am not sure whether this tool works for PDFs that are basically photos of text, but it would be worth a try, given that it is from Adobe, and it was meant to compensate for the inaccessibility of the PDF format for some people with disabilities:: http://www.adobe.com/products/acrobat/access_onlinetools.html
  15. 1. To begin scripting, figure out how to perform the task manually. If you can work out the steps by pressing keys on the keyboard rather than clicking with the mouse, that will help. But even if you only know how in interact via the mouse, you may be able to record the actions and come up with a viable script. 2. Explore Macro Express. Check out every menu. Try every command. In other words, play! The context sensitive Help in Macro Express is better than most programs. If you spot a command that looks interesting, try making a macro that uses the command. 3. Try the "Quick Wizards" feature. This is a fabulous introduction. I use them in the courses I teach on Macro Express. See, for example, http://www.cantoraccess.com/presentations/synopses_presentations.html#resna2009fiveminutemacro 4. Experiment with the "Capture Macro" feature. This is how many of us got started with Macro Express: the computer will record your actions, and then you can play them back. I haven't used the feature in years because the scripts tend to be unreliable. But if you are looking for a point of entry, this is the ticket. 5. Ask lots of questions on this forum. There are many experienced and creative Macro Express users who regularly read the posts and contribute.
  16. 7. A brute force method: Place an extra line before each Text Type command: Activate Window: "Your Application" Text Type: Bla bla bla 8. If there are specific pop-ups that appear, test for them before each Text Type command: If Window Title = "Pop Up 1" OR If Window Title = "Pop Up 2" OR If Window Title = "Pop Up 3" <code to close pop-ups> End if Text Type: Bla bla bla
  17. It is unlikely that anyone on this forum will be able to provide a script that does exactly what you want. Besides, we would need more information: Which email system are you using? Which version? And so on. And if your email client is configured differently than the person who wrote the script, the script may fail or malfunction. And because you are not sure how the code is supposed to work and what assumptions the developer made, you may have trouble figuring out what is wrong. In other words, the macro you have it mind is best created by you! The script that you want is an example of what I call a "disposable" macro. It fulfills a specific purpose. I develop a lot of disposable macros because it usually takes less time or less effort to automate a process than to perform it manually. A macro is disposable in the sense that you create the script, test it, debug it, refine it, use it, and delete it. (Or deactivate it. You may need it again or want to "borrow" the code for another script in the future.) If you are new to Macro Express, this would be a great first project. It might take all day to script it, but once you figure it out, scripting will go a lot faster next time. If you are using Outlook, the "secrets" of making a reliable macro to do what you want to do is to sort the messages so that the ones with attachments are grouped together, and then simulate the keystrokes to save all attachments. In Outlook 2007, these are: Text Type (Simulate Keystrokes): <ALT>f // Alt + F activates the File menu Text Type (Simulate Keystrokes): n // Save Attachments... Text Type (Simulate Keystrokes): a // all
  18. 1. Try sending text to a control. 2. Send text via the clipboard, which happens much faster than typing it out a character at a time. 3. Warn users that the macros may not be as reliable if they opt to have the notifications. 4. Script macros that are activated by notifications gaining focus. The macros close them. (You may need to use ME Pro for this, as several scripts can be running at the same time.)
  19. Just for fun, try assigning it to a hotkey, and see what happens. F10, F11 and F12 are usually safe choices, in the sense that hotkeys assigned to these keys may override commands, but not ones you are likely to use. Also: How does it work if you activate the macro while it is on the desktop, before you move it to the quick launch area?
  20. Would it be enough to test the length of the subject line? As novel-length subjects are the culprit, perhaps you could chop off everything after x characters, or warn the user that their subject must be shortened before continuing.
  21. That sounds like an excellent compromise. The perpetual problem for people who script macros is that we have limited programmatic access to the applications we are scripting for. Therefore, we are forced to use indirect ways to do what we wish we could do directly.
  22. I have recently discovered many interesting uses of the "Repeat Until" command, but there is something about it that makes me uncomfortable. It is the most elegant way I know of to repeat a process until a condition is met. But what happens if the condition is never met? For example, if I am hunting for a pixel color along a line, but the developers change the color scheme of the application so that the colors are different, the script will repeat forever. The obvious solution is to increment a counter with each repeat, and exit the loop if the counter value gets too high. But that is exactly how I was doing things before; and in fact, counting repetitions and using "repeat until" at the same time leads to far more complex scripts. I was hoping to simplify my scripts, not make them more opaque! How do others deal with this conundrum?
  23. This might work as the VBA part. Assign the macro to F12 (through the "Customize Keyboard" feature in Word.) Sub IfSelectionIsItalicsAddPeriod() ' If the selection contains italicized text, append a period to the end of the selection If Selection.Font.Italic = -1 Then Selection = Selection & "." End If End Sub My proposed solution is definitely not elegant! But better a kludgy macro that does the job than having nothing! Hopefully others refine the idea.
  24. Perfect! That's exactly what I had in mind!
×
×
  • Create New...