
ffdshow
Active Members-
Posts
113 -
Joined
-
Last visited
Everything posted by ffdshow
-
I use the next code to rename rar volumes named like this:XvQG7zdAUbWju9NL6BDY.part01.rar,XvQG7zdAUbWju9NL6BDY.part02.rar... to something like this: DWhMwdmEk5Csk6ob5IUR.part01.rar, DWhMwdmEk5Csk6ob5IUR.part02.rar... Also, a md5 file present in the source folder will be renamed and I will attach another script to this one, to change filenames inside it. #Include <File.au3> #Include <Array.au3> $Source_Path = "D:\1" $Destination_Path = "D:\1\_Renamed" $Characters_To_Delete = "XvQG7zdAUbWju9NL6BDY" $Characters_To_Write = "DWhMwdmEk5Csk6ob5IUR" $FileList = _FileListToArray($Source_Path, $Characters_To_Delete & "*.*", 1) For $i = 1 To $FileList[0] $Name = StringTrimLeft($FileList[$i],20) ; trim the first 20 characters from the left side of the file name FileMove($Source_Path & "\" & $FileList[$i], $Destination_Path & "\" & $Characters_To_Write & $Name, 1) NextIt's possible to rename those files without use of StringTrimLeft command and how to? Thanks!
-
Replace string in registry value
ffdshow replied to ffdshow's topic in AutoIt General Help and Support
Thanks! The script should look like this: $string = RegRead("HKEY_CURRENT_USER\Software\TechSmith\Camtasia Studio\8.0\Camtasia Recorder\8.0", "RecorderConfig") $replace = "NO_MIC" $new_string = StringRegExpReplace($string, '(?<=<deviceId>)([^<]+)', $replace) RegWrite("HKEY_CURRENT_USER\Software\TechSmith\Camtasia Studio\8.0\Camtasia Recorder\8.0", "RecorderConfig", "REG_SZ", $new_string) -
Hi, I have a large registry value that contain the next string: <audioSettings><deviceId>Realtek Digital Input (Realtek </deviceId> The string "Realtek Digital Input (Realtek" can be "Microphone (SB Audigy)" or else. I want to change "Realtek Digital Input (Realtek" or whatever is between <audioSettings><deviceId> and </deviceId> with "NO_MIC", to look finally like this: <audioSettings><deviceId>NO_MIC</deviceId> How should look the StringRegExpReplace command?
-
A simple script like the next one can delete duplicate lines from files: #include<Array.au3> #include<File.au3> $InputFile = "C:\Test.txt" Local $aFile, $aArray _FileReadToArray($InputFile, $aFile) $aArray = _ArrayUnique($aFile, 1, 1) _FileWriteFromArray($InputFile, $aArray, 1) How can I preserve, for example the duplicate empty lines and the duplicate lines that contain a string like %16422% ?
-
Nice. Thanks in advance!
-
I found this: , but I don't want another program running in system tray.
-
No.
-
Thanks for answer, but I don't know how to use it. I have found another script which set the desktop wallpaper. It's possible to modify the code to work with multiple images from a folder? Here is that script: _ChangeWallpaper("C:\Windows\Web\Wallpaper\Custom\499.jpg",2) ; .bmp file path that you want to set as wallpaper (for other file ; type change 'bmp' below inside the function) Func _ChangeWallpaper($sFile,$iType) ; Changes the wallpaper to $sFilename using $iType as: ; 1 Tiled ; 2 Centered ; 3 Stretched ; any other value (usually 0) unchanged ; ; Returns ; 0 if everything is allright. ; -1 if $sFile does not exist. @error is set to 1 ; -2 if ŁsFile is not a .bmp file. @error is set to 2 If Not FileExists($sFile) Then SetError(1) Return -1 EndIf If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'jpg' Then SetError(2) Return -2 EndIf Select Case $iType = 1 RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1') RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0') Case $iType = 2 RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0') RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0') Case $iType = 3 RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0') RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2') Case Else EndSelect RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile) DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0) Return 0 EndFunc Thanks!
-
Hello, If I set desktop background to C:WindowsWebWallpaperCustom, which contain jpg files and the time for picture changing to 5 min, I got the next registry modifications: RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\", "TranscodedImageCache", "REG_BINARY", "0x7ac301003b7f070040060000b00400000089fa9941a0c70143003a005c00570069006e0064006f00770073005c005700650062005c00570061006c006c00700061007000650072005c0043007500730074006f006d005c003400390039002e006a00700067000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\", "TranscodedImageCache_000", "REG_BINARY", "0x7ac301003b7f070040060000b00400000089fa9941a0c70143003a005c00570069006e0064006f00770073005c005700650062005c00570061006c006c00700061007000650072005c0043007500730074006f006d005c003400390039002e006a0070006700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005c005c003f005c0044004900530050004c00410059002300470053004d003400340033004300230034002600320032006300320036003500380065002600300026005500490044003100360038003400330030003000380023007b00650036006600300037006200350066002d0065006500390037002d0034006100390030002d0062003000370036002d003300330066003500370062006600340065006100610037007d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") RegWrite("HKEY_CURRENT_USER\Control Panel\Personalization\Desktop Slideshow\", "LastTickLow", "REG_DWORD", 833732269) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\Grid\", "DesktopTileCachedData", "REG_BINARY", "0x0000000000000000f800000078000000e8be98987f34cf0143003a005c00550073006500720073005c0050006f00770065007200200055007300650072005c0041007000700044006100740061005c0052006f0061006d0069006e0067005c004d006900630072006f0073006f00660074005c00570069006e0064006f00770073005c005400680065006d00650073005c005400720061006e00730063006f00640065006400570061006c006c0070006100700065007200000019254768313421689e7b19b8a4576028cc0101f9ffff000000000000000000000000000000007801000031d50b0000000000c901000098a97e0001f9ffff50a87e0001f9ffff50a87e0001f9ffff20a87e0001f9ffff101d360060f9ffff7801000009000000000000000000000046020000ca0000000000000000000080000000000000000002000000000000001b000000000000004602000002000000000000001b0000001c000000000000000a0000001c0000006e0000000e0000007b0000007f000000ec000000f00000005d01000061010000ce010000d20100003f0200000a000000000000006e0000006f000000000000000a0000006f000000c10000000e0000007b0000007f000000ec000000f00000005d01000061010000ce010000d20100003f0200000a00000000000000c1000000c2000000000000000a000000c2000000ca0000000e0000007b0000007f000000ec000000f00000005d01000061010000") The problem is that using the above code, will not apply the tweaks. I guess SystemParametersInfo must be updated, but how ?
-
$InstallDir = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\flightsimulator", "InstallLocation") If FileExists($InstallDir & "\flightsimulator.exe") Then Run($InstallDir & "\flightsimulator.exe") EndIf Or: $InstallDir = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\flightsimulator", "InstallLocation") If FileExists($InstallDir & "\flightsimulator.exe") Then MsgBox(0x40010, @ScriptName, "flightsimulator is already installed", 4) Exit EndIf
-
Possible solution: extract the msi file with Universal Extractor or with /a switch, then go here and read about how to sign your unsigned driver. After your driver is signed, repack the msi with InstallShield (which is not easy) or make an exe installer with Inno Setup.
-
#include <Constants.au3> $DOS = Run(@ComSpec & " /c dism /Get-WimInfo /WimFile:F:\Windows 7\sources\boot.wim", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS, 2) $Output = StdoutRead($DOS) If StringInStr($Output, "Microsoft Windows Setup (x86)") Then ; dism command here for injecting 32-bit drivers in a 32-bit boot.wim ElseIf StringInStr($Output, "Microsoft Windows Setup (x64)") Then ; dism command here for injecting 64-bit drivers in a 64-bit boot.wim EndIf
-
Hello, I want to inject some drivers into boot.wim from two versions of Windows 7 sources. In the script, I want to check if boot.wim is 32-bit or 64-bit. This can be done with a command like this: dism /Get-WimInfo /WimFile:F:Windows7sourcesboot.wim The output looks like this: Deployment Image Servicing and Management tool Version: 6.1.7601.17514 Details for image : F:\Windows7\sources\boot.wim Index : 1 Name : Microsoft Windows PE (x64) Description : Microsoft Windows PE (x64) Size : 1.187.717.206 bytes Index : 2 Name : Microsoft Windows Setup (x64) Description : Microsoft Windows Setup (x64) Size : 1.264.587.270 bytes The operation completed successfully. I guess I should use StdoutRead command, but how ?
-
Convert Vbscript to set visual effects to AutoIt syntax
ffdshow replied to ffdshow's topic in AutoIt General Help and Support
Sorry, I didn't verified your script, just choosed the tweaks from variables and run. This line (which is the most important) from your script was the problem: RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting", 3) The working script is this: ; 1:1 converted from http://gallery.technet.microsoft.com/scriptcenter/Vbscript-to-set-visual-cd211be9 by UEZ 2013 ; =============== VISUAL EFFECTS =============== $A = "0" ; Animate controls and elements inside windows $B = "0" ; Fade or slide menu;s into view $C = "0" ; Fade or slide ToolTips into view $D = "0" ; Fade out menu items after clicking $E = "0" ; Show shadows under mouse pointer $F = "0" ; Show shadows under windows $G = "0" ; Slide open combo boxes $H = "0" ; Smooth-scroll list boxes $I = "1" ; Use visual styles on windows and buttons $J = "1" ; Show window contents while dragging $K = "1" ; Smooth edges of screen fonts $L = "0" ; Animate windows when minimizing and maximizing $M = "1" ; Show translucent selection rectangle $N = "1" ; Use drop shadows for icon labels on the desktop $O = "0" ; Animations in the taskbar and Start Menu $P = "0" ; Show thumbnails instead of icons $Q = "1" ; Enable desktop composition $R = "0" ; Enable transparent glass $S = "0" ; Enable Aero Peek $T = "0" ; Save taskbar thumbnail previews ; ============================================== Global $UPM_a[8], $UPM_b[8], $i, $bBin Global $UPM_a0[8] = ["1","0","0","1", $H , $G , $B ,"0"] Global $UPM_a1[8] = ["0","0", $E ,"1", $C , $D ,"1","0"] Global $UPM_a2[8] = ["0","0","0","0","0", $F , $I ,"1"] Global $UPM_a3[8] = ["1","0","0","0","0","0","0","0"] Global $UPM_a4[8] = ["0","0","0","1","0","0", $A ,"0"] Global $UPM_a5[8] = ["0","0","0","0","0","0","0","0"] Global $UPM_a6[8] = ["0","0","0","0","0","0","0","0"] Global $UPM_a7[8] = ["0","0","0","0","0","0","0","0"] For $i = 0 To UBound($UPM_a) - 1 $UPM_a[$i] = Execute("$UPM_a" & $i) Next For $i = 0 To UBound($UPM_a) - 1 $UPM_b[$i] = String(BinToDec($UPM_a[$i])) $bBin &= Hex($UPM_b[$i], 2) Next RegWrite("HKCU\Control Panel\Desktop", "UserPreferencesMask", "REG_BINARY", Binary("0x" & $bBin)) RegWrite("HKCU\Control Panel\Desktop", "DragFullWindows", "REG_SZ", IIf($J = "1", "1", "0")) RegWrite("HKCU\Control Panel\Desktop", "FontSmoothing", "REG_SZ", IIf($K = "1", "2", "0")) RegWrite("HKCU\Control Panel\Desktop\WindowMetrics", "MinAnimate", "REG_SZ", IIf($L = "1", "1", "0")) RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewAlphaSelect", "REG_DWORD", IIf($M = "1", 1, 0)) RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewShadow", "REG_DWORD", IIf($N = "1", 1, 0)) RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAnimations", "REG_DWORD", IIf($O = "1", 1, 0)) RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "IconsOnly", "REG_DWORD", IIf($P = "1", 0, 1)) RegWrite("HKCU\Software\Microsoft\Windows\DWM", "Composition", "REG_DWORD", IIf($Q = "1", 1, 0)) RegWrite("HKCU\Software\Microsoft\Windows\DWM", "CompositionPolicy", "REG_DWORD", IIf($Q = "1", 2, 0)) RegWrite("HKCU\Software\Microsoft\Windows\DWM", "ColorizationOpaqueBlend", "REG_DWORD", IIf($R = "1", 0, 1)) RegWrite("HKCU\Software\Microsoft\Windows\DWM", "EnableAeroPeek", "REG_DWORD", IIf($S = "1", 1, 0)) RegWrite("HKCU\Software\Microsoft\Windows\DWM", "AlwaysHibernateThumbnails", "REG_DWORD", IIf($T = "1", 1, 0)) RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting", "REG_DWORD", 3) Func BinToDec($arrBin) Local $r = "0", $i, $iUB = UBound($arrBin) - 1 For $i = $iUB To 0 Step - 1 If $arrBin[$i] = "1" Then $r += 2 ^ ($iUB - $i) Next Return $r EndFunc Func IIf($Expression, $TruePart, $FalsePart) If $Expression Then Return $TruePart Return $FalsePart EndFunc Thanks! -
Convert Vbscript to set visual effects to AutoIt syntax
ffdshow replied to ffdshow's topic in AutoIt General Help and Support
Thanks, but doesn't work (tweaks are not applied). -
Hello, I found the next vbscript which allows you to set all of Windows' visual effects as though the ' sysdm.cpl applet. I used VBScript to AutoIt Converter v0.4 for conversion to AutoIt syntax, but I got several errors on AutoIt script execution. Maybe someone can fix it. The VBScript works fine, some tweaks need Windows logoff or computer restart so can be applied. VBScript source ' =============== VISUAL EFFECTS =============== A = "0" ' Animate controls and elements inside windows B = "0" ' Fade or slide menu's into view C = "0" ' Fade or slide ToolTips into view D = "0" ' Fade out menu items after clicking E = "0" ' Show shadows under mouse pointer F = "0" ' Show shadows under windows G = "0" ' Slide open combo boxes H = "0" ' Smooth-scroll list boxes I = "1" ' Use visual styles on windows and buttons J = "1" ' Show window contents while dragging K = "1" ' Smooth edges of screen fonts L = "0" ' Animate windows when minimizing and maximizing M = "1" ' Show translucent selection rectangle N = "1" ' Use drop shadows for icon labels on the desktop O = "0" ' Animations in the taskbar and Start Menu P = "0" ' Show thumbnails instead of icons Q = "1" ' Enable desktop composition R = "0" ' Enable transparent glass S = "0" ' Enable Aero Peek T = "0" ' Save taskbar thumbnail previews ' ============================================== UPM_a = Array(_ Array("1","0","0","1", H , G , B ,"0"),_ Array("0","0", E ,"1", C , D ,"1","0"),_ Array("0","0","0","0","0", F , I ,"1"),_ Array("1","0","0","0","0","0","0","0"),_ Array("0","0","0","1","0","0", A ,"0"),_ Array("0","0","0","0","0","0","0","0"),_ Array("0","0","0","0","0","0","0","0"),_ Array("0","0","0","0","0","0","0","0")_ ) UPM_b = Array(Empty, Empty, Empty, Empty, Empty, Empty, Empty, Empty) Dim i For i = 0 To UBound(UPM_a) UPM_b(i) = CStr(BinToDec(UPM_a(i))) Next Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") objReg.SetBinaryValue &H80000001, "Control Panel\Desktop", "UserPreferencesMask", UPM_b objReg.SetStringValue &H80000001, "Control Panel\Desktop", "DragFullWindows", IIf(J = "1", "1", "0") objReg.SetStringValue &H80000001, "Control Panel\Desktop", "FontSmoothing", IIf(K = "1", "2", "0") objReg.SetStringValue &H80000001, "Control Panel\Desktop\WindowMetrics", "MinAnimate", IIf(L = "1", "1", "0") objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewAlphaSelect", IIf(M = "1", 1, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ListviewShadow", IIf(N = "1", 1, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarAnimations", IIf(O = "1", 1, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "IconsOnly", IIf(P = "1", 0, 1) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "Composition", IIf(Q = "1", 1, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "CompositionPolicy", IIf(Q = "1", 2, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "ColorizationOpaqueBlend", IIf(R = "1", 0, 1) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "EnableAeroPeek", IIf(S = "1", 1, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\DWM", "AlwaysHibernateThumbnails", IIf(T = "1", 1, 0) objReg.SetDWORDValue &H80000001, "Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting", 3 Function BinToDec(arrBin()) Dim r, i r = 0 For i = UBound(arrBin) To 0 Step -1 If arrBin(i) = "1" Then r = r + (2 ^ (UBound(arrBin) - i)) Next BinToDec = r End Function Function IIf(Expression, TruePart, FalsePart) If Expression = True Then If IsObject(TruePart) Then Set IIf = TruePart Else IIf = TruePart Else If IsObject(FalsePart) Then Set IIf = FalsePart Else IIf = FalsePart End If End Function Thanks!
-
Function _SR_RemoveAllRestorePoints() doesn't work in Windows 8. Edit: Sorry, I did a syntax error. It's working fine.
-
An example for registry which is similar with the example for file provided in the first post of this thread #include 'Permissions.au3' _InitiatePermissionResources() RegWrite('HKLM\SOFTWARE\Example') ; write a registry key Local $TI = TimerInit() Local $ret = _DenyAllAccess('HKLM\SOFTWARE\Example',$SE_REGISTRY_KEY,@UserName) Local $TD = TimerDiff($TI) MsgBox(0,'','Deny all access to HKLM\SOFTWARE\Example and take ownership:'&@CRLF&@CRLF& _ '_DenyAllAccesss return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() $ret = _GrantReadAccess('HKLM\SOFTWARE\Example',$SE_REGISTRY_KEY,'Administrators') $TD = TimerDiff($TI) MsgBox(0,'','Grant everyone read access, all access to admins and system, and set the owner: Admins group'&@CRLF&@CRLF& _ '_GrantReadAccesss return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() $ret = _GrantAllAccess('HKLM\SOFTWARE\Example') $TD = TimerDiff($TI) MsgBox(0,'','Grant everyone access'&@CRLF&@CRLF& _ '_GrantAllAccesss return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() $ret = _CopyFullDacl('HKLM\SOFTWARE\Example',$SE_REGISTRY_KEY,@ScriptDir) $TD = TimerDiff($TI) MsgBox(0,'','Restore all inherited permissions'&@CRLF&@CRLF& _ '_CopyFullDacl return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() Local $aPerm[2][3] = [['Restricted',1,$GENERIC_ALL],['Users',1,$GENERIC_ALL]] $ret = _EditObjectPermissions('HKLM\SOFTWARE\Example',$aPerm) $TD = TimerDiff($TI) MsgBox(0,'','Add two granted access aces: Restricted and Users'&@CRLF&@CRLF& _ '_EditObjectPermissions return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() Dim $aPerm[2][3] = [['Restricted',1,$GENERIC_READ],['Users',1,$GENERIC_READ]] $ret = _EditObjectPermissions('HKLM\SOFTWARE\Example',$aPerm) $TD = TimerDiff($TI) MsgBox(0,'','Give only read access to the Restricted and Users groups'&@CRLF&@CRLF& _ '_EditObjectPermissions return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() Dim $aPerm[2][3] = [['Restricted',0,$GENERIC_ALL],['Users',0,$GENERIC_ALL]] $ret = _EditObjectPermissions('HKLM\SOFTWARE\Example',$aPerm) $TD = TimerDiff($TI) MsgBox(0,'','Deny access to the Restricted and Users groups'&@CRLF&@CRLF& _ '_EditObjectPermissions return value: '&$ret&' Time: '&Round($TD,2)&' miliseconds.'&@CRLF& _ 'Check the registry key permissons before closing the message box.') $TI = TimerInit() Local $Hndl = _Permissions_OpenProcess(@AutoItPID) Local $SDBefore = _GetObjectStringSecurityDescriptor($Hndl,$SE_KERNEL_OBJECT) Local $CODRet = _ClearObjectDacl($Hndl,$SE_KERNEL_OBJECT) Local $DARet = _DenyAllAccess($Hndl,$SE_KERNEL_OBJECT) Local $SDAfter = _GetObjectStringSecurityDescriptor($Hndl,$SE_KERNEL_OBJECT) $TD = Round(TimerDiff($TI),2) MsgBox(0,'', 'Deny everyone access to the current process:'&@CRLF&@CRLF& _ '@AutoItPID original security descriptor: '&@CRLF&$SDBefore&@CRLF&@CRLF& _ '_ClearObjectDacl return value: '&$CODRet&@CRLF&@CRLF& _ '_DenyAllAccess_ return value: '&$DARet&@CRLF&@CRLF& _ 'New @AutoItPID security descriptor: '&@CRLF& _ $SDAfter&@CRLF&@CRLF& 'Time taken: '&$TD&' miliseconds.') _Permissions_CloseHandle($Hndl) RegDelete('HKLM\SOFTWARE\Example') _ClosePermissionResources() Set the owner of a registry key (the subkeys owner will not be changed) #include 'Permissions.au3' _InitiatePermissionResources() RegWrite('HKLM\SOFTWARE\Example') ; write a registry key ; Set the Administrators group as the owner of a registry key (the subkeys owner will not be changed) _SetObjectOwner('HKLM\SOFTWARE\Example', $SE_REGISTRY_KEY, 'Administrators') Grants Administrators access for the given object. Replace the owner with "Replace owner on subcontainers and objects" option checked. Grant Administrators full control permissions with "Replace all child object permissions with inheritable permissions from this object" option checked. Existed DACL will be preserved by using $ClearDacl = 0 in Return _SetObjectPermissions on the penultimate line of this script. #include 'Permissions.au3' _InitiatePermissionResources() RegWrite('HKLM\SOFTWARE\Example') ; write a registry key _GrantAdministratorsAccess_1('HKLM\SOFTWARE\Example', $SE_REGISTRY_KEY, 'Administrators', 1) ; #FUNCTION# ==================================================================================================================== ; Name...........: _GrantAdministratorsAccess_1 ; Description ...: Grants Administrators access for the given object ; Replace the owner with "Replace owner on subcontainers and objects" option checked ; Grant Administrators full control permissions with ; "Replace all child object permissions with inheritable permissions from this object" option checked ; Permissions will be added (existed DACL will be preserved by using $ClearDacl = 0 in Return _SetObjectPermissions ; on the penultimate line of this script) ; Syntax.........: _GrantAdministratorsAccess_1($oName, $_SE_OBJECT_TYPE, $SetOwner) ; Parameters ....: $oName - The name of the object. This can be a path to a file or folder, a registry key, a service name, etc ; +See the comments on the _SE_OBJECT_TYPE enum for more info ; $_SE_OBJECT_TYPE (optional) - The type of the object to set permissions. This must be one of the values of the ; +_SE_OBJECT_TYPE enum. The default is $SE_FILE_OBJECT (a file or folder). ; $SetOwner (optional) - The user name or SID to set as the owner of the object. Setting a blank string '' will ; +make no changes to the owner. The default is the administrators group ('Administrators') ; ; Return values .: Success - 1 ; Failure - 0 and sets @error ; Author ........: FredAI ; Modified.......: ; Remarks .......: ; Related .......: _DenyAllAccess, _GrantReadAccess, _GrantReadDenyWrite, _CopyFullDacl ; Link ..........: ; Example .......: _GrantAdministratorsAccess_1('C:\example.txt', $_SE_OBJECT_TYPE, @UserName) ; =============================================================================================================================== Func _GrantAdministratorsAccess_1($oName, $_SE_OBJECT_TYPE = $SE_FILE_OBJECT, $SetOwner = 'Administrators', $Recurse = 1) Local $aPerm[1][3] $aPerm[0][0] = 'Administrators' $aPerm[0][1] = 1 $aPerm[0][2] = $GENERIC_ALL Return _SetObjectPermissions($oName, $aPerm, $_SE_OBJECT_TYPE, $SetOwner, 0, $Recurse) EndFunc ;==>_GrantAdministratorsAccess_1 Grants Administrators access for the given object. "Replace the owner with "Replace owner on subcontainers and objects" option checked. Grant Administrators full control permissions with "Replace all child object permissions with inheritable permissions from this object" option checked. Existed DACL will be cleared by using $ClearDacl = 1 in Return _SetObjectPermissions on the penultimate line of this script. #include 'Permissions.au3' _InitiatePermissionResources() RegWrite('HKLM\SOFTWARE\Example') ; write a registry key _GrantAdministratorsAccess_2('HKLM\SOFTWARE\Example', $SE_REGISTRY_KEY, 'Administrators', 1) ; #FUNCTION# ==================================================================================================================== ; Name...........: _GrantAdministratorsAccess_2 ; Description ...: Grants Administrators access for the given object ; Replace the owner with "Replace owner on subcontainers and objects" option checked ; Grant Administrators full control permissions with ; "Replace all child object permissions with inheritable permissions from this object" option checked ; Permissions will be changed (existed DACL will be cleared by using $ClearDacl = 1 in Return _SetObjectPermissions ; on the penultimate line of this script) ; Syntax.........: _GrantAdministratorsAccess_2($oName, $_SE_OBJECT_TYPE, $SetOwner) ; Parameters ....: $oName - The name of the object. This can be a path to a file or folder, a registry key, a service name, etc ; +See the comments on the _SE_OBJECT_TYPE enum for more info ; $_SE_OBJECT_TYPE (optional) - The type of the object to set permissions. This must be one of the values of the ; +_SE_OBJECT_TYPE enum. The default is $SE_FILE_OBJECT (a file or folder). ; $SetOwner (optional) - The user name or SID to set as the owner of the object. Setting a blank string '' will ; +make no changes to the owner. The default is the administrators group ('Administrators') ; ; Return values .: Success - 1 ; Failure - 0 and sets @error ; Author ........: FredAI ; Modified.......: ; Remarks .......: ; Related .......: _DenyAllAccess, _GrantReadAccess, _GrantReadDenyWrite, _CopyFullDacl ; Link ..........: ; Example .......: _GrantAdministratorsAccess_2('C:\example.txt', $_SE_OBJECT_TYPE, @UserName) ; =============================================================================================================================== Func _GrantAdministratorsAccess_2($oName, $_SE_OBJECT_TYPE = $SE_FILE_OBJECT, $SetOwner = 'Administrators', $Recurse = 1) Local $aPerm[1][3] $aPerm[0][0] = 'Administrators' $aPerm[0][1] = 1 $aPerm[0][2] = $GENERIC_ALL Return _SetObjectPermissions($oName, $aPerm, $_SE_OBJECT_TYPE, $SetOwner, 1, $Recurse) EndFunc ;==>_GrantAdministratorsAccess_2
-
Thanks! Now it works. This will check "Taskbar and Start Menu Properties->Taskbar->Auto-hide the taskbar" option in Windows (if it's not already checked): Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MustDeclareVars", 1) _TaskbarHidden() Func _TaskbarHidden() ; 0 = Shown Or 1 = Hidden ; Check if the registry involved in this tweak exist Dim $StuckRects2 $StuckRects2 = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings") If @error Then ; Probably the registry key/value name does not exist, so we will import the default from Windows 8 RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", "REG_BINARY", "0x28000000ffffffff02000000030000003e0000002800000000000000d80200000004000000030000") ElseIf $StuckRects2 = "" Then ; The value data is blank and this will not set @error, so we will import the default from Windows 8 RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", "REG_BINARY", "0x28000000ffffffff02000000030000003e0000002800000000000000d80200000004000000030000") EndIf ; Check if the taskbar is set to Auto-hide or not Local Const $ABM_GETSTATE = 0x00000004 Local $aReturn $aReturn = DllCall('shell32.dll', 'uint', 'SHAppBarMessage', 'dword', $ABM_GETSTATE, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) EndIf If BitAND($aReturn[0], 0x01) = 0 Then ; If "Taskbar Properties->Taskbar->Auto-hide the taskbar" is unchecked Then ; Set the taskbar to Auto-hide Const $HKCU = 0x80000001 Dim $objReg $objReg = ObjGet("winmgmts:{impersonationLevel=impersonate}root\default:StdRegProv") Dim $objWMI $objWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}root\cimv2") ; Adjust the first bit of the taskbar settings Dim $arrVal[1] $objReg.GetBinaryValue($HKCU, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", $arrVal) $arrVal[8] = BitOR(BitAND($arrVal[8], 0x07), 0x01) $objReg.SetBinaryValue($HKCU, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", $arrVal) ; Restart Windows Explorer process (explorer.exe) so the settings to take effect RunWait('"' & @ComSpec & '"' & " /c " & 'taskkill /f /im ' & "explorer.exe", "", @SW_HIDE) RunWait('"' & @ComSpec & '"' & " /c " & 'start ' & @WindowsDir & "\explorer.exe", "", @SW_HIDE) Sleep(500) EndIf EndFunc ;==>_TaskbarHidden
-
Strange, but that reg value looks untouched after vb script was executed, but the setting is done (taskbar autohide).
-
OK, sorry for delay, but can you convert this entire code: Dim arrVal() objReg.GetBinaryValue HKCU, "SoftwareMicrosoftWindowsCurrentVersionExplorerStuckRects2", "Settings", arrVal arrVal(8) = (arrVal(8) AND &h07) OR &h01 objReg.SetBinaryValue HKCU, "SoftwareMicrosoftWindowsCurrentVersionExplorerStuckRects2", "Settings", arrVal
-
I have this script that auto-hide the taskbar and I want to convert it to AutoIt: Option Explicit Const HKCU = &H80000001 Dim objReg Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}root\default:StdRegProv") Dim objWMI Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}root\cimv2") ' Adjust the first bit of the taskbar settings Dim arrVal() objReg.GetBinaryValue HKCU, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", arrVal arrVal(8) = (arrVal(8) AND &h07) OR &h01 objReg.SetBinaryValue HKCU, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", arrVal ' Restart Explorer for the settings to take effect. Dim objProcess, colProcesses Set colProcesses = objWMI.ExecQuery("Select * from Win32_Process Where Name='explorer.exe'") For Each objProcess In colProcesses objProcess.Terminate() Next I have problems with BitAND and BitOR commands. The last part (close and restart explorer is simple).
-
How to find if a button is checked or not ?
ffdshow replied to ffdshow's topic in AutoIt General Help and Support
Thanks ! This will check that button if it's not already checked: Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("SendKeyDelay", 200) BlockInput(1) _TaskbarHidden() Func _TaskbarHidden() ; 0 = Shown Or 1 = Hidden Local Const $ABM_GETSTATE = 0x00000004 Local $aReturn $aReturn = DllCall('shell32.dll', 'uint', 'SHAppBarMessage', 'dword', $ABM_GETSTATE, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) EndIf If BitAND($aReturn[0], 0x01) = 0 Then ; If "Taskbar and Start Menu Properties->Taskbar->Auto-hide the taskbar" is unchecked Then Send( '^{ESC}' ) Send( '^{ESC}' ) Send("{APPSKEY}") Send("{UP}") Send("{ENTER}") Send("{DOWN}") Send("{SPACE}") Send("{TAB 9}") Send("{ENTER}") Send("{ENTER}") EndIf EndFunc ;==>_TaskbarHidden -
For example, in Windows 7 the option 'Auto-hide the taskbar'. I use this for check/uncheck the above option: Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("SendKeyDelay", 200) If @OSBuild >= 7600 Then BlockInput(1) _ToggleAutoHideTheTaskbarInWindows7() EndIf Func _ToggleAutoHideTheTaskbarInWindows7() Send( '^{ESC}' ) Send( '^{ESC}' ) Send("{APPSKEY}") Send("{UP}") Send("{ENTER}") Send("{DOWN}") Send("{SPACE}") Send("{TAB 9}") Send("{ENTER}") Send("{ENTER}") EndFunc It will be better first to find if that button is already checked or not. Regshot 2.0.1.70 unicode can't find registry entries changed when toggle between check/uncheck.