Sign in to follow this  
Followers 0
andrew.arnott

StringReplace not working...

6 posts in this topic

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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0