Leaderboard
Popular Content
Showing content with the highest reputation on 04/19/2016 in all areas
-
No it doesn't speak, I lied. That is impossible. It's about setting animated GIF (and every other type of images) to a GUI control. How is this done for animated GIF? Few simple steps: - created ImageList of GIF Bitmaps retrieved from gif file/resource - created Pic control - every now and then another image is displayed. This is determined by frame delay time - see gif specification somewhere. That's it. All that takes time and could potentially block our gui/script. That's why flying assembly is used. Animation is done in another thread different from one AutoIt's code is executed in. Nothing stops animation but you. Animation works both for x64 and x86. Also it works for all kind of images not only GIFs. That means you can use it to display PNGs, BMPs, JPGs, etc... All of them from resources too. Example: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" Opt("MustDeclareVars", 1) ; Start by choosing GIF to display Global $sFile = FileOpenDialog("Choose Image", "", "(*.gif;*.png;*.jpg;*.tiff;*.bmp;*.jpeg)", -1, "") If @error Then Exit ; Make GUI Global $hGui = GUICreate("GIF Animation", 500, 500, -1, -1, $WS_OVERLAPPEDWINDOW) ; Add some buttons Global $hButton = GUICtrlCreateButton("&Pause animation", 50, 450, 100, 25) Global $hButton1 = GUICtrlCreateButton("&Delete Control", 200, 450, 100, 25) Global $hButton2 = GUICtrlCreateButton("&Open Image", 350, 450, 100, 25) ; Make GIF Control Global $hGIF = _GUICtrlCreateGIF($sFile, "", 10, 10) If @extended Then GUICtrlSetState($hButton, $GUI_DISABLE) GUICtrlSetTip($hGIF, "Image") ; Additional processing of some windows messages (for example) GUIRegisterMsg(133, "_Refresh") ; WM_NCPAINT GUIRegisterMsg(15, "_ValidateGIFs") ; WM_PAINT Global $iPlay = 1 ; Show it GUISetState() ; Loop till end While 1 Switch GUIGetMsg() Case -3 Exit Case $hButton If $iPlay Then If _GIF_PauseAnimation($hGIF) Then $iPlay = 0 GUICtrlSetData($hButton, "Resume animation") EndIf Else If _GIF_ResumeAnimation($hGIF) Then $iPlay = 1 GUICtrlSetData($hButton, "Pause animation") EndIf EndIf Case $hButton1 _GIF_DeleteGIF($hGIF) Case $hButton2 $sFile = FileOpenDialog("Choose gif", "", "(*.gif;*.png;*.jpg;*.tiff;*.bmp;*.jpeg)", -1, "", $hGui) If Not @error Then _GIF_DeleteGIF($hGIF); delete previous $hGIF = _GUICtrlCreateGIF($sFile, "", 10, 10) If @extended Then GUICtrlSetState($hButton, $GUI_DISABLE) Else GUICtrlSetState($hButton, $GUI_ENABLE) EndIf GUICtrlSetTip($hGIF, "Image") $iPlay = 1 GUICtrlSetData($hButton, "Pause animation") EndIf EndSwitch WEnd Func _Refresh($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GIF_RefreshGIF($hGIF) EndFunc ;==>_Refresh Func _ValidateGIFs($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GIF_ValidateGIF($hGIF) EndFunc ;==>_ValidateGIFs It should be 0% cpu. Download from here if you want to impress chicks: http://code.google.com/p/gif-animation/downloads/list There are 8 examples in there. GIF files are downloaded automatically if some example script needs it. Mostly from photobucket.com. Some examples work without classic download. Required data is get with InetRead(). That's mighty cool. So, download, open ZIP, grab folder inside and place it where you want. Run examples and that's it. Word or two about main function, _GUICtrlCreateGIF(). It can handle all sorts of input. Will display Images that are passed as binary, resource identifiers, strings, file names, ... everything. If it's valid image all works. For example, all this is valid: ; Pass GIF File path/name _GUICtrlCreateGIF("Some.gif", "", 10, 10) ; Binary data _GUICtrlCreateGIF($bGIF, "", 10, 10,) ; PE Resource (file GIF.dll, Type: GIF, Name: 4) _GUICtrlCreateGIF("GIF.dll", "GIF;4", 10, 10, 100, 120) ; PE Resource (file @AutoItExe, Type: RES, Name: BLAH, Language: 1033) _GUICtrlCreateGIF(@AutoItExe, "RES;BLAH;1033", 10, 10) ; PE Resource (file "explorer.exe", Type: 2, Name: 6801) _GUICtrlCreateGIF("explorer.exe", "2;6801", 10, 10) ;<- BITMAP ; PE Resource (file @AutoItExe, Type: RC_DATA, Name: PNG) _GUICtrlCreateGIF(@AutoItExe, "10;PNG", 10, 10) ; GIF string _GUICtrlCreateGIF(FileRead("Some.gif"), "", 10, 10) ____________________________________________1 point
-
_SendTo() - Create a shortcut in the SendTo folder.
argumentum reacted to guinness for a topic
This is a question which gets asked quite a bit >> How to add my program to the SendTo Folder? If this is you and you want to use a simple Function e.g. _SendTo_Install() then this UDF is for you. The UDF uses a Function from called _WinAPI_ShellGetSpecialFolderPath() which is able to retrieve many special folders within Windows, one of which is the SendTo folder. Have a look on MSDN for additional CSIDL identifiers that can be used with this Function. Any suggestions or comments, then please post below. Thanks. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _SendTo ; AutoIt Version : v3.2.12.1 or higher ; Language ......: English ; Description ...: Create a shortcut in the SendTo folder. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: Special thanks to Yashied for _WinAPI_ShellGetSpecialFolderPath, which can be found from WinAPIEx.au3 - http://www.autoitscript.com/forum/topic/98712-winapiex-udf ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= ; None ; #GLOBAL VARIABLES# ================================================================================================= ; None ; #CURRENT# ===================================================================================================================== ; _SendToFolder_Install: Creates a Shortcut in the SendTo folder. ; _SendToFolder_Uninstall: Deletes the Shortcut in the SendTo folder. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __SendTo_ShellGetSpecialFolderPath ......; Retrieves the path of a special folder. ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendTo_Install ; Description ...: Creates a Shortcut in the SendTo folder. ; Syntax ........: _SendTo_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCmdLine = '']]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCmdLine - [optional] Additional file arguments. Default is ''. ; Return values .: Success - FileCreateShortcut() Return code. ; Failure - Returns 0 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SendTo_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCmdLine = '') Local Const $bCSIDL_SENDTO = 0x0009 If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '.[^./]*$', '') If StringStripWS($sName, 8) = '' Or FileExists($sFilePath) = 0 Then Return SetError(1, 0, 0) EndIf _SendTo_Uninstall($sName, $sFilePath) ; Deletes The Shortcut In The SendTo folder. Local $sSendTo = __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) Return FileCreateShortcut($sFilePath, $sSendTo & '' & $sName & '.lnk', $sSendTo, $sCmdLine) EndFunc ;==>_SendTo_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendTo_Uninstall ; Description ...: Deletes the Shortcut in the SendTo folder. ; Syntax ........: _SendTo_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; Return values .: Success - FileClose() Return code ; Failure - Returns 0 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SendTo_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath) Local Const $bCSIDL_SENDTO = 0x0009 Local $aFileGetShortcut = 0, $sFileName = '' If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '.[^./]*$', '') If StringStripWS($sName, 8) = '' Or FileExists($sFilePath) = 0 Then Return SetError(1, 0, 0) EndIf Local $iStringLen = StringLen($sName), $sSendTo = __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) Local $hSearch = FileFindFirstFile($sSendTo & '' & '*.lnk') If $hSearch = -1 Then Return SetError(1, 0, 0) EndIf While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop EndIf If StringLeft($sFileName, $iStringLen) = $sName Then $aFileGetShortcut = FileGetShortcut($sSendTo & '' & $sFileName) If @error Then ContinueLoop EndIf If $aFileGetShortcut[0] = $sFilePath Then FileDelete($sSendTo & '' & $sFileName) EndIf EndIf WEnd Return FileClose($hSearch) EndFunc ;==>_SendTo_Uninstall ; #INTERNAL_USE_ONLY#============================================================================================================ ; #FUNCTION# ==================================================================================================================== ; Name...........: __SendTo_ShellGetSpecialFolderPath renamed from _WinAPI_ShellGetSpecialFolderPath ; Description....: Retrieves the path of a special folder. ; Syntax.........: __SendTo_ShellGetSpecialFolderPath($CSIDL [, $fCreate = 0]) ; Parameters.....: $CSIDL - The CSIDL ($CSIDL_*) that identifies the folder of interest. ; $fCreate - Specifies whether the folder should be created if it does not already exist, valid values: ; |TRUE - The folder is created. ; |FALSE - The folder is not created. (Default) ; Return values..: Success - The full path of a special folder. ; Failure - Empty string and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: WinAPIEx.au3 - http://www.autoitscript.com/forum/topic/98712-winapiex-udf ; Related........: ; Link...........: @@MsdnLink@@ SHGetSpecialFolderPath ; Example........: Yes ; =============================================================================================================================== Func __SendTo_ShellGetSpecialFolderPath($CSIDL, $fCreate = 0) Local $tPath = DllStructCreate('wchar[1024]') Local $aReturn = DllCall('shell32.dll', 'int', 'SHGetSpecialFolderPathW', 'hwnd', 0, 'ptr', DllStructGetPtr($tPath), 'int', $CSIDL, 'int', $fCreate) If (@error) Or (Not $aReturn[0]) Then Return SetError(1, 0, '') EndIf Return DllStructGetData($tPath, 1) EndFunc ;==>__SendTo_ShellGetSpecialFolderPathExample 1: #include '_SendTo.au3' Example() Func Example() _SendTo_Install() ; Add the running EXE to the SendTo Folder. ShellExecute(_GetSendToFolder()) Sleep(5000) _SendTo_Uninstall() ; Remove the running EXE from the SendTo folder. EndFunc ;==>Example ; Retrieve the SendTo folder location. Func _GetSendToFolder() Local Const $bCSIDL_SENDTO = 0x0009 Return __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) EndFunc ;==>_GetSendToFolderAll of the above has been included in a ZIP file. SendTo.zip1 point -
How to enable a window?
afallenhope reacted to BrewManNH for a topic
Have you tried it without the Text parameter?1 point -
Help with updating lablel
dynamitemedia reacted to UEZ for a topic
Just add $cStop to the check of GUIGetMsg() in function downloadingSpinner() DllCall("user32.dll", "int", "SetTimer", "hwnd", $spinGUI, "int", 0, "int", $iSleep, "int", 0) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cStop ExitLoop EndSwitch If $bFinished Then ExitLoop Until Not Sleep(50) and it should work.1 point -
Open the help file, search for For in it, and run the example script that you'll find in the function description.1 point
-
@youtuber: it's nonsence trying declaring and assignig a a variable after exit, it will be never assigned. @VIP: same noncene but using tidy so better formated nonsence. The variable has to be assigned in the case (-node) she is needed to be actual. Declaring of varaiables make sence in top of script. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $gaddparameter, $gmethod $Form1 = GUICreate("Form1", 248, 324, 445, 192) $Combo1 = GUICtrlCreateCombo("--parameter1", 40, 48, 161, 25) GUICtrlSetData(-1, "--parameter2|--parameter3") $Button1 = GUICtrlCreateButton("Button1", 96, 96, 75, 25) $Input1 = GUICtrlCreateInput("Input1", 56, 144, 153, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $gaddparameter = GUICtrlRead($Combo1) $gmethod = " abcd " & '"' & $gaddparameter & ' "' & " defg" GUICtrlSetData($Input1, $gmethod) EndSwitch WEnd1 point
-
Requesting permission from the AutoIt Team regarding Freenode IRC
JohnOne reacted to JLogan3o13 for a topic
@JohnOne it is more the security of the client than anything. The basic issue is it has been around since 1988, and a lot of information is sent plain text over a single port (6667 IIRC). Various clients attempt to wrap security around the protocol, but like anything to varying degrees. I still believe the majority of servers do not employ SSL/TLS, which leaves the channel open to attack. The biggest issue, like most technologies almost 30 years old (and not that great even at its peak) is people simply don't use it.1 point -
Difference between commands
Wicked_Caty reacted to JohnOne for a topic
Not really, _WinAPI_beep just uses DllCall to make the call to the windows API instead of Beep which uses AutoIt internal function to make the call to the windows API.1 point -
I have no beef with the point you are making, I just think you are missing the point of having the IRC. It serves a very different purpose than the forum does. You are right, that learned knowledge should be shared on the forum to benefit other members. That is encouraged in the IRC channel as well. The real benefit of the IRC is the ability to have a real-time conversation, and solicit feedback that may not really be of benefit to the forum, or may only be pertinent to a specific project. We have questions related to specific projects on the forum all the time, but those messages really do not benefit the community, and a real-time discussion with a few people can get that user on their feet and running quickly, rather than spending a couple of days soliciting feedback and asking clarifying questions. One example: During a discussion on the IRC channel today, one user described a project he was working on, and was evaluating what data storage method would best suit this particular project. Within a matter of only a few minutes, we were able to ask follow up questions, get his answers, provide our feedback, and answer his follow up questions. He now has a good direction to go on, and it took less than 10 minutes. That discussion, since it was specific to his project, and not easily generalized, would not have been of benefit to the community on the forum. That conversation was fast and valuable to that user, and could have potentially taken days to reach the same results on the forum. General "how do I" questions are perfect for the forum, as they can benefit others looking for the same information. On the other hand, "which methodology is best for my specific situation" questions, rarely benefit the community, and really only need to be taken to the forum if noone on the IRC has input to provide. In many cases, though, they can receive the input they need that is specific to them, and get it quickly. The other benefit is that a user does not need to fear a silly question being archived for all to see for years to come. They can ask their question, and (in general) is gone withing the space of a few hours. But as I said. The REAL benefit is in the real time exchange.1 point
-
Hello. As LarsJ says funtions are not implemented properly. So I wrote this example with correct implementation. (tested in windows 10 x64. Compiled as x86 and x64) Global Const $sTagSERVICE_STATUS = "DWORD dwServiceType;" & _ "DWORD dwCurrentState;" & _ "DWORD dwControlsAccepted;" & _ "DWORD dwWin32ExitCode;" & _ "DWORD dwServiceSpecificExitCode;" & _ "DWORD dwCheckPoint;" & _ "DWORD dwWaitHint;" Global $STANDARD_RIGHTS_REQUIRED = 0x000F0000 Global $SC_MANAGER_CONNECT = 0x0001 Global $SC_MANAGER_CREATE_SERVICE = 0x0002 Global $SC_MANAGER_ENUMERATE_SERVICE = 0x0004 Global $SC_MANAGER_LOCK = 0x0008 Global $SC_MANAGER_QUERY_LOCK_STATUS = 0x0010 Global $SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020 Global $SC_MANAGER_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _ $SC_MANAGER_CONNECT, _ $SC_MANAGER_CREATE_SERVICE, _ $SC_MANAGER_ENUMERATE_SERVICE, _ $SC_MANAGER_LOCK, _ $SC_MANAGER_QUERY_LOCK_STATUS, _ $SC_MANAGER_MODIFY_BOOT_CONFIG) Global Const $hAdvapi32 = DllOpen("advapi32.dll") MsgBox(64, "Info", "Make sure youre running Admin") Local $aRet = 0 Local $sServiceName = "Spooler" $aRet = DllCall($hAdvapi32, "handle", "OpenSCManagerW", _ "wstr", Null, _ "wstr", Null, _ "dword", $SC_MANAGER_ALL_ACCESS) If $aRet[0] = 0 Then If $aRet[0] = 0 And Not @error Then ConsoleWrite("!Error in OpenSCManager" & @CRLF) Exit EndIf Local $hSCManager = $aRet[0] ;~ MsgBox(0, "", $hSCManager) ConsoleWrite(">$hSCManager: " & $hSCManager & @CRLF) $aRet = DllCall($hAdvapi32, "handle", "OpenServiceW", _ "handle",$hSCManager, _ "wstr", $sServiceName, _ "long", $SC_MANAGER_ALL_ACCESS) If $aRet[0] = 0 Then If $aRet[0] = 0 And Not @error Then ConsoleWrite("!Error in OpenServiceW" & @CRLF) Exit EndIf Local $hServ = $aRet[0] ;~ MsgBox(0, "", $hServ) ConsoleWrite(">$hSCManager: " & $hServ & @CRLF) Local $tStatus = DllStructCreate($sTagSERVICE_STATUS) $aRet = DllCall($hAdvapi32, "bool", "QueryServiceStatus", _ "handle", $hServ, _ "ptr", DllStructGetPtr($tStatus)) If $aRet[0] = 0 Then If $aRet[0] = 0 And Not @error Then ConsoleWrite("!Error in QueryServiceStatus" & @CRLF) Exit EndIf ConsoleWrite("+Spooler Status: " & $tStatus.dwCurrentState & @CRLF) MsgBox(0, "", "Spooler Status: " & $tStatus.dwCurrentState) DllCall($hAdvapi32, "bool", "CloseServiceHandle", "handle", $hServ) DllCall($hAdvapi32, "bool", "CloseServiceHandle", "handle", $hSCManager) DllClose($hAdvapi32) Saludos1 point
-
You got my curiosity. What does Google show you about IRC usage? The most recent study I could find was from 2000, and showed a collective 306,573 users (up from 200-300 users in 1991), with projections to break 500,000 by 2001. That particular study only focused on 6 networks. Despite the bashing that non-IRC users like to make, the number of IRC networks is still growing, including the addition of regional networks. You can look HERE at a partial list of networks, though that list is 2 years old, and does not contain many of the networks (missing FreeNet, which is where TheDcoder has the ##AutoIt channel). I don't think TheDcoder was challenging the user stats of facebook or twitter in general. I think he is challenging the notion that no one used IRC or that the user base is marginal. The ##AutoIt channel participation is small at the moment, but that is only because it was only started up recently, and it takes time to make people aware of it. It is growing. IRC is not for everyone. If you do not want to use it, don't. What TheDcoder wants "Permission" for is to be able to call his channel an official channel. Official channels do draw in more users than unofficial channels. There are also more things that an official channel operators can be set up do to from an administrative standpoint that unofficial channel operators cannot.1 point
-
Recently I was in need to use this function. I had to change it a little, it may be useful to someone. Little refactored function: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #include <Array.au3> #include <WinAPI.au3> _Example() Func _Example() MsgBox(0, "Make your window active!" , 'This Message Box will be closed in 5 seconds', 5) Local $sControlText = GetAllWindowsControls(WinGetHandle("[ACTIVE]")) ClipPut($sControlText) ConsoleWrite($sControlText) EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: GetAllWindowsControls ; Description ...: ; Syntax ........: GetAllWindowsControls($hCallersWindow[, $bOnlyVisible = Default[, $sStringIncludes = Default[, $sClass = Default]]]) ; Parameters ....: $hCallersWindow - a handle value. ; $bOnlyVisible - [optional] a boolean value. Default is Default. ; $sStringIncludes - [optional] a string value. Default is Default. ; $sClass - [optional] a string value. Default is Default. ; Return values .: String with Controls descriptions. ; Author ........: jdelaney ; Modified ......: mLipok ; Remarks .......: ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/topic/164226-get-all-windows-controls/ ; Example .......: No ; =============================================================================================================================== Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible = Default, $sStringIncludes = Default, $sClass = Default) If Not IsHWnd($hCallersWindow) Then ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF) Return False EndIf ; Get all list of controls If $bOnlyVisible = Default Then $bOnlyVisible = False If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" Local $sClassList = WinGetClassList($hCallersWindow) ; Create array Local $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop Local $iCurrentClass = "" Local $iCurrentCount = 1 Local $iTotalCounter = 1 If StringLen($sClass) > 0 Then For $i = UBound($aClassList) - 1 To 0 Step -1 If $aClassList[$i] <> $sClass Then _ArrayDelete($aClassList, $i) EndIf Next EndIf Local $hControl = Null, $aControlPos Local $sControlText = '' Local $iControlID = 0 Local $bIsVisible = False Local $sResult = '' For $iClass_idx = 0 To UBound($aClassList) - 1 If $aClassList[$iClass_idx] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$iClass_idx] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $sControlText = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aControlPos = ControlGetPos($hCallersWindow, "", $hControl) $iControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf If StringLen($sStringIncludes) > 0 Then If Not StringInStr($sControlText, $sStringIncludes) Then $iTotalCounter += 1 ContinueLoop EndIf EndIf If IsArray($aControlPos) Then $sResult &= "Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $iControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aControlPos[0]) & "] YPos=[" & StringFormat("%4s", $aControlPos[1]) & "] Width=[" & StringFormat("%4s", $aControlPos[2]) & "] Height=[" & StringFormat("%4s", $aControlPos[3]) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $sControlText & "]." & @CRLF Else $sResult &= "Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $iControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $sControlText & "]." & @CRLF EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next Return $sResult EndFunc ;==>GetAllWindowsControls Regards, mLipok1 point
-
How to click button in a DIV?
The_Key_Maker reacted to mikell for a topic
Hmm you didn't read my post closely enough, I mentioned the div (the one inside the li) Look at the classnames : li => jqMpCntlTopMenListItm = list item div => jqMpCntlTopMenuBtn = button Not sure it will work of course but it's worth a try $oDivs = _IETagNameGetCollection($oFrame, "div") For $oDiv In $oDivs If StringInStr(oDiv.classname, "jqMpCntlTopMenuBtn") and $oDiv.innertext = "draw" Then _IEAction($oDiv, "click") EndIf Next1 point -
Open Control Panel Page(Items)
GuyFromNJo reacted to Danyfirex for a topic
Hi Mate. Some times we need to launch a control panel item to users. So I Implemented an IOpenControlPanel Interface. It allows to launch control panel items easily. #include "ControlPanelConstants.au3" Global Const $sCLSID_OpenControlPanel = "{06622D85-6856-4460-8DE1-A81921B41C4B}" Global Const $sIID_IOpenControlPanel = "{D11AD862-66DE-4DF4-BF6C-1F5621996AF1}" Global Const $sTagIOpenControlPanel= "Open hresult(wstr;wstr;ptr);GetPath hresult(wstr;wstr;uint);GetCurrentView hresult(int*)" Local $oOpenControlPanel = ObjCreateInterface($sCLSID_OpenControlPanel, $sIID_IOpenControlPanel, $sTagIOpenControlPanel) $oOpenControlPanel.Open($MicrosoftAdministrativeTools,"",Null) $oOpenControlPanel.Open($MicrosoftDateAndTime,$AdditionalClocks,Null) $oOpenControlPanel.Open($MicrosoftDefaultPrograms,$pageDefaultProgram,Null) $oOpenControlPanel.Open($GUID_MicrosoftDeviceManager,"",Null) $oOpenControlPanel.Open($GUID_MicrosoftDevicesAndPrinters,"",Null) $oOpenControlPanel.Open($MicrosoftHomeGroup,"",Null) $oOpenControlPanel.Open($MicrosoftInternetOptions,$Connections,Null) $oOpenControlPanel.Open($MicrosoftPersonalization,$pageWallpaper,Null) $oOpenControlPanel=0;Free ControlPanelConstants.au3 Saludos1 point -
GUI Icon Animation (a cool effect for your GUI)
GuyFromNJo reacted to junookyo for a topic
I had got this idea from Exe2Aut. When I start the program (Exe2Aut), GUI's icon will consecutive moves like a GIF image and it looks very cool . You can see screenshot below: So, I was created a small script to make an icon effect like that. Hope you all enjoy it! Download: <snip>1 point -
legend, Just check that it is not the c: drive before processing: $drive = DriveGetDrive("ALL") If IsArray($drive) Then For $lclpo = 1 To $drive[0] If Not ($drive[$lclpo] = "c:") And DriveSpaceFree($drive[$lclpo]) > 100 Then MsgBox("", "", $drive[$lclpo] & "\") EndIf Next EndIf M231 point
-
I am working on updating the old DiskPartitioner code to work in Windows 7 and hopefully Windows 8. Original source is here: At one point a version that supposedly worked with Windows 7 was released on a different forum, but the download has since disappeared. More options will also be added. I really want to make it be able to do absolutely everything that can be done from the command line. Any feedback and/or requests are welcome. ---------------------------------------------------------------- Upcoming changes in next release ---------------------------------------------------------------- ??? ---------------------------------------------------------------- Change Log (also included with the source) ---------------------------------------------------------------- Version 0.4 - released Mar 11, 2013 Bug Fixes: 1. Fixed the partition max size field in the create partition window. Should be good up to at least a petabyte. Was cutting off part of the text before. 2. Buttons on Create Partition Form work after changing size with up/down control / text input. 3. Create Partition - slider now fixed - should work for partitions up to almost 2 petabytes in size ((2^31) - 1 megabytes) 4. Create Partition - up/down now fixed - should work for partitions up to almost 2 petabytes in size 5. Fixed drive information display in both the main window and in the create partition window. 6. Drive capacity calculation. Was using 1000MB as 1GB before. Now correctly using 1024MB as 1GB. 7. Main window - fixed the width of the first column in the partition list. 8. Disks now show up in XP Interface: 1. Create Partition - Slider now has a tooltip so you can see what value the slider has while moving it. 2. Change Disk - window now wider in order to eliminate having to scroll to the right to see all the list fields. 3. Create Partition - When using the up/down control, the pie chart only updates once you release the control. The flickering was very annoying, so it has been changed. ---------------------------------------------------------------------- Version 0.3 Bug Fixes: 1. Can now choose size of extended partition 2. Can now create a primary partition if an extended partition already exists 3. Can now assign drive letters when creating a partition 4. Can now assign drive letters when editing a partition Features: 1. Added more info to main screen. 2. Added the ability when creating or editing a partition to let it assign the first available drive letter Interface: 1. Changed top of main screen layout. 2. Placeholder in add partition screen for setting an offset. Other: 1. Moved more repeated code into functions. ---------------------------------------------------------------------- Version 0.2 1. Removed old debug code, including a popup I forgot to comment out. 2. Made functions out of some repeated code. ---------------------------------------------------------------------- Version 0.1 1. Changed code to work with AutoIT v3 2. Works in Windows 7 ---------------------------------------------------------------- Known Bugs: Creating Partitions: 1. When creating logical partitions, it does not limit it to available size on the extended partition. 3. Will let you try to make more primary partitions if the maximum number is already on the disk. Comes back with success instead of failed even though no partition was actually made. (Feb. 4, 2013) Other: 1. "Check..." button does not work 2. "Defragment.." button does not work ---------------------------------------------------------------- Current source and executable: diskpartitioner_0.4.zip (source) DiskPartitioner_0.4_exe.zip (executable)1 point
-
The variable has simply been renamed in the GDIPlus UDF, so look at the GDIPlus startup function for a variable similar in name. I am not currently in a position to check, but it's something like $g__hGDIPlusDll*. * It's $__g_hGDIPDll1 point
-
You can try something like this here but the png transparency is not fully supported! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> Global Const $SC_DRAGMOVE = 0xF012 _GDIPlus_Startup() $hGUI = GUICreate("Test", 450, 200) $Bar = GUICtrlCreatePic("", 15, 70, 408, 32) GUICtrlSetImage($Bar, @ScriptDir & "A.bmp") Global $iBorder = _WinAPI_GetSystemMetrics(8) Global $iBar = _WinAPI_GetSystemMetrics(4) Global $aMain_Pos = WinGetPos($hGUI) Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 Global Const $iTransCol = 0x101010 Global $hGUI_Slider = GUICreate("", 0, 0, 100, 52, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI) Global $hBitmap = _GDIPlus_CreateHBitmapFromFile(@ScriptDir & "button_smiley.png", 56, 68) _WinAPI_MakeGUITransparent($hGUI_Slider, $hBitmap, 56, 68) GUISetState(@SW_SHOW, $hGUI_Slider) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE _Exit() EndSwitch Case $hGUI_Slider Switch $aMsg[0] Case $GUI_EVENT_CLOSE _Exit() Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI_Slider, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndSwitch WEnd Func _Exit() _GDIPlus_Shutdown() GUIDelete() Exit EndFunc ;==>_Exit Func _WinAPI_MakeGUITransparent($hGUI, $hHBitmap, $iW, $iH, $iTrans = 0xFF) Local $hScrDC = _WinAPI_GetDC(0) Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) Local $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) Local $tSize = DllStructCreate($tagSIZE) Local $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $iW) DllStructSetData($tSize, "Y", $iH) Local $tSource = DllStructCreate($tagPOINT) Local $pSource = DllStructGetPtr($tSource) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) Local $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iTrans) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hHBitmap) _WinAPI_DeleteDC($hMemDC) Return 1 EndFunc ;==>_WinAPI_MakeGUITransparentGUI Func _GDIPlus_CreateHBitmapFromFile($sFile, $iW, $iH) Local $hBmp = _GDIPlus_BitmapCreateFromFile($sFile) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hCtxt, "int", 7) _GDIPlus_GraphicsDrawImageRect($hCtxt, $hBmp, 0, 0, $iW, $iH) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_GraphicsDispose($hCtxt) Local $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndFunc ;==>_GDIPlus_CreateHBitmapFromFile Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported) Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0 $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($aRet[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;') DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'bV5Width', $aRet[2]) DllStructSetData($tBIHDR, 'bV5Height', $aRet[3]) DllStructSetData($tBIHDR, 'bV5Planes', 1) DllStructSetData($tBIHDR, 'bV5BitCount', 32) DllStructSetData($tBIHDR, 'bV5Compression', 3) ; $BI_BITFIELDS = 3 DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride')) DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000) DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000) DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00) DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF) DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2 DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) $tData = 0 $tBIHDR = 0 Return $hResult EndFunc ;==>_WinAPI_BitmapCreateDIBFromBitmap Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $hGUI_Slider Then $aMain_Pos = WinGetPos($hGUI) Local $iY = $aMain_Pos[1] + $iBorder + $iBar + 52 Local $iX_Min = $aMain_Pos[0] + $iBorder + 15 Local $iX_Max = $aMain_Pos[0] + $iBorder + 367 Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) Local $iWidth = DllStructGetData($stWinPos, 5) Local $iHeight = DllStructGetData($stWinPos, 6) If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $iY Then DllStructSetData($stWinPos, 4, $iY) EndIf EndFunc ;==>WM_WINDOWPOSCHANGING But it is not flickering on movement... Br, UEZ1 point
-
Indeed I mixed up the topics. Nice examples rover! I searched for Yashied's code but didn't find it and decided to hack something with built-in graphic creator using GDI+. ;coded by UEZ build 2013-09-03 beta #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UPX_Parameters=--best --lzma #include <SliderConstants.au3> ;~ #include <WindowsConstants.au3>;~~~ #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 0) Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() Global $hGUI = GUICreate("New Slider beta by UEZ 2012-2013", 580, 280) Global $iW = 300, $iH = 16 Global $aSlider1 = GUICtrlCreateHSlider(100, 50, $iW, $iH, 0xFF4080F0) Global $idLabel = GUICtrlCreateLabel("Volume", 10, 46, 70, 30) GUICtrlSetFont(-1, 16) Global $idInput1 = GUICtrlCreateInput($aSlider1[7], 420, 46, 42, 24, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlSetFont(-1, 12) Global $iSliderPos = 50 Global $aSlider2 = GUICtrlCreateHSlider(120, 100, $iW + 30, 30, 0xFF205020, @ScriptDir & "\button_smiley.png", "", $iSliderPos) Global $idInput2 = GUICtrlCreateInput($aSlider2[7], 10, 100, 42, 24) GUICtrlSetFont(-1, 12) Global $iSlider = GUICtrlCreateSlider(6, 150, $iW + 156, 45, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_NOTHUMB, $TBS_NOTHUMB)) GUICtrlSetLimit(-1, 200, 0) GUICtrlSetState(-1, $GUI_DISABLE) Global $idButton = GUICtrlCreateButton("OK", 56, 99, 40, 26) Global $aSlider3 = GUICtrlCreateHSlider(20, 180, $iW + 130, 50, 0, @ScriptDir & "\star.png", @ScriptDir & "\Texture.jpg", $iSliderPos) Global $aSlider4 = GUICtrlCreateVSlider(520, 20, 24, 240, 0xFF505050) ;~ Global $aSlider4 = GUICtrlCreateVSlider(520, 20, 24, 240, 0, "", @ScriptDir & "\TextureRotated.jpg") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlSetOnEvent($aSlider1[0], "CheckSliderMove") GUICtrlSetOnEvent($aSlider2[0], "CheckSliderMove") GUICtrlSetOnEvent($aSlider3[0], "CheckSliderMove") GUICtrlSetOnEvent($aSlider4[0], "CheckSliderMove") GUICtrlSetOnEvent($idButton, "UpdateSlider") Do Until Not Sleep(3000) Func UpdateSlider() SetSliderPosHMan($aSlider2, GUICtrlRead($idInput2)) EndFunc ;==>UpdateSlider Func _Exit() _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Func CheckSliderMove() Local $aRes = GUIGetCursorInfo($hGUI), $aPosW, $aPosH Switch $aRes[4] Case $aSlider1[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosH($aSlider1, $aRes[0]) GUICtrlSetData($idInput1, $aSlider1[7]) $aPosW = WinGetPos($hGUI) ToolTip("Value: " & $aSlider1[7], $aPosW[0] + $aRes[0], $aPosW[1] + $aRes[1] + 50) WEnd ToolTip("") Case $aSlider2[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosH($aSlider2, $aRes[0]) GUICtrlSetData($idInput2, $aSlider2[7]) WEnd Case $aSlider3[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosH($aSlider3, $aRes[0]) $aPosW = WinGetPos($hGUI) ToolTip("Value: " & $aSlider3[7], $aPosW[0] + $aRes[0], $aPosW[1] + $aRes[1] + 50) WEnd ToolTip("") Case $aSlider4[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosV($aSlider4, $aRes[1]) $aPosH = WinGetPos($hGUI) ToolTip("Value: " & $aSlider4[7], $aPosH[0] + $aRes[0], $aPosH[1] + $aRes[1] + 50) WEnd ToolTip("") EndSwitch EndFunc ;==>CheckSliderMove Func SetSliderPosHMan(ByRef $aSlider, $iPos) Local $aPos, $aPosW $iNewPos = 1 + Int($aSlider[1] + $iPos * $aSlider[5] + $aSlider[3]) GUICtrlSetPos($aSlider[0], Max($aSlider[1], Min($iNewPos - $aSlider[3], $aSlider[4])), $aSlider[2]) $aPos = ControlGetPos($hGUI, "", $aSlider[0]) $aPosW = WinGetPos($hGUI) $aSlider[7] = $iPos ;Int(($aPos[0] + $aSlider[3] - $aSlider[6]) / $aSlider[5]) EndFunc ;==>SetSliderPosHMan Func SetSliderPosH(ByRef $aSlider, $iPos) Local $aPos, $aPosW GUICtrlSetPos($aSlider[0], Max($aSlider[1], Min($iPos - $aSlider[3], $aSlider[4])), $aSlider[2]) $aPos = ControlGetPos($hGUI, "", $aSlider[0]) $aPosW = WinGetPos($hGUI) $aSlider[7] = Int(($aPos[0] + $aSlider[3] - $aSlider[6]) / $aSlider[5]) EndFunc ;==>SetSliderPosH Func SetSliderPosV(ByRef $aSlider, $iPos) Local $aPos, $aPosH GUICtrlSetPos($aSlider[0], $aSlider[2], Max($aSlider[1], Min($iPos - $aSlider[3], $aSlider[4]))) $aPos = ControlGetPos($hGUI, "", $aSlider[0]) $aPosH = WinGetPos($hGUI) $aSlider[7] = Int(($aPos[1] + $aSlider[3] - $aSlider[6]) / $aSlider[5]) EndFunc ;==>SetSliderPosV Func GUICtrlCreateHSlider($iX, $iY, $iW, $iH, $iColor, $sFileThumb = "", $sFileBg = "", $iValThumb = 0, $iColorThumb = 0xD0A00000, $iColorThumb_Center = 0xFFFFA0A0, $iValMin = 0, $iValMax = 100, $fSize = 0.025, $fScale = 1.5) Local $hHBitmap_Thumb, $hHBitmap_Bg Local $idPic_Bg = GUICtrlCreatePic("", $iX, $iY, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) If $sFileBg <> "" And FileExists($sFileBg) Then $hHBitmap_Bg = _GDIPlus_CreateHBitmapFromFile($sFileBg, $iW, $iH) Else $hHBitmap_Bg = _GDIPlus_CreateRoundRectImage($iW, $iH, $iColor, $fSize) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Bg, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Bg)) _WinAPI_DeleteObject($hHBitmap_Bg) Local $iH_Thumb = $iH * $fScale Local $fRatio = $iW / Abs($iValMax - $iValMin) Local $idPic_Thumb = GUICtrlCreatePic("", $iX - $iH_Thumb / 2 + $iValThumb * $fRatio, $iY - ($iH_Thumb - $iH) / 2, $iH_Thumb, $iH_Thumb) If $sFileThumb <> "" And FileExists($sFileThumb) Then $hHBitmap_Thumb = _GDIPlus_CreateHBitmapFromFile($sFileThumb, $iH_Thumb, $iH_Thumb) Else $hHBitmap_Thumb = _GDIPlus_CreateEllipseThumb($iH_Thumb, $iColorThumb, $iColorThumb_Center) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Thumb, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Thumb)) _WinAPI_DeleteObject($hHBitmap_Thumb) Local $aSlider[8] = [ $idPic_Thumb, _ ;0 control id $iX - $iH_Thumb / 2, _ ;1 min x position thumb $iY - ($iH_Thumb - $iH) / 2, _ ;2 center position thumb height $iH_Thumb / 2, _ ;3 center thumb height $iX + $iW - $iH_Thumb / 2, _ ;4 end x position $fRatio, _ ;5 ratio $iX, _ ;6 start x position $iValThumb] ;7 thumb size ratio Return $aSlider EndFunc ;==>GUICtrlCreateHSlider Func GUICtrlCreateVSlider($iX, $iY, $iW, $iH, $iColor, $sFileThumb = "", $sFileBg = "", $iValThumb = 0, $iColorThumb = 0xD0005000, $iColorThumb_Center = 0xFF80E080, $iValMin = 0, $iValMax = 100, $fSize = 0.025, $fScale = 1.5) Local $hHBitmap_Thumb, $hHBitmap_Bg Local $idPic_Bg = GUICtrlCreatePic("", $iX, $iY, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) If $sFileBg <> "" And FileExists($sFileBg) Then $hHBitmap_Bg = _GDIPlus_CreateHBitmapFromFile($sFileBg, $iW, $iH) Else $hHBitmap_Bg = _GDIPlus_CreateRoundRectImage($iH, $iW, $iColor, $fSize, True, True) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Bg, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Bg)) _WinAPI_DeleteObject($hHBitmap_Bg) Local $iW_Thumb = $iW * $fScale Local $fRatio = $iH / Abs($iValMax - $iValMin) Local $idPic_Thumb = GUICtrlCreatePic("", $iX + ($iW - $iW_Thumb) / 2 + $iValThumb * $fRatio, $iY - ($iW_Thumb - $iH) / 2, $iW_Thumb, $iW_Thumb) If $sFileThumb <> "" And FileExists($sFileThumb) Then $hHBitmap_Thumb = _GDIPlus_CreateHBitmapFromFile($sFileThumb, $iW_Thumb, $iW_Thumb) Else $hHBitmap_Thumb = _GDIPlus_CreateEllipseThumb($iW_Thumb, $iColorThumb, $iColorThumb_Center) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Thumb, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Thumb)) _WinAPI_DeleteObject($hHBitmap_Thumb) Local $aSlider[8] = [ $idPic_Thumb, _ ;0 control id $iY - $iW_Thumb / 2, _ ;1 min y position thumb $iX - ($iW_Thumb - $iW) / 2, _ ;2 center position thumb width $iW_Thumb / 2, _ ;3 center thumb height $iY + $iH - $iW_Thumb / 2, _ ;4 end Y position $fRatio, _ ;5 ratio $iY, _ ;6 start Y position $iValThumb] ;7 thumb size ratio Return $aSlider EndFunc ;==>GUICtrlCreateVSlider Func _GDIPlus_CreateRoundRectImage($iW, $iH, $iColor = 0xFF4080F0, $fSize = 0.025, $hHBitmap = True, $iRotate = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0) Local $hPath_Bg = $aResult[2] $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0) Local $hPath_Fg = $aResult[2] $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) Local $iColor_Bg = 0xFF000000 + 0x10000 * Max(BitShift(BitAND($iColor, 0x00FF0000) / 3, 16), 0x10) + 0x100 * Max(BitShift(BitAND($iColor, 0x0000FF00) / 3, 8), 0x10) + Max(BitAND($iColor, 0x000000FF / 3), 0x10) Local $hBrush = _GDIPlus_BrushCreateSolid($iColor_Bg) Local $dW = Int($iW * $fSize) DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Bg, "float", 0, "float", 0, "float", $dW, "float", $iH, "float", 90, "float", 180) ;left arc DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Bg, "float", $iW - $dW - 1, "float", 0, "float", $dW, "float", $iH, "float", -90, "float", 180) ;right arc DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath_Bg) DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush, "handle", $hPath_Bg) $iH *= 0.89 Local $iColor2 = 0xFF000000 + 0x10000 * Min(BitShift(BitAND($iColor, 0x00FF0000), 16) * 3, 0xFF) + 0x100 * Min(BitShift(BitAND($iColor, 0x0000FF00), 8) * 3, 0xFF) + Min(BitAND($iColor, 0x000000FF) * 3, 0xFF) Local $tRectF = _GDIPlus_RectFCreate(0, 0, $iW, $iH) $aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", DllStructGetPtr($tRectF), "int", $iColor2, "int", $iColor, "int", 1, "int", 0, "int*", 0) Local $hBrush_Gradient = $aResult[6] DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Fg, "float", 1, "float", 0, "float", $dW * 0.8, "float", $iH, "float", 90, "float", 180) DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Fg, "float", $iW - $dW - $dW / 5, "float", 0, "float", $dW * 0.8, "float", $iH, "float", -90, "float", 180) DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath_Fg) $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush_Gradient, "handle", $hPath_Fg) DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath_Bg) DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath_Fg) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush_Gradient) Switch $iRotate Case 1 DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 1) Case 2 DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 3) EndSwitch If $hHBitmap Then Local $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_CreateRoundRectImage Func _GDIPlus_CreateEllipseThumb($iSize, $iColor = 0xD0A00000, $iColor_Center = 0xFFFFA0A0, $hHBitmap = True, $sFile = "") Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0) Local $hPath = $aResult[2] DllCall($ghGDIPDll, "int", "GdipAddPathEllipse", "handle", $hPath, "float", 0, "float", 0, "float", $iSize, "float", $iSize) $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "handle", $hPath, "int*", 0) Local $hBrush_Gradient = $aResult[2] Local $fCenter = $iSize / 2 Local $tPointF = DllStructCreate("float;float") DllStructSetData($tPointF, 1, $fCenter * 0.6) DllStructSetData($tPointF, 2, $fCenter * 0.4) $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterPoint", "handle", $hBrush_Gradient, "ptr", DllStructGetPtr($tPointF)) $tARGB = DllStructCreate("int") DllStructSetData($tARGB, 1, $iColor, 1) DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hBrush_Gradient, "int", DllStructGetPtr($tARGB), "int*", 1) DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "handle", $hBrush_Gradient, "int", True) DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "handle", $hBrush_Gradient, "int", $iColor_Center) $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iSize, "int", $iSize, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush_Gradient, "handle", $hPath) DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath) DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath) Local $hPen = _GDIPlus_PenCreate(0xD0080808) _GDIPlus_GraphicsDrawEllipse($hCtxt, 0, 0, $iSize - 1, $iSize - 1, $hPen) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hBrush_Gradient) If $hHBitmap Then Local $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_CreateEllipseThumb Func _GDIPlus_CreateHBitmapFromFile($sFile, $iW, $iH) Local $hBmp = _GDIPlus_BitmapCreateFromFile($sFile) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($ghGDIPDll, "int", "GdipSetInterpolationMode", "handle", $hCtxt, "int", 7) _GDIPlus_GraphicsDrawImageRect($hCtxt, $hBmp, 0, 0, $iW, $iH) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_GraphicsDispose($hCtxt) Local $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndFunc ;==>_GDIPlus_CreateHBitmapFromFile Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported) Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0 $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($aRet[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;') DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'bV5Width', $aRet[2]) DllStructSetData($tBIHDR, 'bV5Height', $aRet[3]) DllStructSetData($tBIHDR, 'bV5Planes', 1) DllStructSetData($tBIHDR, 'bV5BitCount', 32) DllStructSetData($tBIHDR, 'bV5Compression', 3) ; $BI_BITFIELDS = 3 DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride')) DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000) DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000) DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00) DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF) DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2 DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) Return $hResult EndFunc ;==>_WinAPI_BitmapCreateDIBFromBitmap Func Min($a, $b) If $a < $b Then Return $a Return $b EndFunc ;==>Min Func Max($a, $b) If $a > $b Then Return $a Return $b EndFunc ;==>Max It is beta and probably buggy! All needed files in the attachment -> New Slider.7z (73 download previously) Br, UEZ1 point
-
Yes, in the same example with little modification: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _Example() ; _Example Func _Example() GUICreate("My GUI", 640, 480, 50, 50) ; will create a dialog box that when displayed is centered GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL") GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN Sleep(250) ToolTip("") EndSwitch WEnd GUIDelete() EndFunc ;==>_Example Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) Local $iMPos = MouseGetPos() Switch $wParam Case 0x00780000 ToolTip("Mouse wheel UP is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Wheel UP", 1, 3) Case 0xFF880000 ToolTip("Mouse wheel Down is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Wheel Down", 1, 3) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_MOUSEWHEEL Regards, João Carlos.1 point
-
reading drop down from web page
The_Key_Maker reacted to ihousden for a topic
For posterity, im posting the function. I hope someone will find it useful. I know the code could be tighter but hey, im a noob, quit complaining. #include <IE.au3> #include <Array.au3> DIM $resname DIM $smode DIM $desc DIM $sdate DIM $edate DIM $DDLName DIM $DDLSelect $oIE = _IECreate("http://you_cant_get_here_from_there") _IELoadWait ($oIE) Sleep(300) $oForm = _IEFormGetObjByName ($oIE, "frmDtl") $resname = _IEFormElementGetObjByName ($oForm, "Desc") ; Query Drop Down List $DDLName = "schedColor" ; name of DDL DDLQuery() $smode = $DDLSelect ; currently selected innertext of DDL ; End Query Drop Down List $desc = _IEFormElementGetObjByName ($oForm, "ExtDesc") $sdate = _IEFormElementGetObjByName ($oForm, "schedDate") $edate = _IEFormElementGetObjByName ($oForm, "schedEndDate") MsgBox(0, "Form Element Value", _IEFormElementGetValue ($resname)) MsgBox(0, "Form Element Value", $smode) MsgBox(0, "Form Element Value", _IEFormElementGetValue ($desc)) MsgBox(0, "Form Element Value", _IEFormElementGetValue ($sdate)) MsgBox(0, "Form Element Value", _IEFormElementGetValue ($edate)) Func DDLQuery() $oSelect = _IEGetObjByName($oIE, $DDLName) $colChildren = _IETagNameGetCollection($oSelect, "Option") For $oChild In $colChildren $sValue = $oChild.value $sText = $oChild.innerText $vSelected = $oChild.selected if $oChild.selected = "True" Then $DDLSelect = $oChild.innerText EndIf ConsoleWrite("Debug: Value = " & $sValue & "; Text = " & $sText & "; Selected = " & $vSelected & @LF) Next EndFunc Thanks again for the help PsaltyDS1 point -
For some reason certain parts of the code that I paste are being truncated. The line in question should read: $Line = StringRegExpReplace($Line, '[\s|]* , '') ;trim spaces, returns, line breaks, and pipes from end of the string I also failed to create the lstdsk.ini file which has the commands for diskpart. That is done in the first 3 lines after the #includes. Here is the entire script again just in case..I've checked to make sure that when I copy what I have posted, there are no errors in the script #include <GUIConstantsEx.au3> #include <String.au3> $File = FileOpen('lstdsk.ini', 2) FileWrite($File, 'list disk') FileClose($File) RunWait("cmd /c diskpart /s lstdsk.ini > lstdsk.txt", "", @SW_HIDE) Example() Func Example() Local $Menu1, $n1, $n2, $Msg, $menustate, $menutext, $File Local $Line, $Array = _StringExplode(FileRead('lstdsk.txt'), @LF) For $i = 0 To UBound($Array) - 1 If StringRegExp($Array[$i], '(?i)Disk [\d]+') Then $Line &= $Array[$i] & "|" Next $Line = StringRegExpReplace($Line, '[\s|]*$' , '') ;trim spaces, returns, line breaks, and pipes from end of the string GUICreate("Select Disk To Format", 260, 250) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Avaliable Disks", 22, 10, 100) $n1 = GUICtrlCreateList("", 20, 30, 215, 150) GUICtrlSetData(-1, $Line) $n2 = GUICtrlCreateButton("Select This Disk to Format", 28, 200, 200) GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button GUISetState() ; will display an empty dialog box ; Run the GUI until the dialog is closed Do $Msg = GUIGetMsg() If $Msg = $n2 Then Local $Disk = StringRegExpReplace(GUICtrlRead($n1), '(?i)^.*(Disk [\d]+).*$' , '$1') MsgBox(0, "Selected listbox entry", $Disk) ; display the selected listbox entry EndIf Until $Msg = $GUI_EVENT_CLOSE EndFunc ;==>Example EDIT: My problem was enabling the Rich Text Editor in my profile..disabled that and all is well now,.1 point