Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/14/2011 in all areas

  1. Something like this: Global $secsRemain = 10 Global $LastTime = 0 $Timer = TimerInit() $Gui = GUICreate("Countdown", 260, 200) $Label = GUICtrlCreateLabel("Seconds remaining until share is killed: " & $secsRemain, 20, 20) $Button = GUICtrlCreateButton("Cancel", 20, 150) GUISetState() While $secsRemain > 0 $msg = GUIGetMsg() Switch $msg Case $Button ExitLoop EndSwitch $Time = Int(TimerDiff($Timer) / 1000) If $Time <> $LastTime Then GUICtrlSetData($Label, "Seconds remaining until share is killed: " & $secsRemain) $LastTime = $Time $secsRemain -= 1 EndIf WEnd
    1 point
  2. Because the return number is wrong. $iSeconds = 10 While $iSeconds > 0 $iReturn = MsgBox(4 + 48, "Countdown", "Seconds remaining until share is killed: " & $iSeconds, 1) Switch $iReturn Case 7 ; No Selected. ExitLoop Case 6 ; Yes Selected ExitLoop EndSwitch $iSeconds -= 1 WEndThough I would create a GUI and update the label, then you won't get that annoying disappearing of the MsgBox every second.
    1 point
  3. You left the subscript ([$i]) off of the $lines reference in your ControlSend() statement. Edit: PS - You'd run a lot faster if you just wrote your output direct to a text file via FileWriteLine(). But if having notepad.exe up and running is a requirement, you could at least use the clipboard to transfer your data as it is light-years faster than having ControlSend() process the whole string. $var = "Line1 Error code" & @CRLF & "Line2" & @CRLF & "Line3 Error code" & @CRLF & "Line4" & @CRLF & "Line5 Error code" & @CRLF $lines = StringSplit($var, @CRLF, 1) $words = "Error code" Run("Notepad.exe") WinWaitActive("[CLASS:Notepad]") ; really slow Sleep(1000) For $i = 1 To Ubound( $lines ) - 1 If StringInStr($lines[$i], $words) Then ControlSend("[CLASS:Notepad]", "", "", $lines[$i] & "{ENTER}") EndIf Next ControlSend("[CLASS:Notepad]", "", "", "{ENTER}") ; slow Sleep(1000) For $i = 1 To Ubound( $lines ) - 1 If StringInStr($lines[$i], $words) Then ClipPut($lines[$i] & @CRLF) ControlSend("[CLASS:Notepad]", "", "", "^v") EndIf Next
    1 point
  4. Just change Local $aImgs[@extended + 1] = [@extended], $iImg to Local $aImgs[@extended + 1] = [@extended], $iImg = 0
    1 point
  5. Hello kemo, just do a SplitString with @CRLF as the delimiter, then you have an array you can loop through. Then you can do a stringInStr, to find the coorect lines.
    1 point
×
×
  • Create New...