Jump to content

darknezz19

Members
  • Posts

    12
  • Joined

  • Last visited

darknezz19's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Starting to grasp loops and such. Here's a new version. Next I want to add reading of a video to automatically plug in the minutes. Suggestions and or criticism welcome. *Edit* Rushed it out and didn't test it enough. There's bugs that need to be fixed. #include <GUIConstantsEx.au3> $Form1 = GUICreate("Sleep Timer", 200, 150) $Input1 = GUICtrlCreateInput("Minutes to Sleep", 50, 80, 100, 21) $Button1 = GUICtrlCreateButton("OK", 50, 110, 100, 30, 0) $Check1 = GUICtrlCreateRadio("Shutdown", 50, 20) $Check2 = GUICtrlCreateRadio("Sleep", 50, 40) GUISetState(@SW_SHOW) ; set the gui state to show so you can see it $End = 0 While 1 ; start of loop $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE ; exit if the window is closed Exit Case $Msg = $Input1 ; grab input of minutes and multiply by 60000 to get time in miliseconds $Mins = GUICtrlRead ($Input1) $Min = 60000 * $Mins Case $Msg = $Check1 ; if shutdown is selected asign 1 to $End $End = 1 Case $Msg = $Check2 ; if sleep is selected asign 2 to $End $End = 2 Case $Msg = $Button1 ; run the sleep timer If $End = 0 Then MsgBox(0, "Oops", "Please pick Shutdown or Sleep") Sleep($Min) ElseIf $End = 1 Then Shutdown (9) Exit ElseIf $End = 2 Then Shutdown (64) Exit EndIf EndSelect WEnd
  2. The shutdown function is at the end of the loop. #include <GUIConstantsEx.au3> $Form1 = GUICreate("Sleep Timer", 200, 150, 193, 115) $Input1 = GUICtrlCreateInput("Minutes to Sleep", 50, 80, 100, 21) $Button1 = GUICtrlCreateButton("OK", 50, 110, 100, 30, 0) $Check1 = GUICtrlCreateRadio("Shutdown", 50, 20) $Check2 = GUICtrlCreateRadio("Sleep", 50, 40) GUISetState(@SW_SHOW) ; set the gui state to show so you can see it While 1 ; start of loop $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE ; exit if the window is closed Exit Case $Msg = $Input1 ; grab input of minutes and multiply by 60000 to get time in miliseconds $Mins = GUICtrlRead ($Input1) $Min = 60000 * $Mins Case $Msg = $Check1 ; if shutdown is selected asign 1 to $End $End = 1 Case $Msg = $Check2 ; if sleep is selected asign 2 to $End $End = 2 Case $Msg = $Button1 ; run the sleep timer GUISetState(@SW_HIDE) Sleep($Min) If $End = 1 Then Shutdown (9) Exit ElseIf $End = 2 Then Shutdown (64) ;;; This is where i can't get windows to sleep ;;; Exit EndIf EndSelect WEnd
  3. Hi guys. I'm writing a shutdown timer and i can get my PC to shutdown using 1 + 8 = 9 no problem but when i want it top go into sleep mode It gives me problems. I've tried using 32, 64, and 96 but none of these put the PC into sleep mode like win7 does.
  4. Hi trancexx. This is a timer that asks you how many minutes to wait until it shuts down your computer. Kinda like the sleep timer you'd find on a TV. It's plainly simple. A better one with a gui and more options will be out later today if I can get these loops down. Wish me luck:)
  5. Hi guys. I wrote this just a minute ago and decided to post it. It's simple and plain but works great for me. I use it to watch movies at night in case i fall asleep. I want to dive into guis and see if I can come up with something a bit more complex. Have a good day. $Value = InputBox ( "Sleep Timer", "How many minutes should I wait?", "120", "", 150, 150 ) $Smins = 60000 * $Value Sleep($Smins) Shutdown (9)
  6. This snippit of code was helped written by LinuZ, thanks amigo. It works great, except when none of the keywords turn up. When none are found in a give body of text on a webpage, it's not running the "Else" statement. CODESend ( "^a^c" ) $text = ClipGet() $oIE = _IEAttach ("480", "text") Dim $terms[2] $terms[0] = "jimmyjojack.com" $terms[1] = "boofu";;writing the values to an array, change the arrays values ([2]) if you need more $sText = _IEBodyReadText($oIE) For $loop = 1 To $terms;;the loop start If StringInStr($sText, $terms[$loop], 0) Then ;;; I found it Send ( "{TAB}^C" ) Send ( "http://www.foobarfoo.com/ {ENTER}" ) WinWaitActive ( "", "Done" ) Sleep ( 800 ) MouseClick ( "Left", 700, 300, 1 ) Send ( "^v" ) ;MouseClick ( "Right", 670, 395, 1 ) Else ;;; didn't find it Send ( "{ALT}{LEFT}" ) Send ( "{TAB}{ENTER}" ) EndIf Next;;Keeps on repeating till end of keywords I tried tinkering around with it but loops are a new concept to me that I haven't yet fully grasped. Any help would be greatly appreciated:)
  7. I tried to plug in my keywords but im getting errors about "$terms[2]" not being declared and also the loop needing an EndIf. I tried to add it myself at the end of the Else statement, but it was a no go. It's frustrating not knowing how to fix this yet.
  8. I got it to scan the text of the window rather than the title using this. CODE$terms = "FooBar@gmail.com" $sText = _IEBodyReadText($oIE) If StringInStr($sText, $terms, 0) Then ;;; I found it Send ( "{TAB}^C" ) Send ( "http://www.FooBar.com/ {ENTER}" ) WinWaitActive ( "", "Done" ) Sleep ( 800 ) MouseClick ( "Left", 700, 300, 1 ) Send ( "^v" ) ;MouseClick ( "Right", 670, 395, 1 ) Else ;;; didn't find it Send ( "{ALT}{LEFT}" ) Send ( "{TAB}{ENTER}" ) EndIf I'm having trouble adding multiple keywords to search for in $term. I tried adding "Or" after "FooBar@gmail.com" but this didnt work. Would I need another If statement for this? Thanks for the help with this:)
  9. Using this command... $oIE = _IEAttach ("Blah") It is attaching to the window with the word "Blah" in the title of the window. How would I use it search the body of the html for "Blah" instead of the window title?
  10. I used the "_IEAttach" command and binded that to the "$oIE" constant. Works like a charm now. Am I using the proper terminology here?
  11. I now understand how to store it as a string thank you. Now I am having trouble searching the text to see if a word exists. I found this code snippet. If I'm not misstaken this will search for the string "211." CODE$sText = _IEBodyReadText($oIE) If StringInStr($sText, "211") Then ;;; I found it _IEAction($oIE, "refresh") Else ;;; didn't find it ;;; do something else EndIf I don't understant what the "$oIE" constant is refering to. What would I use to have it read the body of the currently opened IE window?
  12. Hello all. I'm new to Autoit and was hoping some kind sole might be able to help me. What I want to do is be able to select all the text on a given webpage and store it as a string. Then see if the word "total" is in the copied text, and if it is run a new explorer window. Here is how I am trying to do this. CODE$text = Send ( "^a^c" ) $compare = StringInStr ( "$text", "total", 0, 1 ) If $compare = 1 Then Run ( "explorer" , "" , @SW_MAXIMIZE ) I'm not storring the string right is my guess but I don't know how to display a stored string to see what it is. Is there a way I can open up Notepad.exe and paiste the copied string into it to check? Thanks in advance for the help in advance:)
×
×
  • Create New...