Jump to content

TheCrimsonCrusader

Active Members
  • Posts

    70
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheCrimsonCrusader's Achievements

Wayfarer

Wayfarer (2/7)

2

Reputation

  1. Thank you TheXman and pixelsearch, outstanding work! I marked that as the solution.
  2. I don't want to do this, my wife does for various e-mail signatures associated to a hotkey. 🙂 Apparently, Revit or one of her other architectural apps uses a hotkey sequence with a double-tap of the same letter and she likes it. Women. smh
  3. Is there a way to do a <CTRL> + double tap of the "w" key as an example for hotkey assignment? Obviously with the below, it's going to process the <CTRL> and the first "w" immediately, so was curious if there is a way around that. Thanks. HotKeySet("^ww", "HotKeyPressed")
  4. Hello. I am calling the Dell Command Update command line utility and it processes the console output into the GUI just fine. When using a LAN connection, due to faster download speeds all of the console output gets displayed in the GUI without a problem. However, with a WLAN connection, since it is not as fast, there are more output results logged during the download results so it doesn't output all of the results in the GUI. Example output that shows up in the GUI is the following.... Downloading updates (4 of 8), 263.6 MB of 599.6 MB transferred (44.03%)... Is there a way in the code below to have a bigger "buffer" per se, so all results get logged within the GUI from the console output? This occurs about after 367 lines of the above output mentioned in bold. As far as the "progra~2" in the path, the executable was doing flakey if I recall specific to Dell Command Update, so I didn't use the variable in that case, but that's neither here or there. 🙂 Thanks. #NoTrayIcon #RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <StaticConstants.au3> If ProcessExists("dcu-cli.exe") Then ProcessWaitClose("dcu-cli.exe") EndIf $Gui = GUICreate("Dell Command Updater", 806, 598,-1,-1,"",$WS_EX_TOPMOST) $Edit = GUICtrlCreateEdit("", 10,10,780,550, $ES_AUTOVSCROLL + $WS_VSCROLL + $ws_hscroll + $es_readonly) GUICtrlSetFont(-1,8.5,800,default,'courier new') GUISetState(@SW_SHOW) Global $rslt,$out $rslt = Run(@comspec & " /c " & "c:\Progra~2\Dell\CommandUpdate\dcu-cli.exe" & " /applyUpdates -outputLog=C:\Temp\DellCommandUpdater.log", @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD) Sleep(5000) While 1 Sleep(1000) $out = StdoutRead($rslt) If @error then exitloop GUICtrlSetData($edit,$out & @lf,1) WEnd
  5. Thanks for that, mikell. That works but I agree that using one mode would be preferred. I would prefer to use the OnEvent only if possible, but I I add an OnEvent under the $idBtn = GUICtrlCreateButton("OK", 10, 100, 160, 35) line and try to call that as an additional function instead of in the loop, it does nothing.
  6. Sorry, it's a bit over my head. If I want to use the OnEvent instead of the Message mode in the loop as a example, do I clear out everything in the loop outside of maybe having a sleep statement and another function call within the loop for the remaining part of the code?
  7. Greetings, In the code below, I just have a GUI and within that GUI, I have a button called "Unlock BitLocker" which in turn, calls a function that has an input field. When I click on the OK button for the input field dialog box, the button doesn't do anything. I'm sure it's something simple, but apparently not simple enough for me. 🙂 Any help would be greatly appreciated! Thanks! #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) $GUI = GUICreate("Test GUI",400,100,-1,-1,BitOR($WS_POPUP, $WS_DLGFRAME, $WS_EX_TOPMOST), 0) WinSetOnTop ($GUI, "",1) $UNLOCK_BITLOCKER = GUICtrlCreateButton("Unlock BitLocker", 20, 20, 200, 25) GUICtrlSetOnEvent($UNLOCK_BITLOCKER,"UNLOCK_BITLOCKER_FUNCTION") GUISetState() While 1 Sleep(1000) WEnd Func UNLOCK_BITLOCKER_FUNCTION() GUICreate("Microsoft BitLocker",720, 165, -1,-1,BitOR($WS_DLGFRAME, $WS_EX_TOPMOST), 0) WinSetOnTop ("Microsoft BitLocker", "",1) GUICtrlCreateLabel("Please enter the BitLocker recovery key and then click on the OK button:",10,10,700,35) GUICtrlSetFont (-1,-1, 800) $BitLockerRecoveryKey = GUICtrlCreateInput("", 10, 50, 700, 35) $idBtn = GUICtrlCreateButton("OK", 10, 100, 160, 35) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ExitLoop EndSwitch WEnd $BitLockerRecoveryKey2= GUICtrlRead($BitLockerRecoveryKey) $ReturnCode = RunWait("cmd.exe /c manage-bde -unlock c: -recoverypassword " & $BitLockerRecoveryKey2,"",@SW_HIDE) If $ReturnCode = "0" then MsgBox(262208,"Microsoft BitLocker","The BitLocker recovery volume is now unlocked.") GUIDelete("Microsoft BitLocker") Return Else MsgBox(262160,"Microsoft BitLocker","An invalid BitLocker recovery key was specified. Please try again.") GUIDelete("Microsoft BitLocker") Return EndIf EndFunc
  8. Nevermind, I got it. With the revised code above, I just simply had to do this: Func Hide() GUISetState(@SW_HIDE) Sleep(5000) GUISetState(@SW_SHOW) EndFunc Thanks for the pointers.
  9. I had AdLib outside of the function previously, but I still run into the problem where if I have a sleep statement from the time I click on the "Hide" button, that has a direct impact on the countdown timer in terms of it pausing until that sleep statement ends. So if I have an AdLibRegister for the _Check function and then another AdLibRegister for running the GUISetState(@SW_SHOW) after a sleep period after the hide button is clicked on, the countdown timer pauses until that sleep period has concluded and I need to keep those segregated. #NoTrayIcon #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Global $SS_CENTER, $_Minutes, $_Seconds AdlibRegister("_Check",250) $sStartDate = @YEAR & "/" & @MON & "/" & @MDAY $sEndDate = "2019/10/01" $test = _DateDiff ("D", $sStartDate, $sEndDate ) $GetMinutesLeft = 1440 * $test $GetSecondsLeft = 60 * $GetMinutesLeft $GetMilisecondsLeft = 1000 * $GetSecondsLeft $CountdownTime = $GetMilisecondsLeft $PCSpeakerBeepNotification = 60 $_GuiCountDown = GUICreate ( "Title Bar", 1020, 220, @DesktopWidth/2 -250, @DesktopHeight/2 -100, $WS_EX_TOPMOST ) GUICtrlCreateLabel("Total time remaining:", 25, 30, 520,26) GUICtrlSetFont ( -1, 9, 800 ) GUISetBkColor ( 0xFFFFFF ) $TimeLabel = GUICtrlCreateLabel ( "", 205, 20, 780, 150, $SS_CENTER ) GUICtrlSetFont ( -1, 25, 800 ) GUICtrlSetColor(-1,0xff0000) WinSetOnTop ( $_GuiCountDown, "", 1 ) $TimeTicks = TimerInit ( ) $Hide = GUICtrlCreateButton("Hide", 20,80,100,35) GUICtrlSetOnEvent($Hide, "Hide") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Hide() GUISetState(@SW_HIDE) EndFunc Func _Check ( ) $time = "2019/10/01 12:00:00" $td = _DateDiff('s', _NowCalc(), $time) $late = ""; dummy neg no If $td < 0 Then $late = "-"; dummy neg yes If $td < 0 Then $td = -$td; convert neg $td to pos for math $d = 0; Days with remainder math If $td > 86400 Then $dm = $td Do $dm = $dm - 86400 $d = $d + 1 Until $dm < 86400 EndIf $h = 0; Hours with remainder math If $td - ($d * 86400) > 3600 Then $hm = $td - ($d * 86400) Do $hm = $hm - 3600 $h = $h + 1 Until $hm < 3600 EndIf $m = 0; Miutes with remainder math If $td - ($d * 86400) - ($h * 3600) > 60 Then $mm = $td - ($d * 86400) - ($h * 3600) Do $mm = $mm - 60 $m = $m + 1 Until $mm < 60 EndIf $s = $td - ($d * 86400) - ($h * 3600) - ($m * 60); Seconds $db = ""; non zero for 2 digit numbers $hb = "" $mb = "" $sb = "" If $d < 10 Then $db = 0; zero for 1 digit number If $h < 10 Then $hb = 0 If $m < 10 Then $mb = 0 If $s < 10 Then $sb = 0 GUICtrlSetData ( $TimeLabel, StringFormat ( $late & $db & $d & " days, " & $hb & $h & " hours, " & $mb & $m & " minutes and " & $sb & $s & " seconds", 10, 10) ) EndFunc ;==> _Check ( )
  10. Thanks. I'm not understanding something, I placed the AdlibRegister("MyAdLibFunc",250) at the beginning of the _Check function to then call the "MyAdLibFunc" (updated code in this response) but that didn't process anything in that function as when I click on the hide button, the GUI doesn't come back after the 10 second sleep in the "MyAdLibFunc" Sorry, I haven't messed with the AdLibRegistery before. #NoTrayIcon #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Global $SS_CENTER, $_Minutes, $_Seconds $sStartDate = @YEAR & "/" & @MON & "/" & @MDAY $sEndDate = "2019/10/01" $test = _DateDiff ("D", $sStartDate, $sEndDate ) $GetMinutesLeft = 1440 * $test $GetSecondsLeft = 60 * $GetMinutesLeft $GetMilisecondsLeft = 1000 * $GetSecondsLeft $CountdownTime = $GetMilisecondsLeft $PCSpeakerBeepNotification = 60 $_GuiCountDown = GUICreate ( "Title Bar", 1020, 220, @DesktopWidth/2 -250, @DesktopHeight/2 -100, $WS_EX_TOPMOST ) GUICtrlCreateLabel("Total time remaining:", 25, 30, 520,26) GUICtrlSetFont ( -1, 9, 800 ) GUISetBkColor ( 0xFFFFFF ) $TimeLabel = GUICtrlCreateLabel ( "", 205, 20, 780, 150, $SS_CENTER ) GUICtrlSetFont ( -1, 25, 800 ) GUICtrlSetColor(-1,0xff0000) WinSetOnTop ( $_GuiCountDown, "", 1 ) $TimeTicks = TimerInit ( ) $Hide = GUICtrlCreateButton("Hide", 20,80,100,35) GUICtrlSetOnEvent($Hide, "Hide") GUISetState(@SW_SHOW) While 1 _Check ( ) Sleep(100) WEnd Func Hide() GUISetState(@SW_HIDE) EndFunc Func _Check ( ) AdlibRegister("MyAdLibFunc",250) $time = "2019/10/01 12:00:00" $td = _DateDiff('s', _NowCalc(), $time) $late = ""; dummy neg no If $td < 0 Then $late = "-"; dummy neg yes If $td < 0 Then $td = -$td; convert neg $td to pos for math $d = 0; Days with remainder math If $td > 86400 Then $dm = $td Do $dm = $dm - 86400 $d = $d + 1 Until $dm < 86400 EndIf $h = 0; Hours with remainder math If $td - ($d * 86400) > 3600 Then $hm = $td - ($d * 86400) Do $hm = $hm - 3600 $h = $h + 1 Until $hm < 3600 EndIf $m = 0; Miutes with remainder math If $td - ($d * 86400) - ($h * 3600) > 60 Then $mm = $td - ($d * 86400) - ($h * 3600) Do $mm = $mm - 60 $m = $m + 1 Until $mm < 60 EndIf $s = $td - ($d * 86400) - ($h * 3600) - ($m * 60); Seconds $db = ""; non zero for 2 digit numbers $hb = "" $mb = "" $sb = "" If $d < 10 Then $db = 0; zero for 1 digit number If $h < 10 Then $hb = 0 If $m < 10 Then $mb = 0 If $s < 10 Then $sb = 0 GUICtrlSetData ( $TimeLabel, StringFormat ( $late & $db & $d & " days, " & $hb & $h & " hours, " & $mb & $m & " minutes and " & $sb & $s & " seconds", 10, 10) ) EndFunc ;==> _Check ( ) Func MyAdLibFunc() Sleep(10000) GUISetState(@SW_SHOW) EndFunc ;==>MyAdLibFunc
  11. This GUI has a countdown timer from the specified date in the code in days, hours, minutes and seconds. When the script is ran, it will display the countdown time and I also have a "hide" button that will hide the GUI. I would like this GUI to pop up every hour from the time the "hide" button is clicked. The problem is, since that will need to be in a loop (I think), I not sure what to do so it doesn't impact the time being updated while that loop is running. #NoTrayIcon #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Global $SS_CENTER, $_Minutes, $_Seconds $sStartDate = @YEAR & "/" & @MON & "/" & @MDAY $sEndDate = "2019/10/01" $test = _DateDiff ("D", $sStartDate, $sEndDate ) $GetMinutesLeft = 1440 * $test $GetSecondsLeft = 60 * $GetMinutesLeft $GetMilisecondsLeft = 1000 * $GetSecondsLeft $CountdownTime = $GetMilisecondsLeft $PCSpeakerBeepNotification = 60 $_GuiCountDown = GUICreate ( "Title Bar", 1020, 220, @DesktopWidth/2 -250, @DesktopHeight/2 -100, $WS_EX_TOPMOST ) GUICtrlCreateLabel("Total time remaining:", 25, 30, 520,26) GUICtrlSetFont ( -1, 9, 800 ) GUISetBkColor ( 0xFFFFFF ) $TimeLabel = GUICtrlCreateLabel ( "", 205, 20, 780, 150, $SS_CENTER ) GUICtrlSetFont ( -1, 25, 800 ) GUICtrlSetColor(-1,0xff0000) WinSetOnTop ( $_GuiCountDown, "", 1 ) $TimeTicks = TimerInit ( ) $Hide = GUICtrlCreateButton("Hide", 20,80,100,35) GUICtrlSetOnEvent($Hide, "Hide") While 1 _Check ( ) Sleep(200) GUISetState(@SW_SHOW) WEnd Func Hide() GUISetState(@SW_HIDE) EndFunc Func _Check ( ) $time = "2019/10/01 12:00:00" $td = _DateDiff('s', _NowCalc(), $time) $late = ""; dummy neg no If $td < 0 Then $late = "-"; dummy neg yes If $td < 0 Then $td = -$td; convert neg $td to pos for math $d = 0; Days with remainder math If $td > 86400 Then $dm = $td Do $dm = $dm - 86400 $d = $d + 1 Until $dm < 86400 EndIf $h = 0; Hours with remainder math If $td - ($d * 86400) > 3600 Then $hm = $td - ($d * 86400) Do $hm = $hm - 3600 $h = $h + 1 Until $hm < 3600 EndIf $m = 0; Miutes with remainder math If $td - ($d * 86400) - ($h * 3600) > 60 Then $mm = $td - ($d * 86400) - ($h * 3600) Do $mm = $mm - 60 $m = $m + 1 Until $mm < 60 EndIf $s = $td - ($d * 86400) - ($h * 3600) - ($m * 60); Seconds $db = ""; non zero for 2 digit numbers $hb = "" $mb = "" $sb = "" If $d < 10 Then $db = 0; zero for 1 digit number If $h < 10 Then $hb = 0 If $m < 10 Then $mb = 0 If $s < 10 Then $sb = 0 GUICtrlSetData ( $TimeLabel, StringFormat ( $late & $db & $d & " days, " & $hb & $h & " hours, " & $mb & $m & " minutes and " & $sb & $s & " seconds", 10, 10) ) EndFunc ;==> _Check ( )
  12. Uh, it help if I would have put a 0 before the single digit numbers. PBKAC alert!
  13. Doh't1 I forgot to change that back after I was adding some additional date parameters when testing. Anyway, even when I change it from "and" to "or", I still get both message box prompts. So I guess that's happening because the and < 12, but not sure how to address that where it will only acknowledge the month range between July and December like it does for January through the end of June.
  14. Greetings. I am trying to have the script below run where for the 2019 calendar year, if the current month is greater than or equal to January and less than the month of July send one message box and if if the current month is greater than or equal to July and and less than or equal to the month of December send a different message box. Somewhere I am off, but I can't figure out where. Thanks for any assistance in advance! If @Year = 2019 Then     If @MON >= "1" or @MON < "7" Then MsgBox(262144,"","Date range is between January and June.")     If @MON >= "7" and @MON <= "12" Then MsgBox(262144,"","Date range is between July and December.") EndIf
×
×
  • Create New...