Jump to content

StringReplace not working...


Recommended Posts

Okay, here is my issue. I'm trying to use StringReplace (to get rid of some newline characters and tabs from an entry in the clipboard), but when I use ClipGet() and then StringReplace, it won''t replace anything.

HotKeySet("^+d", "CreateGetterSetter")

#Include <string.au3>

While 1
    Sleep(0x7FFFFFFF)
WEnd

Func CreateGetterSetter()
    Send("{CTRLDOWN}c{CTRLUP}")
    $text = ClipGet()
    StringReplace($text,@CRLF," ")
    StringReplace($text,@LF," ")
    StringReplace($text,@CR," ")
    StringReplace($text,@TAB,"")
    MsgBox(0, "New string is", $text)
EndFunc

Any ideas as to why this is happening? B)

Link to comment
Share on other sites

i am really not sure...

but try this

HotKeySet("^+d", "CreateGetterSetter")

#Include <string.au3>

While 1
    Sleep(0x7FFFFFFF)
WEnd

Func CreateGetterSetter()
    Send("{CTRLDOWN}c{CTRLUP}")
    $text = ClipGet()
    $text = StringReplace($text,Chr(13)," ")
    $text = StringReplace($text,Chr(10)," ")
  ;StringReplace($text,Chr(13)," ")
    $text = StringReplace($text,Chr(9),"")
    MsgBox(0, "New string is", $text)
EndFunc

8)

OOOPS..

edit dumb mistakes

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

  • Developers

Thx for the quick replies! B)

Hmmm -- still won't work. Perhaps it has to do with HotKeySet, since if I don't use a hotkey to call the function, it replaces the clipboard text no problem.

Is this a bug?

Should work... can you show your updated code ?

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...