Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/21/2019 in all areas

  1. I'd like to start by saying that I've experienced pretty much everything that has been mentioned in this thread - quarantined exes for completely innocuous code, compiled exes flagged as infected months or years after they've been sitting idle in an archive folder, the same script being flagged intermittently each time I compile it, you name it. I knew that would be unacceptable if we released our product in that condition so I researched for many days (probably weeks) before our initial release. This is the route we ended up choosing and I honestly couldn't be happier with the results. After we started signing all of our executables using a reputable code signing cert we no longer get flagged by Windows Defender - even using UPX with maximum compression. We've had rare issues with other AV providers but they've been so rare (easily less than 10 total over the past 18 months) it's really been a non-issue. If you already have a corporation setup I highly recommend doing this sooner rather than later. To be upfront, it does have a cost - both in time (generally 1-4 weeks from application to receiving your cert) and money (<$100/year) - but user trust and peace of mind are (very nearly) priceless. Once you have the code signing cert downloaded and installed you can simply add a line to the top of your script to have SciTE automatically sign your newly compiled exe as the final step in the compile process. Something like this: #AutoIt3Wrapper_Run_After=""%ProgramFiles(x86)%\Windows Kits\....\signtool.exe" sign /tr http://timestamp.comodoca.com/?td=sha384 /td SHA384 /a "%out%"" Also, if you have concerns about Windows Defender being reliable and accurate AV software you can let those concerns go. While it's true Windows Defender has had issues in the past, they were in the beginning of Microsoft's attempts at AV and things have improved significantly since then. If you want to check it out for yourself you can Google it or go here: https://www.techspot.com/news/81396-windows-defender-ranked-joint-best-antivirus-program.html (Fyi, up until about 5 years ago I'd been in IT for >20 years doing anywhere from tech support to Windows/Network Admin. In other words, basically dealing with viruses/rootkits/malware/ransomware on a daily basis because of users or customers lacking the wherewithal to not click the link in the email from an unknown source claiming their inheritance is waiting. 🤦‍♂️) Edit: Btw, in case anyone does want to go this route I can recommend https://www.thesslstore.com/. I'm not affiliated with them in any way except for that's where I purchased our cert from and I can attest that we received it and it works exactly as I've described. We went with the standard Comodo Code Signing cert. The EV certs are more expensive because they require more background evaluation to be done to verify the entity applying for the cert. It may be advantageous in particular circumstances but isn't necessary to simply avoid AV quarantine. Also, the other unmentioned advantage is your exes are now digitally signed. While for most customers this won't make a difference, if you're using your scripts in a corporate environment this may be a major peace-of-mind bonus since it's easy to verify the authenticity of your exes and they have certain assurances the exes haven't been tampered with. 👍
    2 points
  2. water

    Task Scheduler

    Version 1.6.0.1

    2,275 downloads

    Extensive library to control and manipulate Microsoft Task Scheduler Service. Please check this site for the implementation status! Please check the History.txt file in the archive for the changelog. Please check the WIKI for details about how to use the UDF. BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2021-02-03) None Things to come (last changed: 2021-02-03) None
    1 point
  3. 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
  4. As a follow-up to my question about "save password" balloon in ChromeDriver, I figured out how to disable it. Please refer to my current configuration of $sDesiredCapabilities below: $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _ '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _ '"prefs": {"credentials_enable_service": false}, "args": ["start-maximized"] }}}}'
    1 point
  5. I had my work create a signing cert which I sign all my code with. I have a batch set up that is run after the compilation to do the signing. The cert is recognized by the AV and that way I don't have to whitelist each exe. I do a lot of revisions and complies to test things so whitlisting hashes is a hassle. Also some remote devices don't update as they should so this eliminates that issue as well.
    1 point
  6. FileCreateShortcut(@ScriptFullPath, @StartupDir &"\Script.lnk") You can also use @StartupCommonDir......but in win7 or win8 @StartupDir is best because no need to run as Administrator...... Copy and past this line in your Script.....or put in to any au3 file code that you want run at windows startup {Every time you start your operating system this will automatically run your specific file}...........Tested in win7......
    1 point
  7. If you set the GUI background colour with GUISetBkColor() and happen to forget the colour you set it as, then why not try GUIGetBkColor() Function: #include-once #include <WinAPIGdi.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIGetBkColor ; Description ...: Retrieves the RGB value of the GUI background. ; Syntax ........: GUIGetBkColor($hWnd) ; Parameters ....: $hWnd - A handle of the GUI. ; Return values .: Success - RGB value ; Failure - 0 ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func GUIGetBkColor($hWnd) Local $iColor = 0 If IsHWnd($hWnd) Then Local $hDC = _WinAPI_GetDC($hWnd) $iColor = _WinAPI_GetBkColor($hDC) _WinAPI_ReleaseDC($hWnd, $hDC) EndIf Return $iColor EndFunc ;==>GUIGetBkColor Example use of Function: #include <MsgBoxConstants.au3> #include 'GUIGetBkColor.au3' Example() Func Example() Local $hGUI = GUICreate('GUIGetBkColor() Example', 500, 350) GUISetState(@SW_SHOW, $hGUI) Local $aColor = [0x0000FF, 0x8FFF9F, 0xEC4841, 0xB0E35D, 0x440BFD] ; Random colour array. Local $iColor = 0 For $i = 0 To UBound($aColor) - 1 GUISetBkColor($aColor[$i]) Sleep(20) $iColor = GUIGetBkColor($hGUI) ; Pass the GUI handle to the function. MsgBox($MB_SYSTEMMODAL, '', 'Background Color: ' & _ConvertToHexFormat($aColor[$i]) & @CRLF & _ 'GUIGetBkColor() Hex Format: ' & _ConvertToHexFormat($iColor) & @CRLF & _ 'GUIGetBkColor() Returned: ' & $iColor, 0, $hGUI) Next GUIDelete($hGUI) EndFunc ;==>Example Func _ConvertToHexFormat($iColor) Return Hex($iColor, 6) EndFunc ;==>_ConvertToHexFormat
    1 point
  8. orbs

    Power

    the simplest way - although probably will not be acceptable by your professor - is to dedicate a global var to accumulate the steps. I made the following changes to your code: declare global var $s the func returns the computed value, not the string. the func calculates it into $r before return, because $r is processed before return if you want the func to return the string, without using any global var, then you will need to pass it as a 3rd parameter and perform some string manipulation. PS how about some validation routines? your func fails with negative exponent! Global $s='' $x = InputBox("Power", "Base:") $y = InputBox("Power", "Exponent:") MsgBox(0, 'pow', powRecS($x, $y)) MsgBox(0, '$s', $s) Func powRecS($x, $y) Local $r If $y == 0 Then $r=1 ElseIf $y == 1 Then $r=$x Else $r=$x * powRecS($x, $y - 1) EndIf $s=$s&' p'&$y&' : '&$r&@CR Return $r EndFunc
    1 point
×
×
  • Create New...