Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/04/2014 in all areas

  1. BeepSongEditor v1.0.2.4 Create easily Beep Songs and Mp3 Ringtones After >Beep Song Creator by Paulie, mine is more intended to hobbyists musicians ( based on a TT22 idea ) Now you can easily create Beep Songs and Mp3 Ringtones without being musician ! Source and Executable are available in the Download Section See Tray menu for options and help. If somes includes are missing : Bass Includes.rar Somes examples of ini files : Ini files.rar Thanks to Brett Francis, Prog@ndy and Eukalyptus for Bass Udf and trancexx for >DSBeep.au3 As usual several files are downloaded at first execution. Beep Party is back !!! Hope you like it !
    1 point
  2. This is a question which gets asked quite a bit >> How to add my program to the Startup Folder? Or How can I make my program run when the PC starts? So for those who want to call a simple Function e.g. _StartupFolder_Install() this UDF is for you. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _Startup ; AutoIt Version : v3.3.10.0 or higher ; Language ......: English ; Description ...: Create startup entries in the startup folder or registry. The registry entries can be Run all the time (Run registry entry) or only once (RunOnce registry entry.) ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: Special thanks to KaFu for EnumRegKeys2Array() which I used as inspiration for enumerating the Registry Keys. ; =============================================================================================================================== ; #INCLUDES# ==================================================================================================================== #include <StringConstants.au3> ; #GLOBAL VARIABLES# ============================================================================================================ Global Enum $STARTUP_RUN = 0, $STARTUP_RUNONCE, $STARTUP_RUNONCEEX ; #CURRENT# ===================================================================================================================== ; _StartupFolder_Exists: Checks if an entry exits in the 'All Users/Current Users' startup folder. ; _StartupFolder_Install: Creates an entry in the 'All Users/Current Users' startup folder. ; _StartupFolder_Uninstall: Deletes an entry in the 'All Users/Current Users' startup folder. ; _StartupRegistry_Exists: Checks if an entry exits in the 'All Users/Current Users' registry. ; _StartupRegistry_Install: Creates an entry in the 'All Users/Current Users' registry. ; _StartupRegistry_Uninstall: Deletes the entry in the 'All Users/Current Users' registry. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; See below. ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupFolder_Exists ; Description ...: Checks if an entry exits in the 'All Users/Current Users' startup folder. ; Syntax ........: _StartupFolder_Exists([$sName = @ScriptName[, $bAllUsers = False]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - True ; Failure - False ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupFolder_Exists($sName = @ScriptName, $bAllUsers = False) Local $sFilePath = Default __Startup_Format($sName, $sFilePath) Return FileExists(__StartupFolder_Location($bAllUsers) & '\' & $sName & '.lnk') EndFunc ;==>_StartupFolder_Exists ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupFolder_Install ; Description ...: Creates an entry in the 'All Users/Current Users' startup folder. ; Syntax ........: _StartupFolder_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCommandline = ''[, ; $bAllUsers = False]]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCommandline - [optional] Commandline arguments to be passed to the application. Default is ''. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupFolder_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCommandline = '', $bAllUsers = False) Return __StartupFolder_Uninstall(True, $sName, $sFilePath, $sCommandline, $bAllUsers) EndFunc ;==>_StartupFolder_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupFolder_Uninstall ; Description ...: Deletes an entry in the 'All Users/Current Users' startup folder. ; Syntax ........: _StartupFolder_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $bAllUsers = False]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $bAllUsers - [optional] Was it added to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupFolder_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath, $bAllUsers = False) Return __StartupFolder_Uninstall(False, $sName, $sFilePath, Default, $bAllUsers) EndFunc ;==>_StartupFolder_Uninstall ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupRegistry_Exists ; Description ...:Checks if an entry exits in the 'All Users/Current Users' registry. ; Syntax ........: _StartupRegistry_Exists([$sName = @ScriptName[, $bAllUsers = False[, $iRunOnce = $STARTUP_RUN]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; $iRunOnce - [optional] Always run at system startup $STARTUP_RUN (0), run only once before explorer is started $STARTUP_RUNONCE (1) ; or run only once after explorer is started $STARTUP_RUNONCEEX (2). Default is $STARTUP_RUN (0). ; Return values .: Success - True ; Failure - False ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupRegistry_Exists($sName = @ScriptName, $bAllUsers = False, $iRunOnce = $STARTUP_RUN) Local $sFilePath = Default __Startup_Format($sName, $sFilePath) RegRead(__StartupRegistry_Location($bAllUsers, $iRunOnce) & '\', $sName) Return @error = 0 EndFunc ;==>_StartupRegistry_Exists ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupRegistry_Install ; Description ...: Creates an entry in the 'All Users/Current Users' registry. ; Syntax ........: _StartupRegistry_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCommandline = ''[, ; $bAllUsers = False[, $iRunOnce = $STARTUP_RUN]]]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCommandline - [optional] Commandline arguments to be passed to the application. Default is ''. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; $iRunOnce - [optional] Always run at system startup $STARTUP_RUN (0), run only once before explorer is started $STARTUP_RUNONCE (1) ; or run only once after explorer is started $STARTUP_RUNONCEEX (2). Default is $STARTUP_RUN (0). ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupRegistry_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCommandline = '', $bAllUsers = False, $iRunOnce = $STARTUP_RUN) Return __StartupRegistry_Uninstall(True, $sName, $sFilePath, $sCommandline, $bAllUsers, $iRunOnce) EndFunc ;==>_StartupRegistry_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupRegistry_Uninstall ; Description ...: Deletes the entry in the 'All Users/Current Users' registry. ; Syntax ........: _StartupRegistry_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $bAllUsers = False[, ; $iRunOnce = Default]]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $bAllUsers - [optional] Was it added to the current users (0) or all users (1). Default is 0. ; $iRunOnce - [optional] Was it run at system startup $STARTUP_RUN (0), run only once before explorer is started $STARTUP_RUNONCE (1) ; or run only once after explorer is started $STARTUP_RUNONCEEX (2). Default is $STARTUP_RUN (0). ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupRegistry_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath, $bAllUsers = False, $iRunOnce = $STARTUP_RUN) Return __StartupRegistry_Uninstall(False, $sName, $sFilePath, Default, $bAllUsers, $iRunOnce) EndFunc ;==>_StartupRegistry_Uninstall ; #INTERNAL_USE_ONLY#============================================================================================================ Func __Startup_Format(ByRef $sName, ByRef $sFilePath) If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '\.[^.\\/]*$', '') ; Remove extension. Return Not (StringStripWS($sName, $STR_STRIPALL) == '') And FileExists($sFilePath) EndFunc ;==>__Startup_Format Func __StartupFolder_Location($bAllUsers) Return $bAllUsers ? @StartupCommonDir : @StartupDir EndFunc ;==>__StartupFolder_Location Func __StartupFolder_Uninstall($bIsInstall, $sName, $sFilePath, $sCommandline, $bAllUsers) If Not __Startup_Format($sName, $sFilePath) Then Return SetError(1, 0, False) ; $STARTUP_ERROR_EXISTS EndIf If $bAllUsers = Default Then $bAllUsers = False EndIf If $sCommandline = Default Then $sCommandline = '' EndIf Local Const $sStartup = __StartupFolder_Location($bAllUsers) Local Const $hSearch = FileFindFirstFile($sStartup & '\' & '*.lnk') Local $vReturn = 0 If $hSearch > -1 Then Local Const $iStringLen = StringLen($sName) Local $aFileGetShortcut = 0, _ $sFileName = '' While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop EndIf If StringLeft($sFileName, $iStringLen) = $sName Then $aFileGetShortcut = FileGetShortcut($sStartup & '\' & $sFileName) If @error Then ContinueLoop EndIf If $aFileGetShortcut[0] = $sFilePath Then $vReturn += FileDelete($sStartup & '\' & $sFileName) EndIf EndIf WEnd FileClose($hSearch) ElseIf Not $bIsInstall Then Return SetError(2, 0, False) ; $STARTUP_ERROR_EMPTY EndIf If $bIsInstall Then $vReturn = FileCreateShortcut($sFilePath, $sStartup & '\' & $sName & '.lnk', $sStartup, $sCommandline) > 0 Else $vReturn = $vReturn > 0 EndIf Return $vReturn EndFunc ;==>__StartupFolder_Uninstall Func __StartupRegistry_Location($bAllUsers, $iRunOnce) If $iRunOnce = Default Then $iRunOnce = $STARTUP_RUN EndIf Local $sRunOnce = '' Switch $iRunOnce Case $STARTUP_RUNONCE $sRunOnce = 'Once' Case $STARTUP_RUNONCEEX $sRunOnce = 'OnceEx' Case Else $sRunOnce = '' EndSwitch Return ($bAllUsers ? 'HKEY_LOCAL_MACHINE' : 'HKEY_CURRENT_USER') & _ ((@OSArch = 'X64') ? '64' : '') & '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' & $sRunOnce EndFunc ;==>__StartupRegistry_Location Func __StartupRegistry_Uninstall($bIsInstall, $sName, $sFilePath, $sCommandline, $bAllUsers, $iRunOnce) If Not __Startup_Format($sName, $sFilePath) Then Return SetError(1, 0, False) ; $STARTUP_ERROR_EXISTS EndIf If $bAllUsers = Default Then $bAllUsers = False EndIf If $sCommandline = Default Then $sCommandline = '' EndIf Local Const $sRegistryKey = __StartupRegistry_Location($bAllUsers, $iRunOnce) Local $iInstance = 1, _ $sRegistryName = '', _ $vReturn = 0 While 1 $sRegistryName = RegEnumVal($sRegistryKey & '\', $iInstance) If @error Then ExitLoop EndIf If ($sRegistryName = $sName) And StringInStr(RegRead($sRegistryKey & '\', $sRegistryName), $sFilePath, $STR_NOCASESENSEBASIC) Then $vReturn += RegDelete($sRegistryKey & '\', $sName) EndIf $iInstance += 1 WEnd If $bIsInstall Then $vReturn = RegWrite($sRegistryKey & '\', $sName, 'REG_SZ', $sFilePath & ' ' & $sCommandline) > 0 Else $vReturn = $vReturn > 0 EndIf Return $vReturn EndFunc ;==>__StartupRegistry_UninstallExample 1: #include '_Startup.au3' Example() Func Example() _StartupFolder_Install() ; Add the running EXE to the Current Users startup folder. ShellExecute(@StartupDir & '\') Sleep(5000) _StartupFolder_Uninstall() ; Remove the running EXE from the Current Users startup folder. EndFunc ;==>ExampleExample 2: #include '_Startup.au3' Example() Func Example() _StartupRegistry_Install() ; Add the running EXE to the Current Users Run registry key. Sleep(5000) _StartupRegistry_Uninstall() ; Remove the running EXE from the Current Users Run registry key. EndFunc ;==>ExampleAll of the above has been included in a ZIP file. Startup.zipPrevious: 1447+ downloads.
    1 point
  3. BinaryToAu3Kompressor v1.0.5.4 It's now possible to see the best compression ratio using LZMA, LZNT and Base64 compressions with differents combinations. Nothing too complicate, you drag'n drop a file on the picture and script Test all compression types and return the ratios. ( Test duration depends of file size, slowest compression is LZNT, but all decompressions are fast ) Free to you after, to choose the compression(s) you want... Yes, LZMA needs a dll ( embedded & compressed in script ) but brings a powerfull compression. It opens scite with your file compressed to an au3 script with or without decompression function as you want. Hold Left Shift key when clicking button for just copy script to clipboard. Use the 3 compressions at a time works but doesn't give a good ratio, that's why i don't display it. Usefull for little files you want include in your scripts ! No externals files needed, they are already in script. Previous downloads : 1103 Source and Executable BinaryToAu3Kompressor will be added to the next version of >SciTEHopper Thanks to Ward for his >Base64.au3 and LZMA.au3, and trancexx for his >LZNT functions and his >Base64Decode function.
    1 point
  4. Ver 1.0.2 Need I say More??? EzSkin_1_2_3.zip - previous downloads 4,804 Major Thanks to big_daddy and all his contributions! Enjoy!!! Valuater 8)
    1 point
  5. water

    Active Directory UDF

    I have converted and extended the adfunctions.au3 written by Jonathan Clelland to a full AutoIt UDF including help file, examples, ScITE integration etc. The example scripts should run fine without changes. 2016-08-18: Version: 1.4.6.0 As always: Please test before using in production! KNOWN BUGS: (Last changed: ) None AD 1.4.6.0.zip For AutoIt >= 3.3.12.0 AD 1.4.0.0.zip other versions of AutoIt
    1 point
  6. Having used the _SelfDelete() function before, I knew it could be improved upon with adding more functionality to compensate for when an AutoIt error might occur. The version I updated includes the ability to monitor when the process is closed and/or the timer is reached, therefore if an error was to occur with your program and the _SelfDelete() function was called before, it will still delete the executable even with an AutoIt error (due to bad coding of course!) This can't be said for the old version of _SelfDelete() as you'll never have chance to call the function! I also included the option to check either the process name or PID, depending on your preference. Thanks. Function: Using a Batch script. Save as _SelfDelete.au3 #include-once #include <FileConstants.au3> #include <StringConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SelfDelete ; Description ...: Delete the current executable after it's finished processing and/or the timer has been reached. ; Syntax ........: _SelfDelete([$iDelay = 5[, $fUsePID = False[, $fRemoveDir = False]]]) ; Parameters ....: $iDelay - [optional] An integer value for the delay to wait (in seconds) before stopping the process and deleting the executable. ; If 0 is specified then the batch will wait indefinitely until the process no longer exits. Default is 5 (seconds). ; $fUsePID - [optional] Use the process name (False) or PID (True). Default is False. ; $fRemoveDir - [optional] Remove the script directory as well (True) or only the running executable (False). Default is False. ; Return values .: Success - Returns the PID of the batch file. ; Failure - Returns 0 & sets @error to non-zero ; Author ........: guinness ; Modified ......: ; Remarks .......: The idea for removing the directory came from: http://www.autoitscript.com/forum/topic/137287-delete-scriptdir/ ; Example .......: Yes ; =============================================================================================================================== Func _SelfDelete($iDelay = 5, $fUsePID = Default, $fRemoveDir = Default) If @Compiled = 0 Then Return SetError(1, 0, 0) EndIf Local $sTempFileName = @ScriptName $sTempFileName = StringLeft($sTempFileName, StringInStr($sTempFileName, '.', $STR_NOCASESENSEBASIC, -1) - 1) While FileExists(@TempDir & '\' & $sTempFileName & '.bat') $sTempFileName &= Chr(Random(65, 122, 1)) WEnd $sTempFileName = @TempDir & '\' & $sTempFileName & '.bat' Local $sDelay = '' $iDelay = Int($iDelay) If $iDelay > 0 Then $sDelay = 'IF %TIMER% GTR ' & $iDelay & ' GOTO DELETE' EndIf Local $sRemoveDir = '' If $fRemoveDir Then $sRemoveDir = 'RD /S /Q "' & FileGetShortName(@ScriptDir) & '"' & @CRLF EndIf Local $sAppID = @ScriptName, $sImageName = 'IMAGENAME' If $fUsePID Then $sAppID = @AutoItPID $sImageName = 'PID' EndIf Local Const $iInternalDelay = 2, _ $sScriptPath = FileGetShortName(@ScriptFullPath) Local Const $sData = 'SET TIMER=0' & @CRLF _ & ':START' & @CRLF _ & 'PING -n ' & $iInternalDelay & ' 127.0.0.1 > nul' & @CRLF _ & $sDelay & @CRLF _ & 'SET /A TIMER+=1' & @CRLF _ & @CRLF _ & 'TASKLIST /NH /FI "' & $sImageName & ' EQ ' & $sAppID & '" | FIND /I "' & $sAppID & '" >nul && GOTO START' & @CRLF _ & 'GOTO DELETE' & @CRLF _ & @CRLF _ & ':DELETE' & @CRLF _ & 'TASKKILL /F /FI "' & $sImageName & ' EQ ' & $sAppID & '"' & @CRLF _ & 'DEL "' & $sScriptPath & '"' & @CRLF _ & 'IF EXIST "' & $sScriptPath & '" GOTO DELETE' & @CRLF _ & $sRemoveDir _ & 'GOTO END' & @CRLF _ & @CRLF _ & ':END' & @CRLF _ & 'DEL "' & $sTempFileName & '"' Local Const $hFileOpen = FileOpen($sTempFileName, $FO_OVERWRITE) If $hFileOpen = -1 Then Return SetError(2, 0, 0) EndIf FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return Run($sTempFileName, @TempDir, @SW_HIDE) EndFunc ;==>_SelfDeleteFunction: Using a VBScript file. Save as _SelfDelete.au3 #include-once #include <FileConstants.au3> #include <StringConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SelfDelete ; Description ...: Delete the current executable after it's finished processing and/or the timer has been reached. ; Syntax ........: _SelfDelete([$iDelay = 5[, $fUsePID = False[, $fRemoveDir = False]]]) ; Parameters ....: $iDelay - [optional] An integer value for the delay to wait (in seconds) before stopping the process and deleting the executable. ; If 0 is specified then the script will wait indefinitely until the process no longer exits. Default is 5 (seconds). ; $fUsePID - [optional] Use the process name (False) or PID (True). Default is False. ; $fRemoveDir - [optional] Remove the script directory as well (True) or only the running executable (False). Default is False. ; Return values .: Success - Returns the PID of the batch file. ; Failure - Returns 0 & sets @error to non-zero ; Author ........: guinness ; Modified ......: ; Remarks .......: The idea for removing the directory came from: http://www.autoitscript.com/forum/topic/137287-delete-scriptdir/ ; Example .......: Yes ; =============================================================================================================================== Func _SelfDelete($iDelay = 5, $fUsePID = Default, $fRemoveDir = Default) If @Compiled = 0 Then Return SetError(1, 0, False) EndIf Local $sTempFileName = @ScriptName $sTempFileName = StringLeft($sTempFileName, StringInStr($sTempFileName, '.', $STR_NOCASESENSEBASIC, -1) - 1) While FileExists(@TempDir & '\' & $sTempFileName & '.bat') $sTempFileName &= Chr(Random(65, 122, 1)) WEnd $sTempFileName = @TempDir & '\' & $sTempFileName & '.vbs' Local $sDelay = '' $iDelay = Int($iDelay) If $iDelay > 0 Then $sDelay = @TAB & 'iTimeOut = iTimeOut + 1' & @CRLF _ & @TAB & 'If iTimeOut > ' & $iDelay & ' Then' & @CRLF _ & @TAB & @TAB & 'For Each oProcess in oWMIQuery' & @CRLF _ & @TAB & @TAB & @TAB & 'oProcess.Terminate()' & @CRLF _ & @TAB & @TAB & 'Next' & @CRLF _ & @TAB & @TAB & 'iExit = 2' & @CRLF _ & @TAB & 'End If' & @CRLF EndIf Local $sRemoveDir = '' If $fRemoveDir Then $sRemoveDir = 'oFileSystem.DeleteFolder "' & @ScriptDir & '", True' & @CRLF EndIf Local $sAppID = @ScriptName, $sImageName = 'Name' If $fUsePID Then $sAppID = @AutoItPID $sImageName = 'ProcessId' EndIf Local Const $iInternalDelay = 10, _ $sScriptPath = @ScriptFullPath Local Const $sData = 'Option Explicit' & @CRLF _ & 'Dim iExit, iTimeOut, oFileSystem, oProcess, oWMIQuery, oWMIService, sComputer, sFilePath, sWMIQuery' & @CRLF _ & @CRLF _ & 'sFilePath = "' & $sScriptPath & '"' & @CRLF _ & @CRLF _ & 'iExit = 0' & @CRLF _ & 'iTimeOut = 0' & @CRLF _ & 'sComputer = "."' & @CRLF _ & @CRLF _ & 'Set oWMIService = GetObject("winmgmts:" _' & @CRLF _ & @TAB & @TAB & '& "{impersonationLevel=impersonate}!\\" _' & @CRLF _ & @TAB & @TAB & '& sComputer & "\root\cimv2")' & @CRLF _ & @CRLF _ & 'sWMIQuery = "Select * From Win32_Process Where ' & $sImageName & ' = ''' & $sAppID & '''"' & @CRLF _ & @CRLF _ & 'While (iExit = 0)' & @CRLF _ & @TAB & 'Set oWMIQuery = oWMIService.ExecQuery(sWMIQuery)' & @CRLF _ & @TAB & 'If oWMIQuery.Count = 0 Then' & @CRLF _ & @TAB & @TAB & 'iExit = 1' & @CRLF _ & @TAB & 'End If' & @CRLF _ & @TAB & 'WScript.Sleep(1000)' & @CRLF _ & $sDelay _ & 'Wend' & @CRLF _ & @CRLF _ & 'WScript.Sleep(1000)' & @CRLF _ & 'iExit = 0' & @CRLF _ & 'iTimeOut = 0' & @CRLF _ & 'Set oFileSystem = CreateObject("Scripting.FileSystemObject")' & @CRLF _ & 'While (iExit = 0)' & @CRLF _ & @TAB & 'iTimeOut = iTimeOut + 1' & @CRLF _ & @TAB & 'If oFileSystem.FileExists(sFilePath) Then' & @CRLF _ & @TAB & @TAB & 'oFileSystem.DeleteFile sFilePath, True' & @CRLF _ & @TAB & 'End If' & @CRLF _ & @TAB & 'If oFileSystem.FileExists(sFilePath) <> True Then' & @CRLF _ & @TAB & @TAB & 'iExit = 1' & @CRLF _ & @TAB & 'End If' & @CRLF _ & @TAB & 'If iTimeOut > ' & $iInternalDelay & ' Then' & @CRLF _ & @TAB & @TAB & 'iExit = 2' & @CRLF _ & @TAB & 'End If' & @CRLF _ & 'Wend' & @CRLF _ & @CRLF _ & $sRemoveDir _ & 'oFileSystem.DeleteFile WScript.ScriptFullName, True' & @CRLF _ Local Const $hFileOpen = FileOpen($sTempFileName, $FO_OVERWRITE) If $hFileOpen = -1 Then Return SetError(2, 0, False) EndIf FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return ShellExecute($sTempFileName, @TempDir, @TempDir, '', @SW_HIDE) EndFunc ;==>_SelfDeleteExample use of Function: #include <MsgBoxConstants.au3> #include '_SelfDelete.au3' _SelfDelete(30, 0) ; Start the SelfDelete batch file with a 30 second timer and using the prcocess name rather than the PID. If @error Then Exit MsgBox($MB_SYSTEMMODAL, '_SelfDelete()', 'The script must be a compiled exe to work correctly.') ; Display a warning if the script isn't compiled. EndIf While 1 Sleep(100) ; Wait or manually close the application via the traymenu icon. WEndWARNING: This will delete your executable if the function is called, so take the proper precautions and make sure you backup.
    1 point
  7. A question by Xenobiologist was asked in the >_SelfDelete() thread of whether or not I could create a function to update the running executable, so here is the _SelfUpdate function. Function: Using a Batch script. Save as _SelfUpdate.au3 #include-once #include <FileConstants.au3> #include <StringConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SelfUpdate ; Description ...: Update the running executable with another executable. ; Syntax ........: _SelfUpdate($sUpdatePath[, $fRestart = False[, $iDelay = 5[, $fUsePID = False]]]) ; Parameters ....: $sUpdatePath - Path string of the update file to overwrite the running executable. ; $fRestart - [optional] Restart the application (True) or to not restart (False) after overwriting. Default is False. ; $iDelay - [optional] An integer value for the delay to wait (in seconds) before stopping the process and deleting the executable. ; If 0 is specified then the batch will wait indefinitely until the process no longer exits. Default is 5 (seconds). ; $fUsePID - [optional] Use the process name (False) or PID (True). Default is False. ; $fBackupPath - [optional] Backup the filepath. Default is True. ; Return values .: Success - Returns the PID of the batch file. ; Failure - Returns 0 & sets @error to non-zero ; Author ........: guinness ; Modified ......: ; Remarks .......: The current executable is renamed to AppName_Backup.exe if $fBackupPath is set to True. ; Example .......: Yes ; =============================================================================================================================== Func _SelfUpdate($sUpdatePath, $fRestart = Default, $iDelay = 5, $fUsePID = Default, $fBackupPath = Default) If @Compiled = 0 Or FileExists($sUpdatePath) = 0 Then Return SetError(1, 0, 0) EndIf Local $sTempFileName = @ScriptName $sTempFileName = StringLeft($sTempFileName, StringInStr($sTempFileName, '.', $STR_NOCASESENSEBASIC, -1) - 1) Local Const $sScriptPath = @ScriptFullPath Local $sBackupPath = '' If $fBackupPath Or $fBackupPath = Default Then $sBackupPath = 'MOVE /Y ' & '"' & $sScriptPath & '"' & ' "' & @ScriptDir & '\' & $sTempFileName & '_Backup.exe' & '"' & @CRLF EndIf While FileExists(@TempDir & '\' & $sTempFileName & '.bat') $sTempFileName &= Chr(Random(65, 122, 1)) WEnd $sTempFileName = @TempDir & '\' & $sTempFileName & '.bat' If $iDelay = Default Then $iDelay = 5 EndIf Local $sDelay = '' $iDelay = Int($iDelay) If $iDelay > 0 Then $sDelay = 'IF %TIMER% GTR ' & $iDelay & ' GOTO DELETE' EndIf Local $sAppID = @ScriptName, $sImageName = 'IMAGENAME' If $fUsePID Then $sAppID = @AutoItPID $sImageName = 'PID' EndIf Local $sRestart = '' If $fRestart Then $sRestart = 'START "" "' & $sScriptPath & '"' EndIf Local Const $iInternalDelay = 2 Local Const $sData = '@ECHO OFF' & @CRLF & 'SET TIMER=0' & @CRLF _ & ':START' & @CRLF _ & 'PING -n ' & $iInternalDelay & ' 127.0.0.1 > nul' & @CRLF _ & $sDelay & @CRLF _ & 'SET /A TIMER+=1' & @CRLF _ & @CRLF _ & 'TASKLIST /NH /FI "' & $sImageName & ' EQ ' & $sAppID & '" | FIND /I "' & $sAppID & '" >nul && GOTO START' & @CRLF _ & 'GOTO MOVE' & @CRLF _ & @CRLF _ & ':MOVE' & @CRLF _ & 'TASKKILL /F /FI "' & $sImageName & ' EQ ' & $sAppID & '"' & @CRLF _ & $sBackupPath & _ 'GOTO END' & @CRLF _ & @CRLF _ & ':END' & @CRLF _ & 'MOVE /Y ' & '"' & $sUpdatePath & '"' & ' "' & $sScriptPath & '"' & @CRLF _ & $sRestart & @CRLF _ & 'DEL "' & $sTempFileName & '"' Local Const $hFileOpen = FileOpen($sTempFileName, $FO_OVERWRITE) If $hFileOpen = -1 Then Return SetError(2, 0, 0) EndIf FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return Run($sTempFileName, @TempDir, @SW_HIDE) EndFunc ;==>_SelfUpdateExample use of Function: #include <MsgBoxConstants.au3> #include '_SelfUpdate.au3' ; Start the SelfUpdate batch file with a 30 second timer, using the process name rather than the PID and restart the application after updating. _SelfUpdate(@ScriptDir & '\Test_Update.exe', True, 30, False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, '_SelfUpdate()', 'The script must be a compiled exe to work correctly or the update file must exist.') ; Display a warning if the script isn't compiled or the file doesn't exist. EndIf While 1 Sleep(100) ; Wait or manually close the application via the traymenu icon. WEnd
    1 point
  8. I thought I would post this just to show the only thing that can limit you is not the language but your imagination. I realise this isn't open source, but most of the Functions can either be found in my signature or on the Forum. This is created in AutoIt. Download: http://softwarespot.wordpress.com/software/pastebin/
    1 point
  9. Try this (if it's an actual popup, and not a new window): $hPopup = _WinAPI_GetWindow($hYourParentWindow,6) Consolewrite(WinGetTitle($hPopup) & @crlf)
    1 point
  10. Use the window's classname instead of it's title.
    1 point
  11. So, because you find it useful it should be that way for everyone?? Melba has given you a perfectly reasonable workaround, which I'm still not understanding why you can't be bothered to use. Not everyone would see benefit from ArrayDisplay defaulting to the line number - I, for one, know what my script is doing well enough that I have never had to use that particular bit of hack.
    1 point
  12. gil900, Open SciTEConfig and select "Abbrev manager" from the "Other Tools" tab - then you can add the abbreviation for yourself. M23
    1 point
  13. In the above 2 examples I gave before the intention was for you to see if the command that was getting sent to your command prompt from autoit is in the correct format. When I run the second example myself I am getting a command prompt window that says: c:>extract.exe -DATE 04/12/2014/07 If you were to type the above in your command window manually would it work? If not then what do you want it to say instead? How is the above syntax not correct for your extract.exe?
    1 point
  14. Perhaps I missed something, but doesn't it work if you just remove the 240 timeout in the MsgBox ? MsgBox(0,"Software Installation","Voltage ....... installation.", 240) ShellExecuteWait("Kill.exe", "", "", "open") Without a timeout a msgbox is blocking...
    1 point
  15. Looks like it's a >context issue. You can modify FF.au3 by changing _FFCmd('FFau3.simulateEvent=function simulateEvent(a,b,c){try{var d=document.createEvent(b);switch(b){case"MouseEvents":d.initMouseEvent(c,true,true,window,0,0,0,simulateEvent.arguments[4],simulateEvent.arguments[5],false,false,false,false,0,null);break;case"KeyboardEvent":d.initKeyEvent(c,true,true,null,false,false,false,false,simulateEvent.arguments[3],0);break;case"Event":d.initEvent(c,true,true);break}a.dispatchEvent(d);return 1}catch(e){return-3}return 0};') to _FFCmd('FFau3.simulateEvent=function simulateEvent(a,b,c){try{var d=FFau3.WCD.createEvent(b);switch(b){case"MouseEvents":d.initMouseEvent(c,true,true,window,0,0,0,simulateEvent.arguments[4],simulateEvent.arguments[5],false,false,false,false,0,null);break;case"KeyboardEvent":d.initKeyEvent(c,true,true,null,false,false,false,false,simulateEvent.arguments[3],0);break;case"Event":d.initEvent(c,true,true);break}a.dispatchEvent(d);return 1}catch(e){return-3}return 0};') However, I haven't tested this and it may have a negative impact on other code. The alternative is to manually execute the desired code using _FFCmd: _ffxpath(".//*[@class='tile'][position()=1]", "", 9) _FFCmd("d=FFau3.WCD.createEvent('MouseEvent');d.initMouseEvent('mousedown',true,true,window,0,0,0,0,0,0,0,0,0,0,null);FFau3.xpath.dispatchEvent(d);")
    1 point
  16. Unc3nZureD

    Random()

    As it had been said, use SRandom, so you can set a seed. Probably Autoit automatically uses time() function as a seed, which can cause such problems. If you choose a better Seed (like the previously mentioned PID) you can avoid it.
    1 point
  17. That's what I said in post #4, 5 months ago. All you had to do is read my reply and you would have known this without going about it the hard way.
    1 point
  18. Melba23

    Random()

    Hi, I knew this had been discussed before, but it took a while to find it. M23
    1 point
  19. computergroove

    Random()

    I made this with the help of a moderator to show the results of random: #include <GUIConstantsEx.au3> Global $aLabel[11], $bStart = False $hGUI = GUICreate("Form1", 157, 438, 336, 218) GUICtrlCreateLabel("Random Number Count", 16, 16, 115, 17) For $i = 1 To 10 GUICtrlCreateLabel("1", 24, 152 + (24 * $i), 10, 17) $aLabel[$i] = GUICtrlCreateLabel(0, 64, 152 + (24 * $i), 30, 17) Next GUICtrlCreateLabel("Speed", 32, 120, 35, 17) $cSpeed = GUICtrlCreateInput(100, 24, 136, 49, 21) $cStart = GUICtrlCreateButton("Start", 24, 48, 89, 25) $ButtonResetCount = GUICtrlCreateButton("Reset Count", 24, 80, 89, 25) GUISetState(@SW_SHOW) $nTimeStamp = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cStart Switch GUICtrlRead($cStart) Case "Start" GUICtrlSetData($cStart, "Stop") $bStart = True Case Else GUICtrlSetData($cStart, "Start") $bStart = False EndSwitch Case $ButtonResetCount ResetCount() EndSwitch If $bStart Then If TimerDiff($nTimeStamp) > GUICtrlRead($cSpeed) Then $iRandom = Random(1, 10, 1) GUICtrlSetData($aLabel[$iRandom], GUICtrlRead($aLabel[$iRandom]) + 1) $nTimeStamp = TimerInit() EndIf EndIf WEnd Func ResetCount() For $i = 1 To 10 GUICtrlSetData($aLabel[$i], 0) Next $bStart = False EndFunc ;==>ResetCount
    1 point
  20. Yashied

    Random()

    Try to use SRandom() at the beginning of your script: SRandom(@AutoItPID)
    1 point
  21. at first glance it seems very easy to achieve in just 2 steps: 1) the autoit program could be of just one line like this: Run("C:\directory\extract.exe -DATE " & @MDAY & "/" & @MON & "/" & @YEAR & "/" & @HOUR) compile the above script and save it as say "C:directoryMyProg.exe" for example 2) then at dos promt type this command (needs to be typed only one time) to schedule your job for all days of all months: AT 6:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 "C:\directory\MyProg.exe" This dos command should plan to run your autoit program every day at 6:00am, and in turn your program should run the "C:directoryextract.exe" with parameters as required.
    1 point
  22. trancexx

    DSBeep

    With the release of latest beta v3.3.7.22 code regarding Interfaces is completely finished. This allows native usage of many objects that required additional UDFs before (mainly AutoItObject). No more. As example I will show how to use few DirectSound interfaces using nothing but built-in functions. Script this was based on was posted (I have highlighted keywords). DirecSound's IDirectSound8 in combination with IDirectSoundBuffer interface imitates old beep sound. Include script: DSBeep.au3 An example could be (one of AZIJO's songs): #include "DSBeep.au3" Opt("MustDeclareVars", 1) HotKeySet("{ESC}", "_Quit") ; Error monitoring (thru the life time of the script) Global $oErrorObject = ObjEvent("AutoIt.Error", "_ErrFunc") ; Implemenation Func _ErrFunc($oError) ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF) EndFunc ;==>_ErrFunc ; Initialize DSBeep _StartDSBeep() ; Play _Beep(8, 4, 100, 0, 0.8, 0) ; set tempo and tone _Beep(7,4,100) _Beep(8,4,100) _Beep(9,4,100) _Beep(8,4,100,100) _Beep(1,5,100,100) _Beep(8, 4, 100, 0, 1) ; new tempo _Beep(7,4,100) _Beep(8,4,100) _Beep(9,4,100) _Beep(8,4,100,100) _Beep(12,4,100,100) _Beep(8,4,100) _Beep(7,4,100) _Beep(8,4,100) _Beep(9,4,100) _Beep(8,4,100) _Beep(6, 5, 100, 0, 0.8) ; new tempo _Beep(3,5,100) _Beep(12,4,100) _Beep(8,4,100) _Beep(6,4,100) _Beep(5,4,100) _Beep(4,4,200,300) _Beep(1,5,100) _Beep(12,4,100) _Beep(11,4,100) _Beep(9,4,100) _Beep(1,5,100,100) _Beep(6,5,100,100) _Beep(4,5,100) _Beep(3,5,100) _Beep(1,5,100) _Beep(8,4,100) _Beep(1,5,100,100) _Beep(4,5,100,100) _Beep(4,5,100) _Beep(3,5,100) _Beep(1,5,100) _Beep(3,5,100) _Beep(3,4,100) _Beep(7,4,100) _Beep(10,4,100) _Beep(1,5,100) _Beep(4,5,100) _Beep(3,5,100) _Beep(1,5,100) _Beep(3,5,250,250) ;=========================== _Beep(8, 4, 100, 0, 1.1) ; new tempo _Beep(7, 4, 100) _Beep(8, 4, 100) _Beep(9, 4, 100) _Beep(8, 4, 100, 100) _Beep(1, 5, 100, 100) _Beep(8, 4, 100) _Beep(7, 4, 100) _Beep(8, 4, 100) _Beep(9, 4, 100) _Beep(8, 4, 100, 100) _Beep(12, 4, 100, 100) _Beep(8, 4, 100) _Beep(7, 4, 100) _Beep(8, 4, 100) _Beep(9, 4, 100) _Beep(8, 4, 100) _Beep(6, 5, 100) _Beep(3, 5, 100) _Beep(12, 4, 100) _Beep(8, 4, 100) _Beep(6, 4, 100) _Beep(5, 4, 100) _Beep(4, 4, 200, 300) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(9, 4, 100) _Beep(1, 5, 100, 100) _Beep(6, 5, 100, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(8, 4, 100) _Beep(1, 5, 100, 100) _Beep(4, 5, 100, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(3, 5, 100) ;============================= _Beep(8, 4, 100) _Beep(12, 4, 100) _Beep(3, 5, 100) _Beep(8, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 300, 200) _Beep(3, 5, 100, 0, 1.8) ; new tempo _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(9, 4, 200, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(8, 4, 200, 100) _Beep(4, 5, 100, 0, 1.1) ; new tempo _Beep(3, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(3, 5, 150, 150) _Beep(11, 4, 300, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(9, 4, 100) _Beep(11, 4, 400, 100) _Beep(3, 5, 100, 0, 1.8) ; new tempo _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(4, 4, 100) _Beep(8, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(9, 4, 200, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(3, 4, 100) _Beep(6, 4, 100) _Beep(11, 4, 100) _Beep(12, 4, 100) _Beep(1, 5, 150, 150) _Beep(8, 4, 150, 150) _Beep(4, 5, 100, 0, 1.2) ; new tempo _Beep(3, 5, 100) _Beep(2, 5, 100) _Beep(1, 5, 100) _Beep(12, 4, 100) _Beep(1, 5, 100) _Beep(3, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(4, 5, 100) _Beep(11, 4, 100) _Beep(4, 5, 100) _Beep(8, 5, 100) _Beep(11, 5, 100, 0, 0.8) ; new tempo _Beep(10, 5, 100) _Beep(9, 5, 100) _Beep(8, 5, 100) _Beep(6, 5, 100) _Beep(4, 5, 100) _Beep(3, 5, 100) _Beep(1, 5, 100) _Beep(11, 4, 100) _Beep(9, 4, 100, 0, 0.5) ; new tempo _Beep(8, 4, 100) _Beep(6, 4, 100, 0, 0.2) ; new tempo _Beep(4, 4, 200) ; Stop the engine _StopDSBeep() ; Exit (redundant) _Quit() Func _Quit() Exit EndFunc ;==>_Quit Have that code in the same folder as DSBeep.au3.
    1 point
  23. wakillon

    Animated Splash

    PNG with transparency are great for splashscreen and taking the idea of AutoBert, I had fun trying differents combinations, and it gives this : Previous downloads : 1065 AnimatedSplash2014.2.au3 I hope you enjoy these few examples ! All Png are downloaded on postimg.org at first execution.
    1 point
  24. guinness

    ...

    Improved >> Now it's a standalone Function without the requirement for any #includes.
    1 point
  25. guinness

    ...

    I found this topic: #500084 and had a go at eliminating _StringBetween() and instead opting for StringRegExp(). Based on the idea by wakillon. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetIP_Country ; Description ...: Retrieve details about the country of origin for an IP address. ; Syntax ........: _GetIP_Country() ; Parameters ....: Success - An array contain details: ; $aArray[0] - IP address ; $aArray[1] - ISP ; $aArray[2] - Region ; $aArray[3] - Country code ; Failuer - Returns 0 and sets @error to non-zero. ; Return values .: None ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GetIP_Country() Local $aSRE = StringRegExp(BinaryToString(InetRead('http://xml.utrace.de/?query=' & _GetIP())), _ '<ip>([\d.]{7,15})</ip>\n' & _ '<host>[^>]*</host>\n' & _ '<isp>([^>]+)</isp>\n' & _ '<org>[^>]+</org>\n' & _ '<region>([^>]+)</region>\n' & _ '<countrycode>([^>]+)</countrycode>\n', 3) If @error Then Return SetError(@error, 0, 0) Return $aSRE EndFunc ;==>_GetIP_CountryExample use of Function: #include <Array.au3> ; Not Required, Only Needed For _ArrayDisplay() #include <Inet.au3> Local $aCountry = _GetIP_Country() _ArrayDisplay($aCountry)
    1 point
  26. Valuater

    xskin or ezskin

    There is actually a verysimple answer to that question Use EzSkin for an easy choice of skins with picture buttons having roll-over and click effect. That can be accomplished in 3 easy steps. There are on 4 Functions in EzSkin and it is made for personal use. XSkin has many more features available, however you should have some basic understanding about scripting and knowledge of Autoit. You may create personal, profitable, and commercial use programs. I would believe that if this question was needed to be asked, you should use EzSkin. 8)
    1 point
×
×
  • Create New...