Jump to content
Macro Express Forums

acantor

Members
  • Posts

    1,534
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by acantor

  1. 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.
  2. Perfect! That's exactly what I had in mind!
  3. I think it may be possible for macro express to detect whether text is italicized, under certain conditions, and in certain contexts. I am thinking out loud here, so these ideas may not work in the real world, but this is what I have in mind: Let's assume that we want this to work in Microsoft Word. Use VBA (the macro language built into Microsoft Word) to detect the character formatting of a selection. If it is italics, add a space or some other character to the end of the selection. This Word macro is activated by a hotkey, say "F12." So the Macro Express script does this: 1. Copy the selection to the Clipboard. 2. Place it in variable T1 3. Press F12. 4. Copy the selection to the clipboard. 5. Place it in a variable T2 6. Replace the selection in the document with T1. 7. Compare the length of T1 and T2. If T2 > T1, then the selection was italicized.
  4. I am trying to script a message box to prompt the user to confirm an action. I know I can do this in ME Pro; can it be done in ME 3?
  5. I have been running Windows 7 for a few months, and initially, I had a lot of crashes as well. Not only with Macro Express, but with other programs as well. My system still hangs occasionally, but not nearly as often. I arrived at this (relatively) stable place by disabling as many Windows 7 themes, gadgets, and features as has been practical. For example, I am using the Windows "Classic" display theme rather than the glitzier "Aero." (In my opinion, the newer themes make it difficult to tell at a glance which window, and which object within a window has focus. Overall, this makes the computer harder for me to use.) Perhaps it would be worthwhile to experiment with disabling all Windows 7 eye candy, and determine whether Macro Express becomes more stable.
  6. I use pop up menus, and like Cory, find that they appear almost instantly, even on older PCs with many background processes. How do you trigger your pop-ups? Maybe the problem you are experiencing relates to the activation method. What happens if you change the activation from, say, hotkeys to ShortKeys to Window Title to Mouse Event? Have you created (from scratch) and tested simpler versions of the pop-ups? E.g., fewer menu items, default icons, and so on.
  7. After this happens, it might be helpful, once you are back in the Macro Explorer, to sort the macros by "Last Run Time." This might provide a clue as to what was happening when the system got stuck. For example, maybe a script activated by a control or window event was running without your awareness.
  8. Hi Terry, I don't remember the last time I modified the keystroke speed. I haven't found it necessary. I use timed delays sparingly: for example, when sending keystrokes to open a dialog box, I might insert a very short delay. (Scripts run slower when I insert a wait for window title command, even though this is the more elegant and reliable solution.) But if I am sending keystrokes to, say, choose an item located at the bottom of a sub-sub menu, delays do not seem to make a difference: <ALT>AB<End><Enter> works fine. I will often insert delays while debugging a script. But once I have nailed the logic, I often discover that the delays are no longer needed. There are exceptions! I find delays helpful when doing stuff with the clipboard, but I sometimes workaround the delays by inserting code that chews up a little time: Clipboard Copy Run Macro to move focus to the first field Clipboard Paste
  9. <TEXT TYPE Action="0" Text="<ALT>n"/> <TEXT TYPE Action="0" Text="<TAB>"/> <TEXT TYPE Action="0" Text="<ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>"/> <TEXT TYPE Action="0" Text="<TAB><TAB>"/> <TEXT TYPE Action="0" Text="all"/> <TEXT TYPE Action="0" Text="<TAB>"/> <TEXT TYPE Action="0" Text="l<ARROW DOWN><ARROW RIGHT><ARROW DOWN><ARROW DOWN><ENTER>"/> This will do it... you may need to tweak the code a little... Set the scope to Window specific: "- Script Editor" Sorry for the lack of comments. Essentially, what it does is this: 1. Navigate to the Nickname field. 2. Use brute force to ensure that the "Script" tab is focused. 3. Tab to the drop down list, and force it to select "All Commands" 4. Tab to the tree-view of all commands 5. Send the sequence of keystrokes to navigate to "Remarks," and open it.
  10. Not every application lends itself to control-centric macros. I have attempted many for Macro Express, and in almost every case, I have gone back to sending keystrokes and/or performing mouse manipulations. I have had more success in applications such as Outlook. But even so, these macros take a lot of testing and debugging. In one case, a script failed five or 10% of the time. It took me a long time to figure out that a short delay was needed at one point in the process. It's extremely useful to be able to create control centric scripts, but the learning curve is steep!
  11. Sounds intriguing. Now sure I know how to do this. Let's say I have any old IE window open. I want to click in the upper left hand corner of the active window, say at (1,1). When I invoke the command, focus may be within the active window, in the Search box, on the menu bar, or in the History pane. How can I put focus in the active window, without clicking -- because I don't want to inadvertently click a link, button, etc. -- and without sending a series of Tabs -- because I can't know how users have configured their browsers, with extra toolbars, etc. that throw off the Tab order.
  12. You may need a time delay... or you could press Ctrl + Alt + C!
  13. I'm not sure... but maybe I am asking too much. A lot of macros -- and not only those developed by me -- can fail when the user inadvertently messes with the focus.
  14. Hi Cory, This can work, and in fact, I tried the approach yesterday. But it fails when the active window does not have focus. If the user has inadvertently shifted keyboard input focus to a menu or "ribbon" -- which I observe often, especially when a user inadvertently presses Alt or is clicking around the screen -- the command does not work.
  15. I've made a feature request. One of the scripting tools that I use (NaturallySpeaking Advanced Scripting) has a command to position the mouse cursor relative to the active window. It's convenient to NOT have to kludge something together every time! Anybody know of a programmatic way to determine whether the History pane is on or off? I tried several approaches based on pixel colour or mouse cursor detection, but these techniques are not reliable enough. What would be ideal is a way to do this programmatically. Where does IE store user-specific settings? And can these settings be directly read (and written) by Macro Express?
  16. I was hoping to avoid pixel sniffing to do this! There are too many ways that my users set up their systems. I am scripting for a web app running in IE, and recently discovered that some users display the History pane, which means that I can't be hunting for pixels on the left side of the screen. The solution I may use is to hunt for ten consecutive pixels of the predominant background colour in the lower right corner of the screen. I think I am going to put in a feature request...
  17. I know how to move the mouse cursor relative to the screen, and relative to the window. Is there a way to move it relative to the part of the window below all menus, toolbars, etc. Or should this be a feature request?
  18. When I don't use arrays, I just type in the name of the variable, without the percentage signs. When I "OK" the dialog box, the variable name is wrapped with percentage signs.
  19. I am not sure why you need to do this, but I am sure you have a good reason! The code can be greatly simplified: Program Launch: "control.exe" (Normal) Parameters: desk.cpl,1,4 Wait for Window Title: Resolution Text Type (Simulate Keystrokes): <ALT>c <PROGRAM LAUNCH Path="C:\\Windows\\System32\\control.exe" Mode="\x00" Parameters="desk.cpl,1,4" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/> <WAIT FOR WINDOW TITLE Title="Resolution" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="5"/> <TEXT TYPE Action="0" Text="<ALT>c"/> But I think rberg nailed it with his very elegant solution!
  20. I am not sure why you need to do this, but I am sure you have a good reason! The code can be greatly simplified: Program Launch: "control.exe" (Normal) Parameters: desk.cpl,1,4 Wait for Window Title: Resolution Text Type (Simulate Keystrokes): <ALT>c <PROGRAM LAUNCH Path="C:\\Windows\\System32\\control.exe" Mode="\x00" Parameters="desk.cpl,1,4" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/> <WAIT FOR WINDOW TITLE Title="Resolution" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="5"/> <TEXT TYPE Action="0" Text="<ALT>c"/> But I think rberg nailed it with his very elegant solution.
  21. Hi Terry, Here it is as an attachment. Esc_to_Exit_Scripting_Editor.mex
  22. Here is an "improved" version of Esc to close scripts/Script Editor Activation = Esc Scope = "- Script Editor" (partial match) What it does: Press Esc to close a script, one at a time. Lock Player: Wait for running macros to stop // Close the Script Editor, one script at a time. // Rationale: Ctrl + F4 closes a script, but does nothing when only one script is open. // When only one script is open, use Alt + F4 to close the Script Editor // TopWindowTitle1 contains name of focused script... Variable Set String %TopWindowTitle1% to topmost window title // Try to close TopWindowTitle1 with Ctrl + F4 // (Does nothing if there is only one script open) Text Type (Simulate Keystrokes): <CONTROL><F4> Delay: 200 milliseconds // TopWindowTitle2 contains name of focused window... Variable Set String %TopWindowTitle2% to topmost window title // If TopWindowTitle1 = TopWindowTitle2... // The previous step did nothing. This means we can't use Ctrl + F4. // So we close the Script Editor with Alt + F4 If Variable %TopWindowTitle1% Equals "%TopWindowTitle2%" Text Type (Simulate Keystrokes): <ALT><F4> End If Unlock Player
  23. You're right. But if you choose "Area on a window," set the coordinates so that they exactly cover the close button.
  24. It is possible, with Macro Express, to "appropriate" the three icons on the top-right corner of a window, as well as scroll bars, system menu, borders, menus, and so on. Create a new macro, choose "Mouse Event" as the activation, and then explore!
  25. I have a set of the scripts that I use to simplify the job of creating macros. I include it in every client MEX file that I work on. I don't bother to disable these scripts, as the chances that a client will activate one by accident is virtually nil. There are not many people in this mouse-centric world who would try pressing key combos like "Ctrl + Alt + Shift + F12!" And even if someone did press one of the keys, they would need to have Macro Express or the Scripting Editor open. Almost all my scripts are application or window specific for Macro Express.
×
×
  • Create New...