Is there a way to write a script that will return if
a process is running or paused?
;_ReadSettings() - Reads all of the settings from the configuration file. If a value doesn't exist, the bot will ask for the value, save it, then proceed. Func _ReadSettings() $GameFolder = IniRead($SettingsFile, "GamePath", "Path", "") If Not FileExists($GameFolder & "\APBGame\Config\APBEngine.ini") Then Do $GameFolder = FileSelectFolder("Find the APB Reloaded install folder", "", 0, @program FilesDir) Until FileExists($GameFolder & "\APBGame\Config\APBEngine.ini") IniWrite($SettingsFile, "GamePath", "Path", $GameFolder) EndIf ;If the game's configuration file is not found, then your path name is incorrect. The bot will proceed to ask for the proper path until the proper path is given and then write the proper path into the configuration file.
#include <Timers.au3> ;Declare the Timer: ; Global $TIMER = TimerInit() Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) HotKeySet("#{F4}", "_exit") ; Ctrl-Shift-Alt-X to exit While 1 ;If this application is active then reset the timer: If WinExists("Notepad") And _Timer_GetIdleTime() >= 2 * 1000 Then MsgBox (0, "Time reached", "You have been idle for more than 2 seconds.") WinClose("Notepad") EndIf ;Sleep for 1 seconds before looping again: ; Sleep(1000) WEnd Func _exit() Exit EndFunc
HotKeySet("{ESC}", "Terminate") If $CmdLine[0] == 1 Then ProcessClose ( "XBMC.exe" ) Run ( '"H:\remotedesktop.exe" /e "' & $CmdLine[1] & '"', "H:\" ) While 1 Sleep(100) WEnd EndIf Func Terminate() ProcessClose ( "remotedesktop.exe" ) Run ( '"H:\Interface\xbmc\XBMC.exe"' ) WinWait ( "XBMC" ) WinActivate ( "XBMC" ) Exit 0 EndFunc
HotKeySet("{F9}", "ToggleFullscreen")
#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=foobar.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Run_Tidy=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include ; ============================================================================ ; ; Changing this to True will make the script start foobar200 itself, and exit when it closes. ; Otherwise the script will stay running indefinitely, monitoring for foobar2000 whenever it starts. Global Const $startFoobar2000 = True Global $pidFoobar2000 = 0 Global $wndFoobar2000 = 0 Global $wndSavedPosition Global Const $FullscreenRect[2] = [ _ _WinAPI_GetSystemMetrics($SM_CXSCREEN), _ _WinAPI_GetSystemMetrics($SM_CYSCREEN) _ ] Func ToggleFullscreen() Global $wndFoobar2000, $wndSavedPosition Local Const $stylesToRemove = BitOR($WS_CAPTION, $WS_BORDER, $WS_SIZEBOX) If Not WinExists($wndFoobar2000) Then Return Local $wndStyle = _WinAPI_GetWindowLong($wndFoobar2000, $GWL_STYLE) If @error Then Return If BitAND($wndStyle, $stylesToRemove) <> 0 Then $wndSavedPosition = WinGetPos($wndFoobar2000) $wndStyle = BitAND($wndStyle, BitNOT($stylesToRemove)) _WinAPI_SetWindowLong($wndFoobar2000, $GWL_STYLE, $wndStyle) _WinAPI_SetWindowPos($wndFoobar2000, $HWND_TOPMOST, _ 0, 0, _ 0, 0, _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) _WinAPI_SetWindowPos($wndFoobar2000, 0, _ 0, 0, _ $FullscreenRect[0], $FullscreenRect[1], _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOZORDER)) Else $wndStyle = BitOR($wndStyle, $stylesToRemove) _WinAPI_SetWindowLong($wndFoobar2000, $GWL_STYLE, $wndStyle) _WinAPI_SetWindowPos($wndFoobar2000, $HWND_NOTOPMOST, _ 0, 0, _ 0, 0, _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE)) If UBound($wndSavedPosition, 1) >= 4 Then _WinAPI_SetWindowPos($wndFoobar2000, 0, _ $wndSavedPosition[0], $wndSavedPosition[1], _ $wndSavedPosition[2], $wndSavedPosition[3], _ BitOR($SWP_NOCOPYBITS, $SWP_FRAMECHANGED, $SWP_NOZORDER)) EndIf EndIf EndFunc ;==>ToggleFullscreen Func GetFoobar2000Window() Local $allWindows = _WinAPI_EnumWindowsTop() If @error Then Return 0 Local $wndAlt = 0 For $i = 1 To $allWindows[0][0] Local $hwnd = $allWindows[$i][0], $pidWindow If _WinAPI_GetWindowThreadProcessId($hwnd, $pidWindow) And $pidWindow == $pidFoobar2000 Then ; This is a hackish way to try and detect foobar2000's main window. ; It should have a maximize button, or at least the corresponding style! If (BitAND(_WinAPI_GetWindowLong($hwnd, $GWL_STYLE), $WS_MAXIMIZEBOX)) Then Return $hwnd ElseIf Not $wndAlt And StringInStr(_WinAPI_GetWindowText($hwnd), "foobar2000") Then $wndAlt = $hwnd EndIf EndIf Next ; No window found with the semi-reliable method. Just return one with 'foobar2000' in the title. Return $wndAlt EndFunc ;==>GetFoobar2000Window If $startFoobar2000 Then $pidFoobar2000 = Run(StringFormat('"%s/%s" %s', @ScriptDir, "foobar2000.exe", _Iif(@Compiled, $CmdLineRaw, ""))) If @error Then MsgBox($MB_ICONHAND, "foobar2000 Full-screen", "Error: failed to start foobar2000.exe. Make sure this script is placed in foobar2000's folder.") Exit 1 EndIf If _Singleton("foobar2000_fullscreen", 1) == 0 Then Exit 1 EndIf ElseIf _Singleton("foobar2000_fullscreen", 1) == 0 Then Exit 1 EndIf HotKeySet("{F9}", "ToggleFullscreen") While True If Not ProcessExists($pidFoobar2000) Then If Not $startFoobar2000 Then $pidFoobar2000 = ProcessWait("foobar2000.exe") Else Exit EndIf EndIf If Not WinExists($wndFoobar2000) Then $wndFoobar2000 = GetFoobar2000Window() If Not $wndFoobar2000 Then Sleep(1000) ContinueLoop EndIf EndIf Sleep(200) WEnd
;Open the letter template and fill out the form Local $myTemplate = @ScriptDir & "\templates\ Letter.doc" Local $oWordApp = _WordCreate("", 0, 0) Local $oDoc = _WordDocOpen($oWordApp, $myTemplate) Local $oFind = _WordDocFindReplace($oDoc, "[TN]", $EspStatTN) Local $oFind = _WordDocFindReplace($oDoc, "[USERNAME]", $EspStatUsername) Local $oFind = _WordDocFindReplace($oDoc, "[PASSWORD]", $EspStatPassword) Local $oFind = _WordDocFindReplace($oDoc, "[EMAILADDRESS]", $EspStatUsername) Local $oFind = _WordDocFindReplace($oDoc, "[IPBLOCK]", $EspStatIPBlock) Local $oFind = _WordDocFindReplace($oDoc, "[NETMASK]", $EspStatNetmask) Local $oFind = _WordDocFindReplace($oDoc, "[NETMASK]", $EspStatNetmask) _WordDocSaveAs($oDoc, @ScriptDir & "\Test.doc") _WordQuit($oWordApp)
C:\Program Files\AutoIt3\Include\Word.au3 (749) : ==> Error in expression.: $return = .Execute($s_FindText, $f_MatchCase, $f_MatchWholeWord, $f_MatchWildcards, $f_MatchSoundsLike, $f_MatchAllWordForms, $f_Forward, $i_Wrap, $f_Format, $s_ReplaceWith, $i_Replace) $return = .Execute($s_FindText, $f_MatchCase, $f_MatchWholeWord, $f_MatchWildcards, $f_MatchSoundsLike, $f_MatchAllWordForms, $f_Forward, $i_Wrap, $f_Format, $s_ReplaceWith, $i_Replace)^ ERROR
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Local $file = FileOpen("z:\logs\server.log", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $text = FileRead($file) #Region ### START Koda GUI section ### Form=c:\program files\autoit3\scripts\form.kxf $Form1_1 = GUICreate("Server Log", 615, 438, 192, 124) $Fing = GUICtrlCreateButton("Fing", 440, 24, 113, 57, $BS_ICON) $Find = GUICtrlCreateButton("Find", 440, 112, 113,57) $hEdit= GUICtrlCreateEdit($text, 64, 24, 505, 233, _ BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL, $ES_NOHIDESEL)) GUICtrlSetImage(-1, "C:\Users\User1\Downloads\overlook-fing-2.1.exe", -1) $Edit1 = GUICtrlCreateEdit("", 32, 0, 393, 417) GUICtrlSetData(-1, $text) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### MouseMove (232, 156) MouseClick ("left", 232, 156) Send ("{CTRLDOWN}" & "{END}") sleep (15) Send ("{CTRLUP}") While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg=$Fing Run(@ComSpec & " /c " & "C:\fing.lnk") Case $nMsg=$Find _GUICtrlEdit_Find($hEdit) EndSelect WEnd FileClose($file)
^(?:.*?)(\d+|\$\d+|\d+.\d+|\$\d+.\d+|\$\s\d+.\d+|\d+)
Opt("WinTitleMatchMode", 2) Local $selectXLS = "Selecteer het gewenste Excel bestand." Local $openXLS = FileOpenDialog($selectXLS, @ScriptDir & "\", "Excel bestanden (*.xls;*.xlsx)", 1) If @error Then MsgBox(4096, "", "Geen bestand gekozen.") Exit Else $FileName = $openXLS EndIf if not FileExists($FileName) then Msgbox (0,"Bestandsfout","Ik kan het bestand niet vinden. "& $FileName) Exit Else Local $xLoop = 1 Local $tijdSec = InputBox("Tijdschema Opgeven", "Geef de verversingstijd van bestand in minuten: (bijv: 20)") If @error = 1 Then MsgBox(4096, "Sluiten", "Programma afgebroken.") Exit Else ; OK geklikt, nu openen bestand en verversingsloop in. If $tijdSec < 1 Then MsgBox(4096, "Sluiten", "De minimale verversingstijd is 1 minuut.") Exit Else While $xLoop = 1 ShellExecute("excel.exe", '/r "' & $FileName & '"', @ScriptDir, "", @SW_MAXIMIZE) Sleep($tijdSec*1000*60) if ProcessExists("excel.exe") Then WinWaitActive("Microsoft Excel") WinClose("[ACTIVE]", "") Else Exit EndIf WEnd EndIf EndIf EndIf
Global $master_array[4] = ["3", "red", "yellow", "green"] Global $compare_array1[8] = ["7", "red", "purple", "magenta", "orange", "blue", "yellow", "darkorange"] Global $compare_array2[10] = ["9", "purple", "brickred", "red", "white", "green", "lightblue", "blue", "black", "gray"] Global $compare_array3[7] = ["6", "turquoise", "brown", "magenta", "mustard", "blue", "red"] Global $compare_array4[9] = ["8", "indigo", "lavender", "purple", "red", "gray", "green", "blue", "cyan"] [b]similarities (all arrays have it)[/b] RED - $master_array, $array1, $array2, $array3, $array4 [b]differences (not found in master array and more than one array has it)[/b] PURPLE - $array1, $array2, $array4 BLUE - $array1, $array2, $array3, $array4 etc.. [b]differences (not found in master array and only 1 array has it)[/b] MAGENTA - $array1 ORANGE - $array1 DARKORANGE - $array1 BRICKRED - $array2 WHITE - $array2 etc...
Global Const $DESKTOP_SWITCHDESKTOP = 0x100 While 1 If _CheckLocked() = 0 Then msgbox(0, "", "Test") EndIf WEnd Func _CheckLocked() $hLockedDLL = DllOpen("user32.dll") $hDesktop = DllCall($hLockedDLL, "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) $ret = DllCall($hLockedDLL, "int", "SwitchDesktop", "int", $hDesktop[0]) DllCall($hLockedDLL, "int", "CloseDesktop", "int", $hDesktop[0]) If $ret[0] = 0 Then $iLocked = 1 ElseIf $ret[0] = 1 Then $iLocked = 0 EndIf DllClose($hLockedDLL) If $iLocked Then Return 1 Else Return 0 EndIf EndFunc
$oTypelib=objcreateinterface($tp, $IID_TYPELIB, $tagITypeLib)you can analyse the typelib of a file
;~ IID´s $IID_TYPEINFO="{00020401-0000-0000-C000-000000000046}" $IID_TYPELIB="{00020402-0000-0000-C000-000000000046}" ;~ Methods of interface ITypelib $tagITypeLib = "GetTypeInfoCount long();" & _ "GetTypeInfo long(uint;ptr);" & _ "GetTypeInfoType long(uint;ptr);" & _ "GetTypeInfoOfGuid long(ptr;ptr);" & _ "GetLibAttr long(ptr);" & _ "GetTypeComp long(ptr);" & _ "GetDocumentation long(int;ptr;ptr;ptr;ptr);" & _ "IsName long(ptr;ulong;ptr);" & _ "FindName long(ptr;ulong;ptr;ptr;ptr);" & _ "ReleaseTLibAttr long(ptr);" ;~ The file where the type library has to be analysed $szFile="C:\Windows\System32\UIAutomationCore.dll" ;~ $szFile = FileOpenDialog("Open Type Library", "", "TypeLib Files (*.tlb;*.olb;*.dll;*.ocx;*.exe)|All Files (*.*)", 1) Local $oleAutDll = DllOpen("oleaut32.dll") ;~ Just load the typelibrary ;~ try 1 $tp = DllStructCreate("ptr") $result=DllCall($oleAutDll, "ulong", "LoadTypeLib", "wstr", $szFile, "ptr", DllStructGetPtr($tp, 1)) ;~ try 2 ;~ $tp = "" ;~ $result=DllCall($oleAutDll, "ulong", "LoadTypeLib", "wstr", $szFile, "ptr", $tp) consolewrite("LoadTypeLib result: "& $result & " error: " & @Error & @crlf) ;~ Try to get the object interface $oTypelib=objcreateinterface($tp, $IID_TYPELIB, $tagITypeLib) if isobj($oTypelib) Then consolewrite("We have the typelib object") EndIf
;Firstly launches message box requesting if you actually want to launch the daily checks. #include $var = MsgBox(4, "Daily Checks Launch", "Do you want to launch Daily Checks?") WinWait("", "", 120) ;If No will exit If $var = 7 Then Exit ;Check whether screen resolution is correct for browser to launch $var_5 = @DesktopHeight $var_6 = @DesktopWidth $var_7 = @DesktopDepth $var_8 = @DesktopRefresh ;THIS IS THE LINE I'M STUCK ON! If $var_5 = 768 And $var_6 = 1366 And $var_7 = 32 And $var_8 = 60 Then ElseIf $var_5 = Not 768 Or $var_6 = Not 1366 Or $var_7 = 32 Or $var_8 = Not 60 Then $var_9 = MsgBox(16, "Display resolution parser", "You're screen resolution isn't correct for this script. This must be 1366 x 768 60hz Please modify and restart script") If $var_9 = 1 Then Exit EndIf ;Will ask which browser If $var = 6 Then _MsgBox_SetButtonText(6, "Firefox", "IExplorer", "Chrome") $var_1 = _MsgBox(6, "Which Browser?", "Please select your preferred browser?") EndIf If $var_1 = 2 Then Run("C:\Program Files\Mozilla Firefox\firefox.exe") WinWaitActive("[CLASS:MozillaWindowClass]") WinWait("", "", 60)