Technical support and scripting issues
Moderators: Dorian (MJT support), JRL
-
NexxTech
- Newbie
- Posts: 5
- Joined: Tue Nov 11, 2008 11:40 pm
Post
by NexxTech » Tue Nov 11, 2008 11:49 pm
Hi All,
This is my first day using Macro Scheduler, read the tutorials and have been using it for a few hours.
I want to write a macro to copy some text from the screen, manipulate it in some way (like uppercasing some words, formating others) and then replacing the selected text with the new formatted text. I have all the keystrokes in place I am just not able to pass in the clipboard data into a VBScript function. I have created a very simple macro, maybe someone can tell me why it does not work?
Code: Select all
VBSTART
Function MyLower(var)
MyLower = LCase(var)
End Function
VBEND
PutClipBoard>Hello World
WAIT 1
GetClipBoard>text
VBEval>MyLower(text),text1
MessageModal>text1
The message dialog is blank - any idea why "Hello World" is not displayed in upper case in the dialog box?
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Nov 12, 2008 1:07 am
I'm not your best source for VBscript but in this case I think I know the answer. Your VBEval line should read:
VBEval>MyLower("%text%"),text1
Vbscript wants quotes around text and Macro Scheduler wants percents around the variable for proper evaluation.
I would also like to point out that MAcro Scheduler can do this particular task without VBScript by using "complex expression". (see help)
Code: Select all
PutClipBoard>Hello World
WAIT 1
GetClipBoard>text
Let>text1={lower(%text%)}
MessageModal>text1
-
NexxTech
- Newbie
- Posts: 5
- Joined: Tue Nov 11, 2008 11:40 pm
Post
by NexxTech » Wed Nov 12, 2008 10:11 am
JRL wrote:I'm not your best source for VBscript but in this case I think I know the answer. Your VBEval line should read:
VBEval>MyLower("%text%"),text1
Vbscript wants quotes around text and Macro Scheduler wants percents around the variable for proper evaluation.
I would also like to point out that MAcro Scheduler can do this particular task without VBScript by using "complex expression". (see help)
Code: Select all
PutClipBoard>Hello World
WAIT 1
GetClipBoard>text
Let>text1={lower(%text%)}
MessageModal>text1
That did it!
Thanks.
The reason why I want to VBScript is because I would like to do quite a bit of manipulation of the text.
My idea is to select addresses from a webpage, and paste them, nicely formatted into a address label application for printing. So this parsing would for example, trimming, removing multiple spaces in between words, uppercase the first letter of each word, look for zip codes or postcodes and uppercase them completely (so through the use of regular expressions) hence VBscript.
-
NexxTech
- Newbie
- Posts: 5
- Joined: Tue Nov 11, 2008 11:40 pm
Post
by NexxTech » Wed Nov 12, 2008 2:04 pm
Ah thanks for the tip - very useful link