AutoHotkey Community

It is currently May 26th, 2012, 6:59 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: May 20th, 2009, 1:17 am 
hmm ok, im trying to make this cool messenger for when im at work( :D) but i can't get the basic function to work. basically what i want is for the script to wait until a message comes , and then retrieve the information form the message, and add it to an edit field in a gui( keeping the older text in the edit aswell). i have achieved everything exept to keep the older text that is; it updates when a new message comes but the older text is removed. also it's kind of glitchy xD, it seems that when i give the gui(with edit field) focus, the text goes back to what it origonaly was , unless i drag somthing over it..it's weird lol ..anyways, here's my script:
Code:
Gui, Add, Edit, x6 y0 w460 h370 +ReadOnly,Wecome To Robbie's Messenger
Gui, Show,  +NoActivate,Messenger By Robbie
loop{
winwait,Messenger Service
controlgettext,oldtxt,edit,Messenger By Robbie
wingettext,newtxt,Messenger Service,from
WinClose , Messenger Service
StringReplace, newtxt, newtxt, OK,, All
fulltxt=%oldtxt%`n %newtxt%
Gui, Add, Edit, x6 y0 w460 h370 +ReadOnly,%fulltxt%
Gui, Show, +NoActivate,Messenger By Robbie
}
GuiClose:
ExitApp

I hope it's somthing simple :) , thanks for any responses


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 1:20 am 
Also, for those that don't know, you must enable, and start the messenger service ( Windows XP), and then to test just use "Net Send * Hello" without the quotes in the command prompt.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 1:22 am 
Offline

Joined: March 9th, 2007, 2:47 am
Posts: 509
Location: Unknown
well if you view the variable oldtext there is nothing in it. this is how I checked
Code:
Gui, Add, Edit, x6 y0 w460 h370 +ReadOnly,Wecome To Robbie's Messenger
Gui, Show,  +NoActivate,Messenger By Robbie
loop{
;winwait,Messenger Service
controlgettext,oldtxt,edit,Messenger By Robbie
msgbox %oldtxt%
}

So you are retreiving the text wrong. You should just keep it in a variable in the beginning instead of retrieving it from the edit box.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 1:32 am 
hmm thanks for the quick response, i just tried using wingettext instead of control, but i think my problem is that it has a difficult time retrieving text from an edit field. would you, or anyone for that matter, have a suggestion on a better way to keep the old text, and add the new text?
thanks again


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 1:51 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
I don't think your text was ever removed, it was never there because you never got it:

Code:
ControlGetText, oldtxt, Edit1, Messenger By Robbie


And you should be able to pretty much put it back the same way you got it:

Code:
WinGetText, newtxt, Messenger Service
WinClose , Messenger Service
StringReplace, newtxt, newtxt, OK,, All
fulltxt := oldtxt "`n" newtxt
ControlSetText, %fulltxt%, Edit1, Messenger By Robbie

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 2:11 am 
hmmm okay well here's the updated script
Code:
Gui, Add, Edit, x6 y0 w460 h370 +ReadOnly,Welcome To Robbie's Messenger
Gui, Show,  +NoActivate,Messenger By Robbie
loop{
winwait,Messenger Service
ControlGetText, oldtxt, Edit1, Messenger By Robbie
wingettext,newtxt,Messenger Service,from
WinClose , Messenger Service
StringReplace, newtxt, newtxt, OK,, All
fulltxt := oldtxt "`n" newtxt
ControlSetText, %fulltxt%, Edit1, Messenger By Robbie
}
GuiClose:
ExitApp

, but now it doesn't update the edit field at all, it just stays "Welcome To Robbie's Messenger " the whole time :p, i hope i can get this working, any other suggestions are greatly appreciated!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 2:33 am 
sorry for the double post..again..but i think i am going to take a different approach, i am going to try to save the "newtxt" to a file, and then read the file, and display it. seems simple right? i have a feeling their will be errors >.> :p[/code]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 2:55 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Try this:

Code:
Gui, Add, Edit, x6 y0 w460 h370 ,Welcome To Robbie's Messenger ; removed read-only attribute
Gui, Show,  +NoActivate,Messenger By Robbie
loop{
winwait,Messenger Service
ControlGetText, oldtxt, Edit1, Messenger By Robbie
wingettext,newtxt,Messenger Service,from
WinClose , Messenger Service
StringReplace, newtxt, newtxt, OK,, All
fulltxt := oldtxt "`n" newtxt
ControlSetText, %fulltxt%, Edit1, Messenger By Robbie
}
GuiClose:
ExitApp

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 3:35 am 
nope, still no dice, i'll try my new method, and let ya know whats up


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 5:00 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Gah, I did it backwards:

Code:
Gui, Add, Edit, x6 y0 w460 h370 ,Welcome To Robbie's Messenger ; removed read-only attribute
Gui, Show,  +NoActivate,Messenger By Robbie
loop{
winwait,Messenger Service
ControlGetText, oldtxt, Edit1, Messenger By Robbie
wingettext,newtxt,Messenger Service,from
WinClose , Messenger Service
StringReplace, newtxt, newtxt, OK,, All
fulltxt := oldtxt "`n" newtxt
ControlSetText, Edit1, %fulltxt%, Messenger By Robbie
}
GuiClose:
ExitApp

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2009, 8:18 pm 
Hey ! , it works! Thanks for this sinkfaze, i really appreciate it!


Report this post
Top
  
Reply with quote  
 Post subject: microsoft messenger chat
PostPosted: May 21st, 2009, 8:32 pm 
Offline

Joined: November 26th, 2008, 4:16 pm
Posts: 32
Here's an update for you so that you can chat within the same window!

Code:
Gui, Add, Text,, PC name to send messenger msg to.
Gui, Add, Edit, vPCName
Gui, Add, Text,, What do you have to say today?
Gui, Add, Edit, vSpeak

Gui, Add, Button, x10 y95 Default, &Go
Gui, Add, Button, x40 y95  Default, Clear &Log
Gui, Add, Button, x10 y125 Default, Clear &PCName+msgbox
Gui, Add, Edit, x185 y0 w460 h370 ,Welcome To Robbie's Messenger ; removed read-only attribute
Gui, Show,  +NoActivate,Messenger By Robbie

loop{

winwait,Messenger Service
ControlGetText, oldtxt, Edit3, Messenger By Robbie
wingettext,newtxt,Messenger Service,from
WinClose , Messenger Service
StringReplace, newtxt, newtxt, OK,, ;Removed ALL just incase you want to reply with " OK "
fulltxt := oldtxt "`r`n" newtxt
ControlSetText, Edit3, %fulltxt%, Messenger By Robbie

}
GuiClose:
ExitApp

ButtonGo:
Gui, Submit, NoHide
if pcname = ;
{
msgbox, Who are you talking to?
return
}
if speak = ;
{
msgbox, What do you want to say?
Return
}
else
Run, %comspec% /k net send %pcname% %Speak%
sleep, 500
WinClose, %comspec%
EnvSet, PCName,
EnvSet, Speak,
Return

ButtonClearLog:
Gui, Submit, NoHide
ControlSetText, Edit3, , Messenger By Robbie
Return

ButtonClearPCName+msgbox:
Gui, Submit, NoHide
ControlSetText, Edit1, , Messenger By Robbie
ControlSetText, Edit2, , Messenger By Robbie
Return


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: dra, Exabot [Bot], rbrtryn and 58 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group