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