Jump to content

Replace text


Guest keystrokeelim
 Share

Recommended Posts

Guest keystrokeelim

Hello,

I am new to this, but find it quite useful. To streamline one funtion, I would like to replace some text. Is it possible? The data is "pasted" into an index value in a database. While it is highlighted in the index field is it possible to check the value, "AA" for example, and replace with another value, "CAT" if it is AA. Otherwise, just continue on with the script. I have played around with stringreplace, but can't get it to work. Perhaps it was intended for something else.

Any help would be greatly appreciated.

Link to comment
Share on other sites

  • Developers

Hello,

I am new to this, but find it quite useful.  To streamline one funtion, I would like to replace some text.  Is it possible?  The data is "pasted" into an index value in a database.  While it is highlighted in the index field is it possible to check the value, "AA" for example, and replace with another value, "CAT" if it is AA.  Otherwise, just continue on with the script.  I have played around with stringreplace, but can't get it to work.  Perhaps it was intended for something else.

Any help would be greatly appreciated.

<{POST_SNAPBACK}>

Make sure you have the format:

$var = StringReplace($Var,"Cats","Dogs")

If that doesn't solve it show us the script codeyou have problems with...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest keystrokeelim

Make sure you have the format:

$var = StringReplace($Var,"Cats","Dogs")

If that doesn't solve it show us the script codeyou have problems with...

<{POST_SNAPBACK}>

Ok...here is the last bit of code. (I didn't want to post 200 lines of sloppy stuff)

I have a Dim $var = "AA" at the very top of the code. It still does not seem to work. Again, this is a value in a database field. Hopefully it is something simple. Thanks for you assistance.

Send("+{INSERT}")

MouseMove(353, 101)

Sleep(500)

MouseClick("left")

;Clear Notepad

WinActivate("Untitled - Notepad")

WinWaitActive("Untitled - Notepad")

Send("{RIGHT 1}")

Send("^A")

Send("{DEL}")

WinKill("Untitled - Notepad")

MouseClick("left")

;Send("{HOME}")

$var = StringReplace($Var,"AA","CAT")

Link to comment
Share on other sites

  • Developers

Ok...here is the last bit of code.  (I didn't want to post 200 lines of sloppy stuff)

I have a Dim $var = "AA" at the very top of the code.  It still does not seem to work.  Again, this is a value in a database field.  Hopefully it is something simple.  Thanks for you assistance.

<{POST_SNAPBACK}>

Well this code proves that the StringReplace works...

Dim $var = "AA"
$var = StringReplace($Var,"AA","CAT")
MsgBox(262144,'Debug line ~3','Selection:' & @lf & '$var' & @lf & @lf & 'Return:' & @lf & $var);### Debug MSGBOX

Not sure what you are trying to do and what you mean by database field ...

you can also PM the sloppy script so i can have a look at it... :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...