Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/27/2016 in all areas

  1. The following function will start a batch file to monitor when a program closes and restart if necessary. If you need more explanation than that, then this function isn't for you. Note: You can close the batch file using either the PID returned by _AlwaysRun() (which you'll have to store somewhere e.g. INI file) OR using the Task Manager to manually close the process. Function: Using a Batch file. Save as _AlwaysRun.au3 #include-once #include <Constants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AlwaysRun ; Description ...: Monitor when a program closes and then restart it. ; Syntax ........: _AlwaysRun($sFilePath[, $sCommandline = '']) ; Parameters ....: $sFilePath - FilePath of the program to monitor and restart. ; $sCommandline - [optional] A commandline string to pass to the program on restart. Default is ''. ; Return values .: Success - Returns the PID of the batch file. ; Failure - Returns 0 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _AlwaysRun($sFilePath, $sCommandline = '') If $sFilePath = @ScriptFullPath And @Compiled = 0 Then Return SetError(1, 0, 0) EndIf Local Const $STR_NOCASESENSEBASIC = 2 Local Const $sAppName = StringTrimLeft($sFilePath, StringInStr($sFilePath, '\', $STR_NOCASESENSEBASIC, -1)) Local $sFileName = StringReplace(@ScriptName, StringTrimLeft(@ScriptName, StringInStr(@ScriptName, '.', $STR_NOCASESENSEBASIC, -1) - 1), '') While FileExists(@TempDir & '\' & $sFileName & '.bat') $sFileName &= Chr(Random(65, 122, 1)) WEnd If $sCommandline Then $sCommandline = ' ' & $sCommandline EndIf Local Const $sData = ':START' & @CRLF _ & 'PING -n 2 127.0.0.1 > nul' & @CRLF _ & @CRLF _ & 'TASKLIST /NH /FI "IMAGENAME EQ ' & $sAppName & '" | FIND /I "' & $sAppName & '" >nul && GOTO START' & @CRLF _ & 'GOTO END' & @CRLF _ & ':END' & @CRLF _ & 'START "_AlwaysRun" "' & $sFilePath & '"' & $sCommandline & @CRLF _ & 'GOTO START' & @CRLF Local Const $hFileOpen = FileOpen(@TempDir & '\' & $sFileName & '.bat', $FO_OVERWRITE) If $hFileOpen = -1 Then Return SetError(2, 0, 0) EndIf FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return Run(@TempDir & '\' & $sFileName & '.bat', @TempDir, @SW_HIDE) EndFunc ;==>_AlwaysRun Function: Using a VBScript file. Save as _AlwaysRun.au3 ; Discontinued for now. Example_1: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #include <Constants.au3> #include '_AlwaysRun.au3' ; Compile the following script before running. If @Compiled Then Example() EndIf Func Example() Local $iPID = IniRead(@ScriptDir & '\_AlwaysRunPID.ini', 'Monitor', 'PID', 0) ; Check if the monitoring process is running. If not then call the function _AlwaysRun. (This is the reason why the PID was saved to an INI file.) If ProcessExists($iPID) = 0 Then ; Start monitoring the current script path for when it closes and restart if necessary. No commandline parameters are passed. $iPID = _AlwaysRun(@ScriptFullPath, '') If @error Then Exit MsgBox($MB_SYSTEMMODAL, '_AlwaysRun()', 'The running script must be a compiled exe to work correctly.') EndIf ; Save the PID returned by _AlwaysRun to an INI file in case we need to close the monitoring process in the future. IniWrite(@ScriptDir & '\_AlwaysRunPID.ini', 'Monitor', 'PID', $iPID) Else Local Const $aArray[2] = ['No', 'Yes'] If MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), '_AlwaysRun Running: ' & $aArray[Number(ProcessExists($iPID) > 0)], 'Would you like to continue running the _AlwaysRun Example?') = 7 Then FileDelete(@ScriptDir & '\_AlwaysRunPID.ini') Exit ProcessClose($iPID) EndIf EndIf Exit 0 EndFunc ;==>Example
    1 point
  2. AGlassman

    AutoIT Framework

    Over the years I've written stand-alone AutoIt scripts for specific purposes. So that now I have a large number of little scripts scattered all over. Each one using different methods to do common operations (message logging, error traping, etc), depending on my AutoIt experience at the time I wrote it. As part of a project to consolidate and standardize all of these scripts, and to make them all accessable from a consistent set of HotKeys and Windows Shortcuts, I found myself moving towards a framework of common methods that could be shared by all the scripts, that I call HotRod. Attached is my first try at this kind of framework. All of the framework code is in a set of AutoIt files with three letter names (ACE, BKE). The functions to perform specific actions are defined in lower level includes under the "PRO" (for Profile) directory. The main program is "_HRD" which sets up the framework and waits for HotKey sequences or a call from a Windows Shortcut (the LNK program) to execute a specific function. I would be very interested to hear from anyone else working along similar lines, or comments on what I've done so far. HotRod_Prelim.zip
    1 point
  3. I have been toiling over this for a while... I want to make a program that would go as follows Hold the mouse button down for about a second and nothing major happens... one single click After one second i want the mouse to click rapidly (doubleclick speed) until the mouse button has been released. Also, i would like it all hotkeyed, escape to exit, pause to pause the program (a panic button just in case) and F5 to enable/disable the rapidfire clicking if somone could shed some ideas on this, i would apprieate it. I cant seem to think of any way to make the program register a mouse being heald down after the command for the mouse to be released ahs been sent...
    1 point
  4. Ramzy

    Auto Clicker

    Hi, A very long time ago my friend and I made an auto clicking program. My friend was a lot better at programming scripts. I was basically just watching and learning as we went along. I would like to edit the script and add some improvements to it, but i'm a bit lost. Here are the changes i would like to make: - I would like to bind the left and right mouse button to the auto clicker. Instead of pressing F9 / any other hotkey to start the auto clicker, i would instead like to simply press and hold the left mouse button to start the clicking process. - I would like the auto clicker to STOP as soon as i let go of the button. - Finally, if i wish to use a hotkey, i would like the script to detect what button i press, instead of manually having to key "{F9}" into the little dialog box. Instead, i would like to simply press F9 on my keyboard, or L, or what ever, and have the script automatically enter that in. Thanks muttley Here is the source of the script we made ages ago: ; <AUT2EXE VERSION: 3.1.1.0> ; ---------------------------------------------------------------------------- ; <AUT2EXE INCLUDE-START: C:\Documents and Settings\Ramzy\Desktop\Scripts\1 edit.au3> ; ---------------------------------------------------------------------------- ; The script MsgBox(0, "Ramzy's Auto Clicker", "Refer to the ReadMe file for more help using this program." & @CRLF & " " & @CRLF & "Thanks and enjoy.") $startclick = InputBox("Question", "Button to start left clicking", "{F9}", "", -1, -1, 0, 0) $Rightclick = InputBox("Question", "Button to start right clicking", "{F10}", "", -1, -1, 0, 0) $HK_STOP = InputBox("Question", "Button to stop all clicking commands", "{F11}", "", -1, -1, 0, 0) HotKeySet($startclick, "startclick") HotkeySet($HK_STOP, "HK_STOP") Hotkeyset($Rightclick, "Rightclick") ;HotKeySet("{F8}", "Autobuff") ; This is the clicking function Func startclick() ; Continuous loop that clicks the left mouse button while(1) ; Starts the auto clicker MouseClick("left") Opt("MouseClickDelay", 10) WEnd EndFunc Func Rightclick() ; Continuous loop that clicks the left mouse button while(1) MouseClick("Right") WEnd EndFunc Func Autobuff() While (1) Send("2") Opt("MouseCoordMode", 1) MouseClick("Right",1226,25) Opt("MouseClickDownDelay", 200) Send("3") Opt("MouseCoordMode", 1) MouseClick("Right",1226,25) Opt("MouseClickDownDelay", 200) Send("6") Opt("MouseCoordMode", 1) MouseClick("Right",1226,25) Opt("MouseClickDownDelay", 700) Send("2") Opt("MouseCoordMode", 1) MouseClick("Right",1226,65) Opt("MouseClickDownDelay", 200) Send("3") Opt("MouseCoordMode", 1) MouseClick("Right",1226,65) Opt("MouseClickDownDelay", 200) Send("6") Opt("MouseCoordMode", 1) MouseClick("Right",1226,65) Opt("MouseClickDownDelay", 700) Send("2") Opt("MouseCoordMode", 1) MouseClick("Right",1226,105) Opt("MouseClickDownDelay", 200) Send("3") Opt("MouseCoordMode", 1) MouseClick("Right",1226,105) Opt("MouseClickDownDelay", 200) Send("6") Opt("MouseCoordMode", 1) MouseClick("Right",1226,105) Opt("MouseClickDownDelay", 700) Send("2") Opt("MouseCoordMode", 1) MouseClick("Right",1226,160) Opt("MouseClickDownDelay", 200) Send("3") Opt("MouseCoordMode", 1) MouseClick("Right",1226,160) Opt("MouseClickDownDelay", 200) Send("6") Opt("MouseCoordMode", 1) MouseClick("Right",1226,160) Opt("MouseClickDownDelay", 700) Send("2") Opt("MouseCoordMode", 1) MouseClick("Right",1226,195) Opt("MouseClickDownDelay", 200) Send("3") Opt("MouseCoordMode", 1) MouseClick("Right",1226,195) Opt("MouseClickDownDelay", 200) Send("6") Opt("MouseCoordMode", 1) MouseClick("Right",1226,195) Opt("MouseClickDownDelay", 700) Wend Endfunc ; Stops the program Func HK_STOP() while 1 = 1 Sleep(1000) wend EndFunc ; Need to keep the program running until you press the hotkey while(1) sleep(1000) WEnd ; ---------------------------------------------------------------------------- ; <AUT2EXE INCLUDE-END: C:\Documents and Settings\SSHS4\My Documents\Autoit files\ac3.au3> ; ---------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; <AUT2EXE INCLUDE-END: C:\Documents and Settings\Ramzy\Desktop\Scripts\1 edit.au3> ; ----------------------------------------------------------------------------AutoClicker.au3
    1 point
  5. 1 point
  6. As the help file clearly mentions, the output is a BINARY variant. Obtaining the hex value of the hash is soooo simple that I don't know if this is of any use. Local $bHash = _Crypt_HashData("Original data to be hashed", $CALG_MD5) ConsoleWrite(VarGetType($bHash) & " = " & String($bHash) & " which simply prints as " & StringTrimLeft($bHash, 2) & @LF)
    1 point
  7. Gianni

    Animate UDF

    It works here, (win7 x64, AutoIt v 3.3.14.2) Just change line 187 of animate.au3 from $Size = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hImage, 'float*', 0, 'float*', 0) to $Size = DllCall($__g_hGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hImage, 'float*', 0, 'float*', 0) variable $ghGDIPDll becomes $__g_hGDIPDll
    1 point
  8. Melba23

    Recording keystrokes

    Stratego, Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum Rules on your way in. Please read them now - particularly the bit about not discussing keyloggersand game automation - and then you will understand why this thread will now be locked. Please do not post links to this again. M23
    1 point
  9. Valuater

    Random Mouse Clicker

    maybe this While 1 $Mouse = MouseGetPos() $Random = Random(0, 2, 1) MouseClick("Left", $Mouse[0] + $Random, $Mouse[1]) Sleep(1650) $Random2 = Random(0, 2, 1) MouseClick("Left", $Mouse[0] - $Random, $Mouse[1] + $Random2) Sleep(1650) MouseClick("Left", $Mouse[0] - $Random, $Mouse[1] + $Random2) Sleep(1650) WEnd 8)
    1 point
×
×
  • Create New...