Automaton27 Posted March 25, 2011 Report Share Posted March 25, 2011 Hello gentleman, I have had Macro Express for about a week now. I have been looking for a way to have the cursor move to a comma in a field. For example, "wood,alder". So, in this example I would want the cursor to move to the comma after wood. Is there any way to accomplish this? I searched the forums yesterday and couldn't find anything similar. Thanks for any help, Ben Quote Link to comment Share on other sites More sharing options...
acantor Posted March 25, 2011 Report Share Posted March 25, 2011 I can think of a few ways to do this. The strategy most likely to succeed goes something like this: 1. Select the entire field: use Ctrl + A or Home, Shift + End 2. Copy the text to the clipboard 3. Place the content of the clipboard in a text variable. 4. Check if the text variable contains a comma. If not, exit. 5. Get the length of the text variable. 6. Starting at the first character, check the nth character until the comma is found. 7. Place the cursor at the start of the field. Home should do it. 8. Move right n characters. Quote Link to comment Share on other sites More sharing options...
Automaton27 Posted March 25, 2011 Author Report Share Posted March 25, 2011 Alan, I really appreciate your quick answer, you are the man! The information will always have a comma, does that change anything? Also, I haven't really tried the variable commands yet. They are definitely more complicated then the things I have been doing so far. Is there maybe a how-to guide, or is it just a trial and error situation? Thanks tons, Ben Quote Link to comment Share on other sites More sharing options...
acantor Posted March 25, 2011 Report Share Posted March 25, 2011 The information will always have a comma, does that change anything? Also, I haven't really tried the variable commands yet. They are definitely more complicated then the things I have been doing so far. Is there maybe a how-to guide, or is it just a trial and error situation? If the field will always contain a comma, you can probably leave out the step of testing for the presence of one. The help system in Macro Express is excellent, as is the assistance that you can get on this forum. Finally, however, the best way to learn to use variables is trial and error experimentation. Take a stab at the problem, one step at a time. For example, begin by writing a macro to select the field. Once it is working, expanded to copy the text to the clipboard. (At this point, you can "prove" that macro is working by pasting into a word processor or text editor.) The next step is to copy whatever is in the clipboard into a text variable. This is a single instruction in Macro Express. Then continue on, one step at a time, until the whole thing is working. If you are a novice scripter, the entire project may take hours (or days) to iron out the wrinkles. If you encounter problems -- almost a given if this is your first exposure to variables -- know that you are on the right forum! If you discover that you can't pull yourself away from the project, then you may find yourself becoming a regular contributor to this forum. Addendum: Just for fun, I scripted this using Macro Express Pro. Rather than give away the solution, I invite you to try first. Macro Express 3 is perfectly adequate for the job. My script has only eight lines of code, and in the end, only required six of the eight steps I set out in my original reply. Quote Link to comment Share on other sites More sharing options...
Automaton27 Posted March 25, 2011 Author Report Share Posted March 25, 2011 Thanks Alan, I really appreciate all of the help. I have already been able to utilize many of Macro Express' features, and find it an awesome product. I use this at work, so I will try the variables tomorrow, thanks a bunch! Thanks again, Ben Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.