Jump to content
Macro Express Forums

margaret

Members
  • Posts

    92
  • Joined

  • Last visited

Posts posted by margaret

  1. Do I need the default delays that are shown in Preferences if I use the "Wait for Text Playback" command after any Text Type command that is sending more than a couple of characters to an application? In the Preferences I see a default delay of 250 milliseconds after clipboard commands, and Text Type default delay of 300 milliseconds. My macro has Keystroke Speed set to 2 milliseconds. Some of the macros seem a little slow in pasting, and I was just wondering about these default delays versus Wait for Text Playback. (The macros copy, then switch to another application and paste in, and they do a varying amount of handling to the text before pasting in depending on which macro, and they are sometimes a little unpredictable. I've just discovered Wait for Text Playback, which seems to make them more reliable.)

     

    Thanks,

     

    Meg

  2. Suppose your string is stored in T1.

     

    Save the length of T1 into N1.

    Replace, into T2, all spaces in T1 with nothing ("").

     

    Save the length of T2 into N2.

     

    Subtract, into N3, N2 from N1.

     

    N3 now contains the number of spaces in T1, whether 0, 1 or more.

     

    This is great, Paul. Thanks! rberq' s solution works as well, but took me longer to write up. Naturally, I had it figured out his way before I saw yours...

    Meg

  3. How would I go about counting the number of spaces in a string? The string will already have been trimmed on both sides, and will already have had any instances of two spaces in a row changed to one space. What I want to do is to evaluate the string, and if it only contains two words (hence one space), stop the macro, because that macro is designed to deal with a string of more than two words. I know how to find out if the string doesn't contain any spaces, but how would I find out if there's only one?

     

    Thanks!

  4. I see what you mean about the coordinates being always the same. Apparently in Adobe there IS no "text cursor", so even though the MOVE MOUSE TO TEXT CURSOR command does not error out, the mouse coordinates returned seem to be always the upper left corner of the screen. Brandon's original idea of having the macro running before the user selects text MIGHT work, by capturing the mouse-button-down coordinates and then the mouse-button-up coordinates. But in practical everyday use it will probably fail due to timing constraints -- the user simply is not going to pause long enough at the begin and end points to allow the macro to capture the mouse coordinates. The second difficulty I see is, the user may highlight data that spans several screens by dragging the mouse down below the bottom of the screen while the text scrolls off the top. Then, capture of mouse coordinates relative to the screen becomes useless.

     

    IF THE DATA SELECTED IS CONFINED TO A SINGLE SCREEN, WITH NO SCROLLING, then I still think what you want could be accomplished by scanning the screen for the selection color, finding where the color begins and ends, saving those coordinates, and using them to re-select (drag the mouse from beginning point to end point) after the highlighting tool has been invoked. The difficulty would be knowing what selection color to look for, adjusting for 16-bit vs. 24-bit vs. 32-bit color, and getting a scan routine that works fast enough.

     

    hi Bob,

     

    Yes, the data selected would be confined to a single screen. The user will be selecting only a word or phrase, most likely never more than about a line's worth at a time. The only exception would be if the desired word or phrase began on one page and ended on another. I've not looked into finding colors, but since the macros are intended to be used by different users on different systems, it seems as if the selection color could vary unpredictably. It's not an absolutely-must-have feature; it's a "would-be-extra-cool" feature that one user particularly wants. If only it could be done by keys instead of mouse, it'd be easy, but I can't change Acrobat or Reader! I have to finish up some other aspects of the macros now, and I'll look at this again later. Thanks for all your help.

  5. Very strange. It certainly seems that your solution is a good one. If the command MOVE MOUSE TO CURSOR POSITION is working, then GET MOUSE COORDINATES should certainly work.

     

    You should not have to click the mouse before trying to get its coordinates. I wonder if it would help to get rid of that command? Maybe the application is doing something funny when the mouse is clicked. But if you are clicking to assure Windows returns focus to your application, then yes you may need the click.

     

    After MOVE MOUSE TO CURSOR POSITION, try inserting a quarter-second or half-second delay, to give the application time to finish positioning the mouse before the macro continues.

     

    Are you getting mouse coordinates relative to the screen, or relative to the window? Whichever it is that is failing, try switching it to the other.

     

    Also, near the end of your logic:

    subtract 2nd set of coordinates from 1st, save in New Variable

    mouse left button down

    mouse move position by the amount in New Variable

    mouse left button up

    Instead of stepping the mouse one character at a time to the end of the text, simply move it to the coordinates you originally saved after your PRESS RIGHT-ARROW KEY. Ditto for stepping the mouse backwards to get to the beginning of your text -- if you can find a trick like PRESS RIGHT-ARROW KEY to automatically position the cursor there (HOME key maybe???) it will be much faster than single-stepping the cursor.

     

     

    Hi rberq,

    I tried taking out the mouse click and adding a delay. No difference. I tried a bigger delay (2 seconds), no difference.

     

    As far as what you say near the end your message, I'm not quite following. I'm not sure what you mean by "stepping the mouse backwards". The idea is to use stepping backwards by keys in order to obtain:

     

    #1 set of coordinates = where end of selection was

    #2 set of coordinates = where beginning of selection was

     

    at this point, the mouse is at #2, so we need to move it by the difference between #1 and #2. Supposing that #1 was 500,200, and #2 was 200,100, then if we're at 200,0, we need to move right 300,100.

     

    This whole thing is about working with PDF files. So far, in Adobe, can't get coordinates (I get numbers but they are meaningless as they are always the same no matter where I am). In PDF X-Change Viewer, can't get coordinates. In Foxit Reader, I get the coordinates. It sounds as if you can't get coordinates in every application.

     

    I'll try to attach a file with my macro.

     

    OK, the first macro I uploaded is wrong. The 2nd and 3rd are corrected and are the same (couldn't figure out how to delete attachments, thought I had deleted them so I uploaded again).

     

    THe good news is that the revised macro works in Foxit Reader -- the bad news is that it selects on the line above where the original selection was.

    ExperimentingWithSelections.mex

  6. OK, more testing has shown that the get coordinates thing just doesn't really work in this application. I was getting 0,0 at one point because I had my variables mixed up. When I got them straightened out, I saw I was getting the same coordinates no matter where I was. I think that idea would be the way to go *IF* that command worked, but it's no go in this application.

     

    There are a couple of similar applications I'll try the same thing in, though.

  7. hrmm thats not good.

     

    Try this.

    Open up notepad and type some gibberish in it.

    Activate the macro.

    ALT Tab over to the notepad again. (dont click anywhere because the macro waits for a left mouse click to pull the first coordinate)

    Left click at the beginning of the text (i.e. if you typed "gibberish" click just to the left of the "g")

    pause for a second

    Then left click at the end of selection.

    the it should go and highlight the selection and then copy it and display a text box with the copied information.

     

     

    Now, we should be able to integrate this into your current macro, how does the text on the first program get selected in the first place?

    Hi Brandon,

     

    That sorta kinda works. The amount of text it selects is unpredictable. But I'm working on another idea, see the message I just posted. The text in the first program is selected by the user -- it has to be as it's unpredictable, depends on the user's judgment.

  8. I think I've got an idea of how it SHOULD work, but the problem I'm having is with the get coordinates command. At one point in the macro it doesn't work, at another point it does.

     

    the idea is:

     

    copy the selection

    save the length of the selection in variable

     

    press right-arrow key (moves text cursor to end of where selection was)

    move mouse to text cursor location

    click mouse

    get mouse coordinates

     

    move left-arrow key the number of times = length of original selection

    move mouse to text cursor location

    click mouse

    get mouse coordinates

     

    subtract 2nd set of coordinates from 1st, save in New Variable

    mouse left button down

    mouse move position by the amount in New Variable

    mouse left button up

     

    The problem is, at the first time I try to get mouse coordinates, it gets 0,0. The second time, it gets coordinates, so I don't know why it wouldn't get them the first time. I've tested enough that I know the "move mouse to text cursor location" command is working.

  9. This should work with a MS Word document and some others:

     

    When your macro starts, data is already highlighted, so copy to clipboard and save in a text variable, T1.

     

    To reproduce the highlighting later, the macro will:

    Mouse click within the document screen to restore focus to the document.

    Ctrl-Home to go to beginning of document, or mouse click at upper left corner of the screen to stay on the same page.

    Ctrl-f or Alt-Edit-Find to open search box.

    Type T1 into the search box, type ENTER to do the search.

    At completion of the search, your text should again be highlighted.

     

     

    Hi rberq,

    That would leave the text "highlighted" in the sense of being selected (as if you were going to copy). That's not what I'm trying to do.

     

    In Adobe Acrobat, if you select text and copy it, then the text is still selected. But then if you click on the Highlighter tool (to make the text yellow), that text becomes deselected and the cursor no longer knows where it was. So you have to click on the Highlighter tool and then re-select the text if you want to make it yellow. The idea is to get the macro to both copy it and highlight it yellow without the user having to re-select the text. (In Word, this wouldn't be necessary -- in Word, when you select something, then copy it, then it's still selected, and you can click on the Highlight button to highlight it -- clicking on the Highlight button doesn't de-select it.)

     

    If the cursor knew where it had been, I might be able to select with Shift-arrow combinations from that point by the number of characters equal to the length of the original selection, but as far as I can see, selecting text to highlight it yellow only works with the mouse.

  10. Meg

     

    See attached macro. It will allow you to define the area to select. It waits for the mouse click at the beginning and then grabs the coordinates and then it waits for you to click at the end of the selection. it will then go back and highlight the text in between and then copy it to the clipboard. Have your macro then open the second tool and do whatever it needs with the text and then have it reopen the first tool and repeat the first part of the macro so it will automatically highlight the selection again.

     

    Just a note, wait a half beat after clicking at the front and the end of the selection. If you click and move at the same time, it will grab a wrong coordinate.

     

     

    Text_Selection_Macro.mex

    Hi Brandon,

     

    I tried this, but it seems to just not do anything. What I was hoping for was for the user to initiate the macro after they've selected the text (since this is the way the existing macro that I want to expand upon already works). As I suspected, this is probably not possible.

     

    Thanks.

  11. Apparently it's possible to select text in a macro if I know the mouse coordinates that I want.

     

    Is it possible to get the coordinates of an already existing selection, so that the macro could re-select the same thing again on that same page of the document? Suppose that when the macro starts, certain text is already selected (as if you were going to copy it). The macro copies it. Then the user has to select a different tool, which the macro can accomplish by keyboard shortcut -- but after the tool is selected, the previous text selection is no longer selected (that's just the normal way that the application we're working in works). Is there any way for a macro to save information about the previous selection such that it could re-select the same thing?

     

     

    Thanks.

  12. No, don't do that! Simply replace all multiple spaces with single spaces, as in Change " " to " " (all occurrences). Then my code will work.

     

    It's not a question of multiple spaces. It's spaces where a space should not be, in the middle of a word. For example, suppose you had a name like "John P. Pas solo." There shouldn't be a space between the two s's. So if I have the macro check the first space (doesn't fit parameters, thecharacter following the space is uppercase), then the second space (doesn't fit parameters, the character following the space is a period), then when it comes to the third space, it will fit the parameters (surrounded by lowercase letters) so the macro will now "know" that this space shouldn't be there.

     

    Aha, so the other problem is Firefox. Thanks, I'll look into that.

  13. Try this:

    - Extract each of the 3 characters into 3 string variables, say v1, v2 and v3

      If v1 >= a (don't ignore case)
     AND
     If v1 <= z (don't ignore case)
     AND
      If v2 = " "
     AND
     If v3 >= a (don't ignore case)
     AND
     If v3 <= z (don't ignore case)
      It's what I want

    Does that do it (I'll leave you to write the code)?

     

    Hi Paul,

     

    Thanks. I think that would do it if I already knew where the three characters are in the string, but I will not know that. I want to find any two lowercase characters that are separated by a space (i.e., every word after a space should begin with a capital letter, but sometimes there are unwanted spaces in the middle of a word, hence before a lowercase character). To use the above, I guess I would have to loop through the variable finding all the spaces and then testing the surrounding characters for case. I will work on that.

     

    What I was hoping for was some way to look for the combination as a search parameter, like "if <string> contains <[a-z] [a-z]> then...

     

    By the way, when writing a forum message, every time I try to type an apostrophe, my cursor focus gets moved out of the message and into a "Find" box. Is this to be expected?

  14. Another thought is to save the "string" to a variable and use that variable as the Prompt, with instructions informing the user

    what part of the "string" is going to be replaced.

     

    [<snip>

    Without knowing exactly what it is you're trying to do, I can only offer limited advice.

     

    Hi Scasper,

     

    Both of your suggestions work perfectly! I think the first one is all I need for my current purpose, but I am certainly saving both of them. Yes, I know about saving the variables. What I was trying to do is to have the user delete unwanted characters in a string. so that the string would work correctly with the string-manipulation routines that follows. The content of the strings and the placement of the unwanted characters are almost all unpredictable, so there was no way for the macro to determine what to delete.

  15. It's a little extra effort, but you can save a Txx variable to an environment variable, which you can call anything you want. You can indirectly save a Dxx or Nxx variable to an environment variable by first converting it to text -- then of course you have to convert it back when you retrieve it.

     

    I have several groups of macros that must coexist on the same PC. Each group is consistent within that group as to how the variables are used; but the groups could step on each other. So I wrote separate save-variables and restore-variables macros for each group. All 99 integer variables are converted to text and stacked (space delimited) in a single text variable that is then saved in an environment variable. All 99 decimal variables are likewise converted and stored in a single environment variable. The 99 text variables must each be stored in its own individual environment variable. They can't be stacked unless you can come up with a delimiter character that will never appear as valid text.

     

    The above works well, runs surprisingly fast, and is a royal pain in the butt. When I convert to ME Pro, one of the first things to do will be assign unique names to critical variables.

     

    It's a text variable that I want to save, so that sounds as if it would work. I'll try it.

     

    I guess this is a new question, but I have a macro that calls another one, and I don't seem to have to save/restore the main variable (the main macro copies the clipboard, the called macro manipulates that text in various ways, then the main macro takes over and does more stuff, and supplies the modified text to another program a few steps later. It works without saving/restoring the variable. Apparently I only have to save/restore the variables if they'll be used by a different macro entirely (in the same session), that runs separately from the macro in which I saved the variable -- but not if they're being used by a macro called while the original macro is running. I've wondered how "safe" this is to do, but it helps me because all the macros used this called routine, so if I want to modify it, I'll only have to modify that one macro instead of all of them.

  16. I'm pretty sure that is correct (except that you can also save all variables of all types with a single command, of course).

    .....

     

    The best thing to do, in my personal experience, is to avoid this kind of complication by using a new variable as often as possible. It

    can get a bit confusing, so if you utilize a lot of macros you may want to also build a spreadsheet helping you to keep track of which

    variable is used for which information or which kind of information. For example, T99 is solely used to hold Account Numbers in

    my macros, whereas T1-T10 are my "throw-away" variables - the variables I will use in just about every macro specifically for that

    macro (or series of macros, if I generally run the same 2 or 3 in a row in the same sequence). Any information being saved to a

    variable that I may need to call back sporadically, or otherwise not immediately gets saved to various other variables. For example, I

    have 10 different clipboard-copy commands (and 10 corresponding clipboard-paste commands) that I picked up off the Macro Express

    website. The default variable locations are T10-T19 (I think), but I changed them to T81-T90 since I use the lower numbers on various

    occasions and don't want to mess up my clipboards.

     

    And even better option is to upgrade to ME Pro where you can define your variable names. You are no longer limited to 99 text

    variables, 99 Integer Variables, and 99 Decimal Variables. You still have access to use T1 - T99, but you can create unlimited additional

    variables that you name yourself, such as %accountnumber% and %clipboard%. And you can even build arrays of these variables

    (such as %clipboard[1]% - %clipboard[99]% etc.

     

    Good luck!

     

    A spreadsheet -- that is a truly great idea! I'm used to VBA where I can name variables with names that have some connection to reality. In the last macro I wrote, I had to write out pseudocode with imaginary meaningful variable names and put the Txx and Nxx numbers above the meaningful names in order to figure out what I needed.

     

    ME Pro sounds great for me, but what I'm doing is creating a set of macros for other people, who won't want to get ME Pro. I would assume that plain ME can't read the custom-name variables that you create in ME Pro, right?

     

    Thanks for the suggestions.

  17. What do you mean by "during a session of making changes to the macros"? I have been puzzled a couple times where a window title partially matched a macro title, and using the ME script editor caused the title-activated macro to run. So if ME tried to activate a window, which one will it activate, the script editor window or the "real" application window?

     

    Hi rberg,

     

    I mean that if I'm just using or testing the macros, just running them, this problem never happens. It only happens when I have been making changes to the macros since the last time I opened ME. I have four sets of similar macros [that do the same thing in four different situations] which are "evolving" as I keep figuring out new things and adding them. But this problem doesn't happen every time I make changes.

     

    Something along the lines of what you're talking about happened to me once, although it didn't run the macro. It just switched me into ME instead of switching me where I wanted to go. So I changed my macro names so that they couldn't possibly be confused with the application window that I wanted. If you have a macro open in the Explorer at the time, then you could have, say, one window title of FileMaker and a window title of FileMakerMacro2 in ME. If I remember correctly, it activated the script editor window instead of the application window. So I was back in ME and didn't know why at first. :) If you don't have the macro open in the Explorer, then the macro title won't be in the ME window title, so the name won't matter.

  18. I have run into problems before with window controls... when I save a line using the get control utility and then restart the program the macro won't work right until I run the get control utility again.... maybe you are experiencing a similar problem?....

     

    If you used the running window titles menu to grab the menu title instead of entering it manually (remember that it WILL accept a partial match even if it doesn't begin with the word - such as "Microsoft Outlook" in that field WILL find the "Calendar - Microsoft Outlook" window) then you may need to go back in and select it again or manually enter a partial title.

     

    Hope that helps!

     

    -Rand

    Hi,

     

    Well, with your window control example, you seem to be describing a predictable problem, and this problem isn't predictable. It happens only once in a while and only durng a session of making changes to the macros. I can't predict when it will happen and I can't make it happen on purpose.

     

    I have manually entered the window title and it is a partial match. It's not that the match doesn't work. It's that the whole command only partially works now and then -- but not that often, since I've changed these macros thousands of times and it's only happened twice. (Of course now when I want it to happen so that I can test whether rebooting Macro Express but not rebooting Windows would fiix it, it's not happening.) :)

  19. Why would an Activate Window command that has worked succesfully so far in 32 macros suddenly stop working? I tried adding a "Wait for Window Title to Appear," but that didn't help. What happens is that in the window that is active when the Activate Window command should occur, the title bar appears to lose focus. But the window that was supposed to activate doesn't, and there's no "running man" icon, error message, etc.

    I'm doing the same thing I've done many times, so I'm baffled why it would stop working.

     

    [added later]

    Now I realize this has happened once before, in a similar situation (I had been changing other parts of the macro and then testing, and the other parts that I'm changing appear to have nothing to do with the problem). Although I haven't had any other problem related to changing-saving-then-retesting, now I'm wondering if it's rebooting Macro Express that made the difference, not rebooting the machine. I don't think I can reproduce the problem on purpose, but if it happens again I'll try rebooting Macro Express first.

  20. The Advanced Installation topic in the help describes Silent Install and Installation Options. You can use the Installation Options (via the /M command line switch) without using Silent Install (/s). You could use a /M with a file containing the /MACROFILEDEST option.

     

    When Macro Express is installed the .mex and .mxe file extensions are registered with windows. You can then 'run' a macro file to load it into Macro Express. For example, if you have a macro file named 'empty.mex' you can type 'empty.mex' in a Command Prompt window or the Run dialog to load that macro file into Macro Express. (You may need to include the path to the macro file.) This will also work with a .bat file. So, another possible solution would be to have a batch file run the Macro Express installer and, at the end, 'run' the macro file to load it.

     

    If you need more specific help please contact the Support people at Insight Software Solutions.

     

    I don't think I made my question clear enough. I believe the help file gives the same info as Macro Express Explained, which is what I read. Even if I don't use the /S switch, the user still has to use Start, Run, navigate to the file, etc., and see the screen go black temporarily. That is exactly what I don't want. So the best thing is to give them instructions to run the usual installation with options so that the Editor is installed but not loaded at startup, and have them open the editor from the context menu of the system tray icon and then load my file. After that they won't need the Editor unless they decide to change the keyboard shortcuts for activation since my file will be loaded by default from that point on.

  21. When distributing files to macro users, there is no way short of a silent install to have a different macro file loaded by default -- correct? The users will not need to use the Editor unless they decide to change the activation shortcuts, in other words, most of them won't need to use it, but I have to install it because if I don't, then those who want to change the keyboard shortcuts won't be able to. (These are individuals in different locations on their own computers, not on a network.) I'd like to keep them out of the editor to keep things as simple as possible. I tried creating a silent install but I think that would be inadvisable for these users, to whom a regular installation process will seem more familiar than the screen going blank during the silent install. But they'll have to use the Editor in order to load my MEX file, unless I have them not launch the program at installation end and then rename my MEX file to macex.mex. That doesn't seem like a good idea because it would make it harder for me to keep track of which version of my file they have (there are several versions for different situations that do the same thing in different programs).

  22. Due to a medical problem, I'm trying to reduce the amount of typing I do each day, but still get the job done.

     

    I'm a computer programmer, so not typing isn't much of an option.

     

    I've made some progress, I've created a macro that asks for a name and then generates a basic shell of a function. I've got another that allows me to select from a list, and it inserts a suitable 'snippet' of code. Together these save me somewhere around 5000 & more keypresses a day.

     

    What else could I do? Do you have something similar that has worked for you? Any ideas are welcome.

     

    Have you thought about trying voice recognition? Dragon Naturally Speaking Professional has very extensive macro capabilities, which would be very easy for you to use with your programming background, and you can use it in combination with Macro Express. It is expensive, but may be worth it in your situation. The less expensive version, Dragon NaturallySpeaking Preferred, has much more limited macro capabilities, but I believe you would be able to speak the shortcut keys that you have programmed into Macro Express. Also, some programmers have come up with ways to write more macros in Dragon NaturallySpeaking Preferred by using additional languages. I don't know much about that because I have the Professional version. If you'd like more info, please send me a private message through the menu next to my username.

×
×
  • Create New...