XxXFaNtA Posted April 5, 2006 Share Posted April 5, 2006 Hi Everyone I started making a small "Away"-Script for a Chatprogram called XFire.If someone writes a message to me while i'm dunno...at work...it responses an away-message + the time since i'm away.The Script looks like this:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Away Message Plus ;; v0.3 ;; ©by XxXFaNtA '06 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#include <file.au3>#include <Date.au3>Opt("WinDetectHiddenText", 1)Opt("WinTitleMatchMode", 4)AdlibEnable("Timer", 50)Global $Secs, $Mins, $Hour, $Time$savedir = @DesktopDir &"\Messages.txt"$timer = TimerInit()$peter = "00:00:00"$msg = InputBox("Away Messanger","Put in your Away Message");; Deleting the old History $file = FileOpen($savedir,2) FileWrite($file,"*** Away Message History ***"& @CRLF) FileClose($file)While 1;; Getting name of the XFire Chatwindow$handle = WinGetHandle("classname=ChatSkinWnd");; Getting the Text out of the Window (oberes Chatfenster)$text = ControlGetText($handle, "", "RichEdit20W1");; unteres chatfenster$chatfenster = ControlGetText($handle, "", "RichEdit20W2");; Searching for Substring ":"$result = StringInStr($text, ":")$file = FileOpen($savedir,1)If $result <> 0 AND NOT $chatfenster = $msg Then;; $file = FileOpen($savedir,1) FileWrite($file,$text & @CRLF) ControlSend($handle, "", "RichEdit20W2", $msg & "(since "& $Peter &"){enter}") WinKill($handle, "");; FileClose($file)EndIfFileClose($file)WEndFunc Timer() _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs ) Local $sTime = $Time ; save current time to be able to test and avoid flicker.. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime <> $Time Then $peter = $TimeEndFunc ;==>Timer#csTO-DO:- Saving the Persons, so you can call them back (no problem)- Menü (Exit, About, Some Texts,...)- 2 Specials: - Counting howlong someone is afk..Example: Person1: Hi. Are you there? Person2(You): Sry, but i'm afk since 3:16 Minutes (WORKS) - Counting backwards till the person is back..Example: Person1: Hi. Are you there? Person2(You): Sry, but i'm afk (i'll be back in 21:44 Minutes)-When you Close the Program, a MsbBox should pop up and show how many people have written a message (hard) OR how many messages you got (counting the lines ans searching for : ) -#ceNOW the Problem is the Timer...It should start when $msg has a value (so after he filled in the InputBox)...i think i tried as condition for the Function $msg <> "" but that didnt work Can someone help me? (ah and another smal question..how can i download + read a xml-file and search for special info?) /[center][/center] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 5, 2006 Moderators Share Posted April 5, 2006 I don't have time at the moment to look through your script... but your second question... I made a script to help someone the other day do this here: http://www.autoitscript.com/forum/index.ph...ndpost&p=168994Maybe you can get the idea... you may need to replace the code tags... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
XxXFaNtA Posted April 5, 2006 Author Share Posted April 5, 2006 My primary Problem is only to start the Func Timer() when the user has put a Value into $msg (atm it starts at the beginning of the Script) /[center][/center] Link to comment Share on other sites More sharing options...
XxXFaNtA Posted April 5, 2006 Author Share Posted April 5, 2006 Has really noone an idea how to make it, thatFunc Timer()_TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs )Local $sTime = $Time ; save current time to be able to test and avoid flicker..$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)If $sTime <> $Time Then $peter = $TimeEndFunc ;==>Timeronly starts after $msg has a value (for example "AFK")??? /[center][/center] Link to comment Share on other sites More sharing options...
exodius Posted April 5, 2006 Share Posted April 5, 2006 (edited) Has really noone an idea how to make it, that only starts after $msg has a value (for example "AFK") ??? Try expandcollapse popup#include <file.au3> #include <Date.au3> Opt("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 4) Global $Secs, $Mins, $Hour, $Time $savedir = @DesktopDir &"\Messages.txt" $timer = TimerInit() $peter = "00:00:00" $msg = InputBox("Away Messanger","Put in your Away Message") If $msg = "" Then Exit Timer() ;; Deleting the old History $file = FileOpen($savedir,2) FileWrite($file,"*** Away Message History ***"& @CRLF) FileClose($file) While 1 ;; Getting name of the XFire Chatwindow $handle = WinGetHandle("classname=ChatSkinWnd") ;; Getting the Text out of the Window (oberes Chatfenster) $text = ControlGetText($handle, "", "RichEdit20W1") ;; unteres chatfenster $chatfenster = ControlGetText($handle, "", "RichEdit20W2") ;; Searching for Substring ":" $result = StringInStr($text, ":") $file = FileOpen($savedir,1) If $result <> 0 AND NOT $chatfenster = $msg Then ;; $file = FileOpen($savedir,1) FileWrite($file,$text & @CRLF) ControlSend($handle, "", "RichEdit20W2", $msg & "(since "& $Peter &"){enter}") WinKill($handle, "") ;; FileClose($file) EndIf FileClose($file) WEnd Func Timer() _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs ) Local $sTime = $Time; save current time to be able to test and avoid flicker.. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime <> $Time Then $peter = $Time EndFunc;==>Timer #cs TO-DO: - Saving the Persons, so you can call them back (no problem) - Menü (Exit, About, Some Texts,...) - 2 Specials: - Counting howlong someone is afk..Example: Person1: Hi. Are you there? Person2(You): Sry, but i'm afk since 3:16 Minutes (WORKS) - Counting backwards till the person is back..Example: Person1: Hi. Are you there? Person2(You): Sry, but i'm afk (i'll be back in 21:44 Minutes) -When you Close the Program, a MsbBox should pop up and show how many people have written a message (hard) OR how many messages you got (counting the lines ans searching for : ) - #ce Edited April 5, 2006 by exodius Link to comment Share on other sites More sharing options...
XxXFaNtA Posted April 5, 2006 Author Share Posted April 5, 2006 doesn't work /[center][/center] Link to comment Share on other sites More sharing options...
exodius Posted April 5, 2006 Share Posted April 5, 2006 doesn't work So to get straight what's going on... Your script pulls up an inputbox, and at the point that you put something in it and click "OK", you want it to start the timer, right? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now