| View previous topic :: View next topic |
| Author |
Message |
rcarruth
Joined: 01 Sep 2008 Posts: 10
|
Posted: Sun Sep 07, 2008 4:51 pm Post subject: Help with string replacement |
|
|
I have a web based form that continually fill out during the day, in the form are several text boxes that holds certain data. What I want to do is to be able to create a script where when I click on the right mouse button while it hovers over one of the text boxes it will automatically put the data in. I've looked in the help file at the StringReplace command but I cannot figure out how to get the script to read what is in the text then replace it with the data.
I've also looked into using the auto replace method but again need to figure out how to get the control read. Any help in getting me started would be appreciated. _________________ Bob Carruth |
|
| Back to top |
|
 |
Icarus
Joined: 24 Nov 2005 Posts: 507
|
Posted: Mon Sep 08, 2008 9:35 am Post subject: Re: Help with string replacement |
|
|
Not sure what exactly you are looking for, but maybe this will help.
In the below code, you can right click on a field (provided by a sample GUI, can also be an HTML field) and then it will copy the text currently in it, so that it can be evaluated and according to its contents, paste an alternative text.
StringReplace is intended to replace specific characters inside a string.
| Code: |
#SingleInstance Force
DataStart := "Right click this field"
Data1 := "Hello World"
Data2 := "I am the second one"
Gui Add, Edit, w200, %DataStart%
Gui Show
Return
RButton::
Clipboard := "" ; Empty the clipboard
Send {LButton}{End}+{Home}^c ; Copy the selected text in the field
ClipWait 2
If( Not ErroLevel ) {
If( Clipboard = DataStart ) ; See what we copied and act accordingly
Send %Data1%
Else
Send %Data2%
}
Return
|
_________________ Sector-Seven (Music and Utilities) |
|
| Back to top |
|
 |
rcarruth
Joined: 01 Sep 2008 Posts: 10
|
Posted: Mon Sep 08, 2008 11:27 pm Post subject: |
|
|
Thanks Icarus, the code you sent me worked the way I wanted, just had to make a few tweaks to it to suit my exact needs. But I now understand how to read the data in the fields which was my major problem before. Thanks again. _________________ Bob Carruth |
|
| Back to top |
|
 |
|