Leaderboard
Popular Content
Showing content with the highest reputation on 06/16/2019 in all areas
-
Prevent auto reboot when a user is logged in.
coffeeturtle reacted to Exit for a topic
Yes, it caught me again tonight. While a VHS tape has been copied to the hard disk, after 3.5 hours (30 minutes before the end) Windows has automatically rebooted after an update. That although activity was present. Thanks Micro scrap. Now I've created this script so it never happens again. Maybe it will help you too. Thanks to @argumentum for this new version. ; Switch off AutoReboot after Windows update ; Author: Exit ( http://www.autoitscript.com/forum/user/45639-exit ) ; Windows Registry Editor Version 5.00 ; [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] ; "NoAutoRebootWithLoggedOnUsers"=dword:00000001 #RequireAdmin ; otherwise error 1 Local Const $sRegkeyname = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" Local Const $sRegValuename = "NoAutoRebootWithLoggedOnUsers" Local $iAutoReboot = RegRead($sRegkeyname, $sRegValuename) Switch @error Case 0 Case 1, 2, -1 $iAutoReboot = 0 Case Else Exit MsgBox(64 + 262144, Default, "Error " & @error & " reading registry.", 0) EndSwitch If $iAutoReboot = 1 Then MsgBox(64 + 262144, Default, $sRegValuename & " switch was already ON." & @LF & @LF & "No further action required.", 0) Else Local $rc = RegWrite($sRegkeyname, $sRegValuename, "REG_DWORD", 1) If @error Then Exit MsgBox(64 + 262144, Default, "Error " & @error & " writing registry." & @LF & @LF & "#RequireAdmin missing?", 0) MsgBox(64 + 262144, Default, "NoAutoRebootWithLoggedOnUsers switch set ON." & @LF & @LF & "No AutoReboot will occour while you are logged on.", 0) EndIf Previous code in Spoiler.1 point -
[Solved] RegExp path
TheXman reacted to argumentum for a topic
..and that answers it all !. ( the Semper volens auxilium is true ) Again, thanks @TheXman1 point -
[Solved] RegExp path
argumentum reacted to TheXman for a topic
You're welcome! Here's a little quick & dirty implementation of one way to pass multiple patterns. Basically, I created it so that you separate multiple patterns with "|". So you can have as many as you'd like. Also, as you can see, I didn't add any error checking, which it certainly would need. #include <Constants.au3> #include <Array.au3> ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp\~TEST~\", "C:\Users\*\AppData\Local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp\~TEST~\", "C:\users\*\appdata\*\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp2\~TEST~\", "C:\users\*\appdata\local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("c:\users\mary\appdata\local\temp\~test~\", "C:\Users\*\AppData\Local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\abc\def\ghi\Local\Temp\~TEST~\", "C:\users\*\appdata\*\Temp\|C:\abc\*\ghi\") & @CRLF) ;Multiple patterns Func _IsThisInThePath($sPath, $sPattern) Local $bPathFound = False Local $aPatterns Local $sRegex ; Split multiple patterns into an array of patterns and ; spin thru patterns to see if any match. $aPatterns = StringSplit($sPattern, "|") For $i = 1 To $aPatterns[0] $sRegex = $aPatterns[$i] $sRegex = "(?i)" & $sRegex $sRegex = StringReplace($sRegex, "\", "\\") $sRegex = StringReplace($sRegex, "*", "[^\\]+") If StringRegExp($sPath, $sRegex) Then $bPathFound = True Next Return $bPathFound EndFunc Or my previous function would work too since the "|" character is the regex way of having multiple patterns. #include <Constants.au3> #include <Array.au3> ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp\~TEST~\", "C:\Users\*\AppData\Local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp\~TEST~\", "C:\users\*\appdata\*\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp2\~TEST~\", "C:\users\*\appdata\local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("c:\users\mary\appdata\local\temp\~test~\", "C:\Users\*\AppData\Local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\abc\def\ghi\Local\Temp\~TEST~\", "C:\users\*\appdata\*\Temp\|C:\abc\*\ghi\") & @CRLF) ;Multiple patterns Func _IsThisInThePath($sPath, $sPattern) ; Convert plain text pattern to regular expression $sPattern = "(?i)" & $sPattern $sPattern = StringReplace($sPattern, "\", "\\") $sPattern = StringReplace($sPattern, "*", "[^\\]+") Return StringRegExp($sPath, $sPattern) EndFunc1 point -
[Solved] RegExp path
argumentum reacted to TheXman for a topic
Yes, the possibilities are endless. It just depends on your imagination and ability to implement it.1 point -
[Solved] RegExp path
argumentum reacted to TheXman for a topic
So something like this maybe? #include <Constants.au3> #include <Array.au3> ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp\~TEST~\", "C:\Users\*\AppData\Local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("C:\Users\Other\AppData\Local\Temp2\~TEST~\", "C:\users\*\appdata\local\Temp\") & @CRLF) ConsoleWrite(_IsThisInThePath("c:\users\mary\appdata\local\temp\~test~\", "C:\Users\*\AppData\Local\Temp\") & @CRLF) Func _IsThisInThePath($sPath, $sPattern) ; Convert plain text pattern to regular expression $sPattern = "(?i)" & $sPattern $sPattern = StringReplace($sPattern, "\", "\\") $sPattern = StringReplace($sPattern, "*", "[^\\]+") Return StringRegExp($sPath, $sPattern) EndFunc1 point -
Prevent auto reboot when a user is logged in.
argumentum reacted to Exit for a topic
The work is done. See changes in the first post.1 point -
Prevent auto reboot when a user is logged in.
argumentum reacted to Exit for a topic
@argumentum Good catch! Mending will follow soon.1 point -
1 point
-
[Solved] _WinAPI_GetFileInformationByHandle() of a folder
argumentum reacted to Nine for a topic
Same but you need to use this for folder : Local $hFile = _WinAPI_CreateFileEx("C:\Apps\Temp\",$OPEN_EXISTING,$GENERIC_READ,Default,$FILE_ATTRIBUTE_NORMAL+$FILE_FLAG_BACKUP_SEMANTICS) ps. _WinAPI_GetFileInformationByHandle() is not returning a unique ID, but an array of attributes...1 point -
Hide / Minimize installation
Earthshine reacted to Jos for a topic
Use the Silent installer which seems to be available? Jos1 point -
Filter file name with StringRegExp?
youtuber reacted to FrancescoDiMuro for a topic
@youtuber The patterns are a little bit messy. Try to use something like these ones: '^jre\-.+i\d{3}\.exe$' ; x86 '^jre\-.+x64.exe$' ; x641 point -
If you look at scite console, you can see that the _IEAttach gives a warning Hence, SetError is returned, not the object. But if you add a small delay before it will work. #Include <IE.au3> $oIE = _IECreatePrivate("http://www.autoitscript.com") If @error Then MsgBox ($MB_SYSTEMMODAL,"","Error") Func _IECreatePrivate($sUrl = "about:blank", $iWait = 1) Local $sPFDir = (StringInStr(@OSArch, "64") AND Not @AutoItX64) ? RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") : @ProgramFilesDir ShellExecute ($sPFDir & "\Internet Explorer\iexplore.exe", "-noframemerging -private " & $sUrl, @ProgramFilesDir & "\Internet Explorer") Local $hPrivateIE = WinWaitActive("[REGEXPTITLE:.+\[InPrivate\]]", "", 10) If Not $hPrivateIE Then Return SetError(1, 0, 0) Sleep (1000) Local $oPrivateIE = _IEAttach($hPrivateIE, "hwnd") If @error Then Return SetError(2, 0, 0) If $iWait Then _IELoadWait($oPrivateIE) Return $oPrivateIE EndFunc You should know by now that checking for @error is always a good practice.1 point
-
The problem with the script is that sometimes URL is changed while loaded. So if you search for the original URL it may not exist as is, but it is still loaded under a different URL. So try this, it is working well for me : #include <IE.au3> Local $sURL = "https://www.autoitscript.com/" $oIE = _IECreate($sURL) $sURL = _IEPropertyGet($oIE, "locationurl") ; make sure you got the right URL ;~ Begin Adding Example Tabs $oIE.Navigate("https://www.google.com", 0x0800) $oIE.Navigate("https://www.youtube.com", 0x0800) Sleep(5000) ;~ End Adding Example Tabs Local $i = 1, $oIETab While 1 $oIETab = _IEAttach("", "instance", $i) If @error = $_IEStatus_NoMatch Then ExitLoop If _IEPropertyGet($oIETab, "locationurl") <> $sURL Then _IEQuit($oIETab) Sleep (500) ContinueLoop EndIf $i += 1 WEnd ps. I added some sleep after _IEQuit to give time to the script to close tab.1 point
-
$GUI_SS_DEFAULT_INPUT
pixelsearch reacted to Melba23 for a topic
saywell, The $GUI_SS_DEFAULT_* styles are AutoIt shorthand for the default/forced styles used whan you create an AutoIt control without specifying any particular style. If you look in the Help file under <Appendix - GUI Control Styles> you can see which controls have such a "shorthand" style - the actual default/forced styles are listed on the various GUICtrlCreate* pages. They come in handy when you want to use additional styles with the default ones. As explained in the Setting Styles tutorial in the Wiki, if you set a particular style you overwrite all existing ones - using this "shorthand" style allows you to add a new style and retain the default/forced styles more easily. All clear? M231 point