Valuater Posted December 29, 2008 Author Posted December 29, 2008 expandcollapse popup; Produces an array of pixel colours used in an image ; Author - Malkey ;========================================================= ; Produces an array of pixel colours used in an image that are below the colour 0x202020 (array[n][0]), ; Number of times that colour is used (array[n][1]), and, ; the percentage of the numer of times the colour is used over the total number of pixels in the image (array[n][2]). ; Array[0][0] contains the number of unique pixels used in the image below 0x202020 colour. ; Array[0][1] contains the total number of pixels used in the image below 0x202020 colour. ; Array[0][2] contains the percentage of the total number of pixels used in the image below 0x202020 colour. ;============================================================ #include <WinAPI.au3> #include <ScreenCapture.au3> #include <GDIPlus.au3> #include <Array.au3> Dim $pixels, $iTotalReplace Local $Path = FileOpenDialog("Choose Image File", @ScriptDir & "", "Images (*.gif;*.png;*.jpg;*.bmp)| All (*.*)") If $Path <> "" Then _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($Path) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $aSize = DllCall('gdi32.dll', 'int', 'GetBitmapBits', 'ptr', $hBmp, 'int', 0, 'ptr', 0) If $aSize[0] Then $tBits = DllStructCreate('byte[' & $aSize[0] & ']') DllCall('gdi32.dll', 'int', 'GetBitmapBits', 'ptr', $hBmp, 'int', $aSize[0], 'ptr', DllStructGetPtr($tBits)) $sHex = Hex(DllStructGetData($tBits, 1)) ; Selects all pixels below/less than 0x202020 $pixels = StringRegExp($sHex, "([01][0-9A-F][01][0-9A-F][01][0-9A-F])FF", 3) ; Selects all pixels below/less than 0x505050 (Can take a while) ;$pixels = StringRegExp($sHex, "([0-5][0-9A-F][0-5][0-9A-F][0-5][0-9A-F])FF", 3) $sHexReduced = _ArrayToString($pixels) & "|" Dim $pixels[1][3] While StringLen($sHexReduced) > 6 ReDim $pixels[UBound($pixels) + 1][3] $PixTemp = StringLeft($sHexReduced, 7) $sHexReduced = StringReplace($sHexReduced, $PixTemp, "", 0) $numreplacements = @extended $pixels[UBound($pixels) - 1][1] = $numreplacements $pixels[UBound($pixels) - 1][0] = StringTrimRight($PixTemp, 1) $pixels[UBound($pixels) - 1][2] = StringFormat("%1.4f%%", $numreplacements * 100 / ($height * $width)) $iTotalReplace += $numreplacements WEnd $pixels[0][0] = UBound($pixels) - 1 $pixels[0][1] = $iTotalReplace $pixels[0][2] = StringFormat("%1.4f%%", $iTotalReplace * 100 / ($height * $width)) EndIf _ArraySort($pixels, 0, 1, 0, 0) _ArrayDisplay($pixels,$Path) _WinAPI_DeleteObject($hBmp) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndIf 8)
Valuater Posted January 22, 2009 Author Posted January 22, 2009 (edited) ; Set the Desktop Background; Author - TheOnlyOne, Posted by Authenticityexpandcollapse popup_ChangeWallpaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp",1) ; only a simple cut & paste 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)) <> 'bmp' 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 EndFunc8) Edited March 5, 2009 by Valuater
James Posted March 4, 2009 Posted March 4, 2009 ;Animate Display *nice* additionThis gives weird effects when running it under the Aero theme, not sure about Vista in general. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Authenticity Posted March 5, 2009 Posted March 5, 2009 lol Valuater. And it's author should be me how? It's what TheOnlyOne came with and I really don't know where from... but thanks anyway.
Valuater Posted March 5, 2009 Author Posted March 5, 2009 @James. Try this.... There seems to be a problem with the window animation using the DLL Call This should work on Vista and all other OS too! (Autoit OS) expandcollapse popup; Demo #include <GUIConstants.au3> Dim $repeat = 0 $hwnd = GUICreate("XSkin Animate", 300, 300) While $repeat <= 8 $repeat += 1 _VistaWinAnimate($hwnd, $repeat, 0) Sleep(2000) _VistaWinAnimate($hwnd, $repeat, 1) Sleep(2000) WEnd Func _VistaWinAnimate($Xwnd, $Xstyle = 0, $Xstate = 0, $Xdistance = 100, $Xdelay = 10) ; $Xstate - 0 = Show, 1 = Hide, ; $Xstyle - 1=Fade, 2=L-Slide, 3=R-Slide, 4=T-Slide, 5=B-Slide, 6=TL-Diag-Slide, 7=BL-Diag-Slide, 8=TR-Diag-Slide, 9=BR-Diag-Slide ; Error checking... If Not WinExists($Xwnd) Then Return SetError(1, -1, "window does not exist") If Not $Xstate == 0 Or Not $Xstate == 1 Then Return SetError(2, -1, "State is not Show or Hide") If $Xstyle == 0 Or $Xstyle >= 10 Then Return SetError(3, -1, "Style is out-of-range") ; Find Window location and Centered... Local $XPos = WinGetPos($Xwnd), $X_Move = 0, $Y_Move = 0, $MoveIt = 0 $X_Start = $XPos[0] $Y_Start = $XPos[1] $X_Final = (@DesktopWidth / 2) - ($XPos[2] / 2) $Y_Final = (@DesktopHeight / 2) - ($XPos[3] / 2) If $Xstate == 0 Then ; to Show the GUI WinSetTrans($Xwnd, "", 0) GUISetState(@SW_SHOW, $Xwnd) $Xtrans = 255 / $Xdistance If $Xstyle = 2 Or $Xstyle = 6 Or $Xstyle = 7 Then $X_Move = 1 $X_Final = $X_Final - $Xdistance ElseIf $Xstyle = 3 Or $Xstyle = 8 Or $Xstyle = 9 Then $X_Move = -1 $X_Final = $X_Final + $Xdistance EndIf If $Xstyle = 4 Or $Xstyle = 6 Or $Xstyle = 8 Then $Y_Move = 2 $Y_Final = $Y_Final - ($Xdistance * 2) ElseIf $Xstyle = 5 Or $Xstyle = 7 Or $Xstyle = 9 Then $Y_Move = -2 $Y_Final = $Y_Final + ($Xdistance * 2) EndIf Else ; to hide the GUI $Xtrans = -1 * (255 / $Xdistance) $X_Final = $X_Start $Y_Final = $Y_Start If $Xstyle = 2 Or $Xstyle = 6 Or $Xstyle = 7 Then $X_Move = -1 If $Xstyle = 3 Or $Xstyle = 8 Or $Xstyle = 9 Then $X_Move = 1 If $Xstyle = 4 Or $Xstyle = 6 Or $Xstyle = 8 Then $Y_Move = -2 If $Xstyle = 5 Or $Xstyle = 7 Or $Xstyle = 9 Then $Y_Move = 2 EndIf If $Y_Move <> 0 Or $X_Move <> 0 Then $MoveIt = 1 WinMove($Xwnd, "", $X_Final, $Y_Final) For $x = 1 To $Xdistance $XPos = WinGetPos($Xwnd) WinSetTrans($Xwnd, "", $x * $Xtrans) If $MoveIt = 1 Then WinMove($Xwnd, "", $XPos[0] + $X_Move, $XPos[1] + $Y_Move) Sleep($Xdelay) Next If $Xstate = 1 Then GUISetState(@SW_HIDE, $Xwnd) EndFunc ;==>_VistaWinAnimate 8) Thanks Authenticity 8)
Achilles Posted March 5, 2009 Posted March 5, 2009 Taken from the function I had for _ChangeDesktopBackground()... Originally by PaulIA, modified by me to work with the standard GDI include. Func _ConvertImageToBMP($sFile) ; Convert JPG image to BMP image _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sFile) $sCLSID = _GDIPlus_EncodersGetCLSID("BMP") $sTemp = _Str_ChangeFileExt($sFile, ".bmp") _GDIPlus_ImageSaveToFile($hImage, $sTemp) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Achilles Posted March 5, 2009 Posted March 5, 2009 ; Set the Desktop Background ; Author - TheOnlyOne, Posted by Authenticity expandcollapse popup_ChangeWallpaper("c:\Documents and Settings\lo\Skrivebord\gaza.bmp",1) ; only a simple cut & paste 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)) <> 'bmp' 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 8)For the last part, I had been using this: Global Const $SPI_SETDESKWALLPAPER = 0x0014 Global Const $SPIF_UPDATEINIFILE = 0x0001 Global Const $SPIF_SENDCHANGE = 0x0002 ; Set wallpaper $tBuffer = DllStructCreate("char Text[" & StringLen($sTemp) + 1 & "]") DllStructSetData($tBuffer, "Text", $sTemp) _WinAPI_SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, DllStructGetPtr($tBuffer), BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))Does it make any difference from what you posted? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
GEOSoft Posted March 16, 2009 Posted March 16, 2009 Damn, I wish this thread would somehow achieve sticky status. I have to keep searching for it and that's starting to get annoying. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
GEOSoft Posted March 23, 2009 Posted March 23, 2009 (edited) Just found this one handy so I thought I would share it here. It returns the SID for the current user. ; $sUser = _Reg_GetSID() If $sUser Then MsgBox(0, "RESULTS", $sUser) Func _Reg_GetSID() Local $sKey = "HKU\", $sEntry, $iReg = 1, $sRegEx = "(?i)s-1-5-21-([\d|-]*)" While 1 $sEntry = RegEnumKey($sKey, $iReg) If @Error Then ExitLoop $iReg += 1 If NOT StringRegExp($sEntry, $sRegEx) Then ContinueLoop Local $aRegExp = StringRegExp($sEntry, $sRegEx, 1) Return $aRegExp[0] Wend Return False EndFunc;<==> _Reg_GetSID() ; Edited May 6, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Moderators SmOke_N Posted March 23, 2009 Moderators Posted March 23, 2009 (edited) Just found this one handy so I thought I would share it here. It returns the UID for the current user. ; $sUser = _Reg_GetUID() If $sUser Then MsgBox(0, "RESULTS", $sUser) Func _Reg_GetUID() Local $sKey = "HKU\", $sEntry, $iReg = 1, $sRegEx = "(?i)s-1-5-21-([\d|-]*)" While 1 $sEntry = RegEnumKey($sKey, $iReg) If @Error Then ExitLoop $iReg += 1 If NOT StringRegExp($sEntry, $sRegEx) Then ContinueLoop Local $aRegExp = StringRegExp($sEntry, $sRegEx, 1) Return $aRegExp[0] Wend Return False EndFunc;<==> _Reg_GetUID() ;Hmm, what UID is that supposed to be? Edit: SID is more like it: http://www.cygwin.com/cygwin-ug-net/ntsec.html Edited March 23, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
GEOSoft Posted March 23, 2009 Posted March 23, 2009 (edited) Hmm, what UID is that supposed to be?Edit:SID is more like it:http://www.cygwin.com/cygwin-ug-net/ntsec.htmlDo you always have to be right? Ingrained into your psyche? You're right. When I get a few minutes and if I am overwhelmed with desire then I'll edit the code.$Question = "Did it work?"If the answer is yes then I'm not too concerned at the moment. Edit: Besides, it was USER ID Edited March 23, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Valuater Posted April 21, 2009 Author Posted April 21, 2009 (edited) ; KillWindow ( That you know is going to show up) ; Author - Valuater Func KillWindow($title) Local $Script = 'WinWait("' & $title & '", "")' & @CRLF & 'WinKill("' & $title & '", "")' Local $file_loc = @ScriptDir & "\Killer.au3" FileDelete($file_loc) FileWrite($file_loc, $Script) If @Compiled = 1 Then $file_exe = FileGetShortName(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file_loc & '"') Run($file_exe) Else $file_au3 = FileGetShortName($file_loc) Run(@AutoItExe & " " & $file_au3, "", @SW_HIDE) EndIf EndFunc ;==>KillWindow 8) Edited April 21, 2009 by Valuater
Valuater Posted April 30, 2009 Author Posted April 30, 2009 (edited) ; Restricted keys in an input '[\\/:*?"<>\|]' ; Author A-Bunch-of-Us-Guys-as-a-Team ...lol GUICreate("Input Filter", 300, 30, -1, -1) Global $inTest = GUICtrlCreateInput("", 5, 5, 290) GUIRegisterMsg(0x0111, "_WM_COMMAND") GUISetState(@SW_SHOW) While GUIGetMsg() <> -3 WEnd GUIRegisterMsg(0x0111, "") Func _WM_COMMAND($hWnd, $iMsg) GUICtrlSetData($inTest, StringRegExpReplace(GUICtrlRead($inTest), '[\\/:*?"<>\|]', "")) EndFunc ;==>_WM_COMMAND 8) Edited May 1, 2009 by Valuater
GEOSoft Posted May 1, 2009 Posted May 1, 2009 (edited) I whipped versions of these up for someone in the forums. Now I've decided to turn them into actual UDFs complete with the headers. You can pass either function a block of text for example using ClipGet() or you can just pass it the full path\filename of a file that contains the text. Please pay attention to the parameters for _String_LineLength() I added some to make the function more versatile. expandcollapse popup; ;=============================================================================== ; Function Name: _String_LineLength() ; Description: Get longest or shortest lines in the text ; Syntax: ; Parameter(s): $sText - text or file to check ; $iLong - If set to -1 or default then it works with the longest line ; otherwise it uses the shortest line ; $iCount - If set to -1 or default then it returns the character count ; otherwise it returns the string ; $iArray - If NOT set to -1 or default then it returns an array where ; array[0] = the character count ; array[1] = the string ; Requirement(s): ; Return Value(s): - Success ; - Failure ; Author(s): George (GEOSoft) Gedye ; Modification(s): ; Note(s): If $iArray is not either -1 or default then $iCount has no effect ; Example(s): #cs $sFile = @ScriptFullPath $Value = _String_LineLength($sFile,-1, 0) If NOT @Error Then If IsArray($Value) Then MsgBox(0, "Returned array", "Character Count = " & $Value[0] & @CRLF & @CRLF & $Value[1]) Else MsgBox(0, "Length or string", $Value) EndIf EndIf #ce ;=============================================================================== Func _String_LineLength($sText, $iLong = -1, $iCount = -1, $iArray = -1) If FileExists($sText) Then $sText = FileRead($sText) If NOT $sText Then Return SetError(1,1, "Unable to read the text") $aText = StringRegExp($sText, "(.*?)(?:\v|\z)", 3) If @Error Then Return SetError(1,2, "RegExpression Error") Local $iLength = StringLen($aText[0]), $sRtn = $aText[0] For $i = 1 To Ubound($aText) -1 If NOT StringRegExp($aText[$i], "\s*\S") Then ContinueLoop If StringRegExp($iLong, "(?i)-1|default") Then If StringLen($aText[$i]) > $iLength Then $iLength = StringLen($aText[$i]) $sRtn = $aText[$i] EndIf Else If StringLen($aText[$i]) < $iLength Then $iLength = StringLen($aText[$i]) $sRtn = $aText[$i] EndIf EndIf Next If NOT StringRegExp($iArray, "(?i)-1|default") Then Local $aRtn[2] $aRtn[0] = $iLength $aRtn[1] = $sRtn Return $aRtn EndIf If StringRegExp($iCount, "(?i)-1|default") Then Return $iLength Return $sRtn EndFunc ;<==> _String_LineLength() ;=============================================================================== ; Function Name: _String_CountLines() ; Description: Return the number of lines in text or file ; Syntax: _String_CountLines("Text or full path to file") ; Parameter(s): $sText - text or file to check ; Requirement(s): ; Return Value(s): - Success Returns the line count of $sText ; - Failure set @Error to 1 if no text was passed to the function ; Author(s): George (GEOSoft) Gedye ; Modification(s): ; Note(s): ; Example(s): #cs $Count = _String_CountLines($sFile) MsgBox(0, "Line Count", $Count & " Lines") #ce ;=============================================================================== Func _String_CountLines($sText) If FileExists($sText) Then $sText = FileRead($sText) If NOT $sText Then Return SetError(1) StringRegExpReplace($sText, "(?m:^).*\v|\z", "$1") Return @Extended EndFunc ;<==> _String_CountLines() ; EDIT: The examples are in the headers Edited May 1, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Valuater Posted June 16, 2009 Author Posted June 16, 2009 (edited) ; USB connections - All USB Devices ; Author - Valuater $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colDevices = $objWMIService.ExecQuery ("Select * From Win32_USBControllerDevice") For $objDevice in $colDevices $strDeviceName = $objDevice.Dependent ;ConsoleWrite("!>" & $strDeviceName & @CRLF) $strQuotes = Chr(34) $strDeviceName = StringReplace($strDeviceName, $strQuotes, "") $arrDeviceNames = StringSplit($strDeviceName, "=") $strDeviceName = $arrDeviceNames[2] $colUSBDevices = $objWMIService.ExecQuery ("Select * From Win32_PnPEntity Where DeviceID = '" & $strDeviceName & "'") For $objUSBDevice in $colUSBDevices ConsoleWrite("-->" & $objUSBDevice.Description & @CRLF) Next Next Enjoy!! 8) Edited June 16, 2009 by Valuater
nguyenbason Posted June 19, 2009 Posted June 19, 2009 ; Animated Gif ; Author - gafrost Opt("MustDeclareVars", 1) #include <IE.au3> _Main() Func _Main() Local $pheight = 50, $pwidth = 50, $oIE, $GUIActiveX, $gif $gif = FileOpenDialog("Select Animated Gif", @ScriptDir, "gif files (*.gif)", 3) If @error Then Exit _GetGifPixWidth_Height($gif, $pwidth, $pheight) $oIE = ObjCreate("Shell.Explorer.2") GUICreate("Embedded Web control Test", 640, 580) $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, $pwidth, $pheight) $oIE.navigate ("about:blank") While _IEPropertyGet($oIE, "busy") Sleep(100) WEnd $oIE.document.body.background = $gif $oIE.document.body.scroll = "no" GUISetState() While GUIGetMsg() <> -3 WEnd EndFunc ;==>_Main Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight) If FileGetSize($s_gif) > 9 Then Local $sizes = FileRead($s_gif, 10) ConsoleWrite("Gif version: " & StringMid($sizes, 1, 6) & @LF) $pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1)) $pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1)) ConsoleWrite($pwidth & " x " & $pheight & @LF) EndIf EndFunc ;==>_GetGifPixWidth_HeightoÝ÷ ØLZ^~)^º¹ 8)You cannot delete the gif control if using this UnderWorldVN- Just play the way you like it
smashly Posted August 16, 2009 Posted August 16, 2009 (edited) Generate a Uuid (Unique user id), I use when I want to generate a dynamic unused CLSID#Include <WinAPI.au3> $sCLSID = _UuidCreat() ConsoleWrite($sCLSID & @LF) Func _UuidCreat() Local $tGUID, $pGUID $tGUID = DllStructCreate($tagGUID) $pGUID = DllStructGetPtr($tGUID) DllCall("rpcrt4.dll", "int", "UuidCreate", "ptr", $pGUID) If Not @error Then Return _WinAPI_StringFromGUID($pGUID) EndFunc Edited August 16, 2009 by smashly
frog78 Posted August 16, 2009 Posted August 16, 2009 ; add user accounts ; Author - MHz _NetUser('Jack', 'pw_abc') _NetUser('Jill', 'pw_def') Func _NetUser($name, $password = '', $groupname = 'Administrators', $autologon = 0) ; Creates user accounts. Only 1 user can have autologon, if set. Local $key If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then RunWait(@ComSpec & ' /c ' & _ 'Net User ' & $name & ' ' & $password & ' /add &&' & _ 'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _ 'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE) If $autologon Then $key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' RegWrite($key, 'DefaultUserName', 'Reg_sz', $name) RegWrite($key, 'DefaultPassword', 'Reg_sz', $password) RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1) EndIf EndIf EndFunc 8) That's what i was looking for thanks,I will test it immediately. //Frog78
Valuater Posted November 2, 2009 Author Posted November 2, 2009 ; Work with any screen resolution ; by Martin ; Settings for the mouse ; This is for the 1440 x 900 screen - change as needed Global $Width = 1440 Global $Height = 900 MyMouseMove(100, 200) Func MyMouseMove($x, $y) MouseMove(@DesktopWidth * $x / $Width, @DesktopHeight * $y / $Height) EndFunc ;==>MyMouseMove 8)
GEOSoft Posted November 16, 2009 Posted November 16, 2009 Test the installed version of Windows. @OSVERSION returns a string and therefore can not be used with mathematical operators. In this case I'm testing to see if it is greater than or equal to Vista Global Const $2K_VER = 5.0 Global Const $XP_VER = 5.1 Global Const $XP64_VER = 5.2 Global Const $VISTA_VER = 6.0 Global Const $W7_VER = 6.1 $iCurrVer = RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion") MsgBox(0, "Result", $iCurrVer >= $VISTA_VER) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Recommended Posts