Jump to content

Recommended Posts

Posted (edited)

How would i input the text of an instant message? i can see what i type in the visible text with the autoit window spy, but how would i put that text into a variable?

Brett

Edited by brett
-Brett
Posted

When i do that, i float my mouse around and get one of these, but all in just about the same place so i dont know why the names are changing...but i can't get any text with any of them. The only thing i got text with is WinGetText(), but i got all the html...

I get all of these names for the last control under mouse:

_Oscar_PersistantCombo1 (Hidden), Edit1, Ate32Class1, ComboBox1

For the HTML from WinGetText(), i get:

<HTML><BODY BGCOLOR="#ffffff"><B><FONT COLOR="#0000ff" LANG="0">BrettHomeComp<!-- (9:48:59 PM)--></B></FONT><FONT COLOR="#0000ff" BACK="#ffffff">:</FONT><FONT COLOR="#000000"> hey</FONT><BR><BODY BGCOLOR="#ffffff"><B><FONT COLOR="#ff0000">BrettHomeComp<!-- (9:49:00 PM)--></B>:</FONT><FONT COLOR="#000000"> hey</FONT></BODY></HTML>

But i need to get the actual message from the instant message, which is "hey", how can i get only that?

-Brett
Posted (edited)

if you wanted to clean out the HTML, you could try this quick parse:

$x='<HTML><BODY BGCOLOR="#ffffff"><B><FONT COLOR="#0000ff" LANG="0">BrettHomeComp<!-- (9:48:59 PM)--></B></FONT><FONT COLOR="#0000ff" BACK="#ffffff">:</FONT><FONT COLOR="#000000"> hey</FONT><BR><BODY BGCOLOR="#ffffff"><B><FONT COLOR="#ff0000">BrettHomeComp<!-- (9:49:00 PM)--></B>:</FONT><FONT COLOR="#000000"> hey</FONT></BODY></HTML>'
$test=_HTMLtrim($x)
msgbox(1,"",$test)


func _HTMLtrim($_aX)
$aX=Stringsplit($_aX,"<")
$_out=""
for $i=1 to $aX[0]
if Stringinstr($aX[$i],">") then $aX[$i]=StringTrimleft($aX[$i],Stringinstr($aX[$i],">"))
$_out=$_out & $aX[$i]
next
return $_out
endfunc

edit..

doesn't work if you use > or < in the chat.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Posted

if you wanted to clean out the HTML, you could try this quick parse:

$x='<HTML><BODY BGCOLOR="#ffffff"><B><FONT COLOR="#0000ff" LANG="0">BrettHomeComp<!-- (9:48:59 PM)--></B></FONT><FONT COLOR="#0000ff" BACK="#ffffff">:</FONT><FONT COLOR="#000000"> hey</FONT><BR><BODY BGCOLOR="#ffffff"><B><FONT COLOR="#ff0000">BrettHomeComp<!-- (9:49:00 PM)--></B>:</FONT><FONT COLOR="#000000"> hey</FONT></BODY></HTML>'
$test=_HTMLtrim($x)
msgbox(1,"",$test)


func _HTMLtrim($_aX)
$aX=Stringsplit($_aX,"<")
$_out=""
for $i=1 to $aX[0]
if Stringinstr($aX[$i],">") then $aX[$i]=StringTrimleft($aX[$i],Stringinstr($aX[$i],">"))
$_out=$_out & $aX[$i]
next
return $_out
endfunc

edit..

doesn't work if you use > or < in the chat.

w0w that code is confusing i dont get it lol :D
-Brett
Posted

func _HTMLtrim($_aX)
$aX=Stringsplit($_aX,"<"); make an array each new element starts with <
$_out=""; set up a blank output
for $i=1 to $aX[0]; for next set on all elements.
if Stringinstr($aX[$i],">") then $aX[$i]=StringTrimleft($aX[$i],Stringinstr($aX[$i],">")); if you find a > remove all text before it.
$_out=$_out & $aX[$i]; combine what is left.
next
return $_out; return combined stuff.
endfunc

AutoIt3, the MACGYVER Pocket Knife for computers.

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
×
×
  • Create New...