Jump to content

mechpro

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by mechpro

  1. Thank you - I'll continue playing with it, hopefully someone else also chimes in regarding toggling the screensaver black screen that comes on when you turn this script into screensaver.scr
  2. Hello All, I wanted to give an update -- I included the suggestions and modified the script. The script startsa GUI with a count down timer, and launches/closes Firefox. However, after launching firefox the background stays black (if you close firefox and move the mouse the black screen disappears. It appears to be the black screen that comes on during a screen saver) I included a mouse click and mouse move to see if perhaps I could get that black screen to go away before launching but it remained. The script works perfectly fine if launched as an exe but not as a screen saver. I wasn't sure how to incorporate the suggestions from InunoTaishou. Any chance anyone could give this a try on Windows 10? Or see how to get rid of the black screen that obscures the desktop automatically instead of having to manually move the mouse? ;============================================ ;Thomas Vu ;10/20/13 ;Purpose: Kiosk Mode for Library Desktops ;============================================ #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <WindowsConstants.au3> #Include <File.au3> #Include <Array.au3> Global $i = 30 Global $e = 0 Global $Label2 $Form1 = GUICreate("Session Timeout", 306, 133, -1, -1) $Button2 = GUICtrlCreateButton("Cancel", 104, 96, 89, 33) $Label2 = GUICtrlCreateLabel("", 128, 72, 49, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Due to inactivity this computer will reset soon.", 42, 16, 224, 17) $Label3 = GUICtrlCreateLabel("Press cancel before time runs out to abort the reset.", 28, 48, 252, 17) GUISetState(@SW_SHOW) AdlibRegister("_Update", 1000) ; Get the path to firefox.exe Global Const $sFireFox = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe","") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button2 Exit EndSwitch WEnd Func _Update() GUICtrlSetData($Label2, StringFormat("%02d:%02d", $e, $i)) $i -= 1 If $i < 0 Then $i = 0 $e -= 1 If $e < 0 Then call ("closefirefox") call ("openfirefox") Exit EndIf EndIf EndFunc func closefirefox () While Processexists( "Firefox.exe" ) processclose ( "Firefox.exe" ) WEnd EndFunc func openfirefox () sleep (250) mouseclick ("left", 462, 1022, 1, 0) MouseMove(@DesktopWidth/2, @DesktopHeight/2, 0) sleep (100) ShellExecute($sFireFox, "") EndFunc Exit 0
  3. Hello, We have a script we use for kiosk machines that simply displays a GUI box that warns the user that it will close and re open firefox unless a button is pressed. If the button (cancel) is pressed, the script is canceled. It used to work perfectly fine for our Windows 7 machines but the script doesn't work for Win 10 machines. The gui box comes up without a problem but it fails to close and reopen firefox. Currently, this script uses mouse coordinates and we pin firefox in the taskbar - to the right of both, the search box and the desktop switcher icons. Does AutoIT allow to open a program such as firefox without having to use the mouse coordinate feature? Perhaps by specifying to the path of the firefox shortcut location? Or does Autoit not work for Win 10? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3> Global $i = 30 Global $e = 0 Global $Label2 $Form1 = GUICreate("Session Timeout", 306, 133, -1, -1) $Button2 = GUICtrlCreateButton("Cancel", 104, 96, 89, 33) $Label2 = GUICtrlCreateLabel("", 128, 72, 49, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Due to inactivity this computer will reset soon.", 42, 16, 224, 17) $Label3 = GUICtrlCreateLabel("Press cancel before time runs out to abort the reset.", 28, 48, 252, 17) GUISetState(@SW_SHOW) AdlibRegister("_Update", 1000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Exit EndSwitch WEnd Func _Update() GUICtrlSetData($Label2, StringFormat("%02d:%02d", $e, $i)) $i -= 1 If $i < 0 Then $i = 0 $e -= 1 If $e < 0 Then Call("closefirefox") Call("openfirefox") Call("delete") Exit EndIf EndIf EndFunc ;==>_Update Func delete() $sPath = "C:\Users\user1\Downloads" FileDelete($sPath & "\*.*") $folderlist = _FileListToArray($sPath, "*", 2) If Not @error Then For $j = $folderlist[0] To $folderlist[1] Step -1 DirRemove($sPath & "\" & $folderlist[$j], 1) Next EndIf EndFunc ;==>delete Func closefirefox() While ProcessExists("Firefox.exe") ProcessClose("Firefox.exe") WEnd EndFunc ;==>closefirefox Func openfirefox() Sleep(250) MouseClick("left", 73, 1024, 1, 0) Sleep(100) MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 0) EndFunc ;==>openfirefox
×
×
  • Create New...