Jump to content

Reinn

Active Members
  • Posts

    25
  • Joined

  • Last visited

Reinn's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. With a little help from contrex in the countdown, I managed to finish my Shutdown Tool! #comments-start Shutdown Tool written by Reinn Version: 1.0 Released: 27-07-2010 #comments-end #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "end") HotKeySet("{F10}", "Start") #Region ### START Koda GUI section ### Form=C:\Users\Jan\Documents\koda_1.7.2.2_b204_2010-02-04\Forms\Shutdown tool.kxf $Form1_1 = GUICreate("Shutdown tool", 218, 105, 192, 124) $Input1 = GUICtrlCreateInput("00", 40, 64, 25, 21) $Input2 = GUICtrlCreateInput("10", 96, 64, 25, 21) $Input3 = GUICtrlCreateInput("30", 152, 64, 25, 21) $Label1 = GUICtrlCreateLabel("Hour(s)", 40, 48, 38, 17) $Label2 = GUICtrlCreateLabel("Minute(s)", 88, 48, 47, 17) $Label3 = GUICtrlCreateLabel("Second(s)", 144, 48, 52, 17) $Combo1 = GUICtrlCreateCombo("Shutdown in", 40, 16, 145, 25) GUICtrlSetData(-1, "Shutdown at") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() If GUICtrlRead($Combo1) = "Shutdown in" Then countdown() Else shutdownat() EndIf EndFunc Func countdown() Dim $Total = GUICtrlRead($input1) * 60 * 60 + GUICtrlRead($input2) * 60 + GUICtrlRead($input3) For $s = $Total To 0 Step -1 Sleep(1000) $Tseconds=$s $hours = int($Tseconds/3600) $Remsecs = $Tseconds - ($hours * 3600) $minutes = int($Remsecs / 60) $Seconds = $Remsecs - ($minutes * 60) $TT = ToolTip("System will shutdown in " & $hours & " hour(s), " & $minutes & " minute(s) and " & $Seconds & " second(s)." & @CRLF & "To cancel shutdown and exit the script press the ESCAPE key.", 50, 50, "Countdown until shutdown" & @CRLF & "This script has been written by Reinn. Educational purposes only, all rights reserved - 2010.", 1) Next Sleep($Total) Dim $TT = ToolTip("") MsgBox(0, "Shutdown", "Your system is shutting down.", 5000) Shutdown(9) Exit EndFunc Func shutdownat() Dim $shutat = GUICtrlRead($input1) * 60 * 60 + GUICtrlRead($input2) * 60 + GUICtrlRead($input3) Dim $timenow = @Hour * 60 * 60 + @MIN * 60 + @SEC Dim $shutin = $shutat - $timenow For $s = $shutin To 0 Step -1 ; Tooltip Countdown Sleep(1000) $Tseconds=$s $hours = int($Tseconds/3600) $Remsecs = $Tseconds - ($hours * 3600) $minutes = int($Remsecs / 60) $Seconds = $Remsecs - ($minutes * 60) $TT = ToolTip("System will shutdown in " & $hours & " hour(s), " & $minutes & " minute(s) and " & $Seconds & " second(s)." & @CRLF & "To cancel shutdown and exit the script press the ESCAPE key.", 50, 50, "Countdown until shutdown" & @CRLF & "This script has been written by Reinn. Educational purposes only, all rights reserved - 2010.", 1) Next Sleep($shutin) Dim $TT = ToolTip("") MsgBox(0, "Shutdown", "Your system is shutting down.", 5000) Shutdown(9) EndFunc Func end() Exit EndFunc Hope this helps some of you out there Reinn shutdown.au3
  2. Thanks for the fast reply, and I do understand how it works. Out of the Total number of seconds it finds out how many hours that is, and how many minutes it is (without any decimals). I can't get it to update the tooltip other than the way that I did. (e.g. 75..74..73 and not 01 minute(s) and 15..14..13 seconds) This is the countdown function, as it is now.. Func countdown() $hour = 1000 * 60 * 60 $min = 1000 *60 $sec = 1000 Dim $Total = GUICtrlRead($input1) * 60 * 60 + GUICtrlRead($input2) * 60 + GUICtrlRead($input3) $Tseconds=$Total $hours = int($Tseconds/3600) $Remsecs = $Tseconds - ($hours * 3600) $minutes = int($Remsecs / 60) $Seconds = $Remsecs - ($minutes * 60) For $Seconds = $Total To 0 Step -1 ; Tooltip Countdown Sleep($sec) $TT = ToolTip("System will shutdown in " & $hours & "hours, " & $minutes & " minutes and " & $Seconds & " seconds." & @CRLF & "To cancel shutdown and exit the script press the ESCAPE key.", 50, 50, "Countdown until shutdown", 1) Next Sleep($Total) Dim $TT = ToolTip("") MsgBox(0, "Shutdown", "Your system is shutting down.", 5 * $sec) Exit ;For $h = GUICtrlRead($input1) To 0 Step -1 ; Timer for hours ; Sleep(1000) ;Sleep($hour) ; ; GUICtrlSetData($input1, $h) ;Next ;here ends the timer ;For $m = GUICtrlRead($input2) To 0 Step -1 ; Timer for minutes ; Sleep($min) ; GUICtrlSetData($input2, $m) ;Next ; EndFunc If I put into the GUI 00 hours, 1 minute and 15 seconds it shows me the following in my ToolTip: "System will shutdown in 0 hours, 0 minutes and 75 seconds." and then it counts down from 75 to 0.
  3. A few weeks ago I decided to start making a Shutdown tool, since I was backing some of my files onto my external HDD and it took a lot of time. It was late at night, and I didn't want to wait up to turn off the computer. Last night I again took a backup, and I thought about my script, and started working on it again. I made some improvements from the script before, but the countdown is still not working. Let me show you the script first... #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "end") HotKeySet("{F10}", "Start") #Region ### START Koda GUI section ### Form=C:\Users\Jan\Documents\koda_1.7.2.2_b204_2010-02-04\Forms\Shutdown tool.kxf $Form1_1 = GUICreate("Shutdown tool", 218, 105, 192, 124) $Input1 = GUICtrlCreateInput("00", 40, 64, 25, 21) $Input2 = GUICtrlCreateInput("10", 96, 64, 25, 21) $Input3 = GUICtrlCreateInput("30", 152, 64, 25, 21) $Label1 = GUICtrlCreateLabel("Hour(s)", 40, 48, 38, 17) $Label2 = GUICtrlCreateLabel("Minute(s)", 88, 48, 47, 17) $Label3 = GUICtrlCreateLabel("Second(s)", 144, 48, 52, 17) $Combo1 = GUICtrlCreateCombo("Shutdown in", 40, 16, 145, 25) GUICtrlSetData(-1, "Shutdown at") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() If GUICtrlRead($Combo1) = "Shutdown in" Then countdown() Else shutdownat() EndIf EndFunc Func countdown() $hour = 1000 * 60 * 60 $min = 1000 *60 $sec = 1000 ;Dim $Total = GUICtrlRead($input1) * $hour + GUICtrlRead($input2) * $min + GUICtrlRead($input3) * $sec ;I thought it had to be like this, but because it already sleep($sec) each time, then you don't have to * 1000 in the equation or you get a horribly wrong number... Dim $Total = GUICtrlRead($input1) * 60 * 60 + GUICtrlRead($input2) * 60 + GUICtrlRead($input3) For $s = $Total To 0 Step -1 ; Seconds left Sleep($sec) $TT = ToolTip("System will shutdown in " & $s & " seconds!", 50, 50, "Countdown until shutdown", 1) Next Sleep($Total) Dim $TT = ToolTip("") MsgBox(0, "Shutdown", "Your system is shutting down.", 5 * $sec) Exit ;For $h = GUICtrlRead($input1) To 0 Step -1 ; Timer for hours ; Sleep(1000) ;Sleep($hour) ; ; GUICtrlSetData($input1, $h) ;Next ;here ends the timer ;For $m = GUICtrlRead($input2) To 0 Step -1 ; Timer for minutes ; Sleep($min) ; GUICtrlSetData($input2, $m) ;Next ; EndFunc Func shutdownat() For $s = GUICtrlRead($input3) To 0 Step -1 Sleep(1000) Tooltip($s, 50, 50, "Countdown", 1) Next If @HOUR = GUICtrlRead($input1) And @MIN = GUICtrlRead($input2) Then MsgBox(1, "Shutdown", "Shutdown would happen now!") EndIf EndFunc Func end() Exit EndFunc (I've only put MsgBoxes when the script should shutdown the computer, but the shutdown function will be added later) Now my problem lies in the countdown. Right now it will show how many seconds there is until shutdown e.g. 26234 seconds. I'd like it to show 02 hours, 32 minutes and 05 seconds until shutdown. And each time seconds get till 0, I'd like for it to start from 59 again if there still is something more than 00 in the minutes. And the same process with the minutes if there still is something in the hours. Maybe I'm missing a really easy way to fix this, but I've been struggling with it for a few hours now... shutdown.au3
  4. Okey thanks for the help! I'll check it out myself
  5. Thanks Authenticity for your effort! It's logging great, but I've encountered a problem... After the thing that the person requested are sent out or w/e, they aren't deleted from the list. (I do press F5 again to refresh it, but it still has them on the list.) I don't know if I've written it before, and I don't know if this is a part of your script but if you made the "bot" look for the nick of the person that requested, if his nick was also involved with the frazes "Sent to", and all the others, he would be deleted from the list.. I know this might be pretty advanced, and thanks for your help so far. Even a hint or the name of the function I'd need would be helpful! Reinn
  6. BUMP yet again.. I know it's triple post, but I haven't gotten any help I hope you guys understand what I meant and are able to help me ..
  7. BUMP... Isn't there anyone who knows how to do this? Or at least tell me this is impossible if it is, but I don't think so, I'm just not sure how to do it...
  8. Added a sample of the logfile...
  9. Let's say that I have a log file, from a chatroom. In the chatroom people can request stuff, like proxylist, etc. I wanted to make a queue for the requests, so I just can have it runing, and then check it a few hours later, and who requested what, so I can forfill the requests fast. Whenever someone wants to request, he types: "#Request proxylist" and it will look like this: <User> #Request proxylist And that is because we are using IRC. But that's not the point. When I load the logfile, I want it to only show the results, when a "#Request" shows up, and I've done that. Now I want it to see if the nick of the user that requested also shows up in posts that also include: "sent to", "left", "quit","Invalid" & "kicked". (Now here my problem starts... I think I should use _ArrayUnique & _ArrayDelete but I don't know how...) If he is in any of these, the request has to be deleted from the queue. So... Any ideas? Take a look at my code so far... HotKeySet("{F5}", "CheckNew") HotKeySet("{ESC}", "end") #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GuiListBox.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 600, 304, 198, 123);, BitOR($WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS)) $MenuItem1 = GUICtrlCreateMenu("Help") $MenuItem2 = GUICtrlCreateMenuItem("About...", $MenuItem1) $Edit1 = GUICtrlCreateEdit("", 0, 0, 600, 300) GUICtrlSetData($Edit1,"") GUISetState(@SW_SHOW) GuiCtrlSetState($Edit1, BitOR($WS_HScroll, $WS_VScroll)) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem2 MsgBox(0,"About...", "This script has been made by Reinn") EndSwitch WEnd Func CheckNew() GUICtrlSetData($Edit1, "") $Request = FileRead(C:\Users\User\AppData\mIRC\Log files\logfile.log) $Filter = "#request" ;This needs to be added in some way to delete duplicates: $Array1 = _ArrayUnique($Filter) ;Same comment as above _ArrayDelete($Filter2,0) $_Split = StringSplit($Request, Chr(10)) For $i = 1 To $_Split[0] If $Request <> StringInStr($_Split[$i], $Filter) Then GUICtrlSetData($Edit1, $_Split[$i] & @CRLF, "|") Else If $_Split[$i] = "" Then Else EndIf EndIf Next EndFunc Func end() Exit EndFunc#requests.log.txt
  10. How do you sort out the duplicates of 1 .txt file? Thanks, Reinn!
  11. I made it $Pic1 = GUICtrlCreatePic(@ScriptDir & "\GUI.jpg", 0, 0, 353, 177) And I included the GUI.jpg in the script folder, and it works.
  12. Okey, I've encountered a problem.. $Pic = FileInstall("D:\Users\Jan\Pictures\Photoshop\GUI.jpg", @ScriptDir) $Pic1 = GuiCtrlCreatePic(@ScriptDir & "GUI.jpg", 0, 0, 353, 177) That's what it is now, and the GUI is gone completely now...
  13. ;========================================================= ;Reinn's 'Shooting gallery' bot ;========================================================= ;Version 1.0 ;========================================================= ;Made by: ;Reinn at www.Fleud.com ;Reinn at www.Autoitscript.com ;FleudReinn at www.Youtube.com ;========================================================= ;www.Fleud.com for updates ;========================================================= ;Credits to: Fleud.com, AutoItscript.com for making AutoIt ;========================================================= ;Extra credits to: MDiesel, More to come! ;========================================================= #include <GUIConstants.au3> HotKeySet('{F8}', 'Search') HotKeySet('{ESC}', 'Stop') $Form1_1 = GUICreate("Reinn's 'Shooting gallery' bot", 354, 179, 193, 125) $Combo1 = GUICtrlCreateCombo("1280 * 1024", 120, 120, 113, 25) GUICtrlSetData(-1, "1024 * 768") $Pic1 = GUICtrlCreatePic("D:\Users\Jan\Pictures\Photoshop\GUI.jpg", 0, 0, 353, 177) GUISetState(@SW_SHOW) $Left=0 $Top=0 $Right=1000 $Bottom=800 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Dim $Count = 0 Func Search() For $Count = 1 To 5 $Search=PixelSearch ($Left,$Top,$Right,$Bottom,0xFF0000,5,2) If Not @error Then MouseClick ("Left",$Search[0],$Search[1],1,10) Sleep(20) Next If GuiCtrlRead($Combo1) = "1024 * 768" Then MouseClick("Left",598,549,1) ElseIf GuiCtrlRead($Combo1) = "1280 * 1024" Then MouseClick("left",754,716,1) EndIf Search() EndFunc Func Stop() $Visit = MsgBox(0x44, "Reinn's Screenshot Tool", "Would you like to go to Fleud.com now?") If ( $Visit = 6 ) Then ShellExecute("http://www.Fleud.com/") Else EndIf Exit EndFuncoÝ÷ ØuëaƧv+p¢¹,~æx­Â§¢w¨~l®'§vËn®x­¢x­v¬mz÷§¶êç¢r$-êk¡¹^+"Ø^B*º^jëh×6$Pic1 = GUICtrlCreatePic("D:\Users\Jan\Pictures\Photoshop\GUI.jpg", 0, 0, 353, 177)
  14. Wow, a lot of replies, will look them thru one by one when I have the time... Thanks folks!
  15. The reason to that only this is working, is that While 1 Sleep(1000) WEnd will make the bot sleep 1000 MS all the time, which means it doesn't get to do other things. Why did you add it in your code in the first place? Completely useless Btw. Thanks, will try this out!
×
×
  • Create New...