Leaderboard
Popular Content
Showing content with the highest reputation on 02/17/2014 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
-
GUIListViewEx - Deprecated Version
123disconnect reacted to Melba23 for a topic
Now replaced by a new version of the UDF in this link. <hr> [NEW VERSION] - 7 Mar 16 Added: A new option for $iAdded (+ 512) allows you to select just one cell of the ListView rather than the whole row. A new function _GUIListViewEx_SetDefColours allows the user to set the default colours when using either or both the "colour" and "single cell selection" options. Another new function _GUIListViewEx_BlockReDraw which prevents ListView redrawing during looped Insert/Delete/Change calls - this greatly speeds up execution by avoiding lengthy redrawing when using either or both the "colour" and "single cell selection" options, use of which forces the redraw to use a WM_NOTIFY handler within the script. Changed: A number of minor internal changes to speed up the loading of the ListView when using either or both of the "colour" and "single cell selection" options. A slightly modified Example_6 script shows the new functions in use. The LH native ListView can have rows and columns added/removed using both the old and new functions and has a context menu to allow for colour selection. The contents of this ListView can be mirrored to the RH UDF-created ListView which has "single cell selection" enabled and allows the colours of any item (including the selected cell) to be changed programmatically. New UDF in the zip below. Previous changes: ChangeLog.txt Hi, It seemed that I wanted to add, delete, edit or move items in a ListView quite often in my scripts and I got fed up with having to rewrite the code to do it each time. I also wanted to be able to drag items within and between ListViews with the mouse, plus edit the items. So I decided to write a UDF to make life easier and here is the result - GUIListViewEx. If you are interested in how it works, then read this bit - if not, then skip over it: The UDF is pretty easy to use: - You start by creating a ListView (either native or UDF) and passing the returned ControlID/handle and the array you used to fill it to the _Init function of the UDF. You also indicate whether the array has a count in the [0] (or [0][0]) element and if you create an empty ListView, the UDF will still cope and will shadow any items that you insert later. If you have a ListView filled with data but no matching array, there is a function to read that data into an array for you. You can select a colour for the insert mark when dragging items if you are going to use this feature - the default is black - and decide whether to have a shadow of the dragged item follow the mouse. Finally you can set the ListView to be sortable, editable - with various options to determine how the editing process works, determine external drag/drop behaviour and whether user colours are used. - You need to register a few Windows messages, but this is a single call to the _MsgRegister function. If you already have handlers for the relevant messages, there are functions to call within these handlers instead. If you do not want to drag, then you only need the WM_NOTIFY handler loaded. - Then you just need to call the main _Insert($vData), _Delete, _Up, and _Down functions when the appropriate button is pressed, select and drag items, or use one of the edit functions and your ListView responds automatically. - The UDF shadows the contents of the ListView (as explained in the spoiler section above) so you can get its current state at any time with the _ReturnArray function . Many of the functions actually return this data after each call just to help you keep track and there are dedicated Save/Load functions. - If enabled, the user can colour individual items within the ListView - and can set certain elements to be coloured on loading if required. - There are a couple of functions that you need to run in your idle loop if you need the functionality - they detect when items are dragged and edited. - When you have finished with the ListView, you should use the _Close function to clear the memory used by the UDF to shadow its contents. It is not vital, but if you use a lot of ListViews and do not do this, you could end up running out of memory. - You can have as many ListViews as you wish on display at any one time and the same "Insert", "Delete", "Up" and "Down" buttons can be used for them all - you just have to click on the one you want to be active. The UDF also allows you to set the active ListView programatically (_SetActive) - and to determine which is currently active (_GetActive). There are also additional Insert/DeleteSpec functions which allow you to action non-active ListViews. There are 6 example scripts to show the UDF working on native and UDF created ListViews, with single or multiple columns and either filled or empty, along with the UDF itself in this zip file: Credit to martin (for the basic drag code which I found on the forum), the Array UDF authors (for the basis of the array functions) and LarsJ (for the basic colour handler code). Happy for any feedback - hopefully positive! M231 point -
Guitar Tab Tester
Danyfirex reacted to jaberwacky for a topic
I think he dabbles a bit here and there on the side when he has the time.1 point -
v0.2 : InputManger now works. Short-Term todo list: > the camera is fixed at (0,0,0). Even though the tree can move toward or away from this point along the z-axis, you want to be able to move the camera around freely. > When the tree is very close to the camera, the polygon is drawn in strange ways. Also, when you zoom in too far (past the tree), the tree appears upside down! This is because polygons are not clipped to the view frusum. > Finally, the tree is flat, which is kind of boring. Solid trees and other solid shapes will be more interesting. ok... now back to the demo... Test exe: (Whenever an "ASSERT" box pops up, click Ignore.) Libraries: http://www.autoitscript.com/fileman/users/nfwu/AutoIt3D.zip (Source code for test is in /test/ of the ZIP, as usual) Controls for demo: ESC : Quit Up Arrow : Zoom In Down Arrow : Zoom Out #) NOTES: 1) The libraries are pretty complicated to use *for now*. I will create an easier to use version soon after I have completed the short-term goals listed above. Please make suggestions!!!1 point
-
Found this in about 1 minute.1 point
-
Why in the world are you putting the @AppDataDir inside brackets? Where did you see that as the way to write that? Use this: FileWrite(@AppDataDir & "\program\User.txt", $User) BTW, Windows uses back slashes to separate file path elements.1 point
-
I'd suggest this: "C:Users" & @UserName & "AppDataprogramUser.txt"1 point
-
1 point
-
The help file is your friend. It has a search function that makes things real easy to find.1 point
-
1 point
-
IfExtend.au3 - include file for enabling shorter scripts
DatMCEyeBall reacted to Exit for a topic
Just keep it simple: (AutoIt 3.3.10.0+) $sky = InputBox("Sky status", "Play around with values like blue, falling, green.", "falling") MsgBox(0, "Test 1", "Sky is " & ($sky = "falling" ? "" : "not ") & "falling") MsgBox(0, "Test 2", "Sky is " & (($sky = "blue" Or $sky = "falling") ? "" : "not ") & "blue or falling") MsgBox(0, "Test 3", "Sky is " & (($sky <> "blue" And $sky <> "falling") ? "not " : "") & "blue or falling")1 point -
Active Directory UDF
denisaurus reacted to water for a topic
I think I found the problem. It's an unhandled error condition. Please change the function as follows: Func _AD_AddUserToGroup($sGroup, $sUser) If Not _AD_ObjectExists($sGroup) Then Return SetError(1, 0, 0) If Not _AD_ObjectExists($sUser) Then Return SetError(2, 0, 0) If _AD_IsMemberOf($sGroup, $sUser) Then Return SetError(3, 0, 0) If StringMid($sGroup, 3, 1) <> "=" Then $sGroup = _AD_SamAccountNameToFQDN($sGroup) ; sAMACccountName provided If StringMid($sUser, 3, 1) <> "=" Then $sUser = _AD_SamAccountNameToFQDN($sUser) ; sAMACccountName provided Local $oUser = __AD_ObjGet("LDAP://" & $sAD_HostServer & "/" & $sUser) ; Retrieve the COM Object for the user Local $oGroup = __AD_ObjGet("LDAP://" & $sAD_HostServer & "/" & $sGroup) ; Retrieve the COM Object for the group $oGroup.Add($oUser.AdsPath) If @error <> 0 Then Return SetError(@error, 0, 0) ; <==== ADD THIS LINE! $oGroup.SetInfo If @error <> 0 Then Return SetError(@error, 0, 0) Return 1 EndFunc ;==>_AD_AddUserToGroup1 point -
GDI+ animated loading screens build 2014-06-20 (32 examples)
DatMCEyeBall reacted to UEZ for a topic
Added some more examples and more will follow... Just look to the 1st post for screenshots and download link. Br, UEZ1 point -
You're welcome. The bug was a stupid oversight on my part. I've been using some of this code for a while already without noticing it. When I get time, I will probably make some trivial (non script breaking) changes. I can see a difference between the code I wrote a while back and the code I wrote recently. It feels good to finally create something useful to someone else, besides myself.1 point
-
noID, We do not help break login security measures. This sounds very much as though you are trying to do just that. You have 24hrs to explain why I should not lock this thread. M231 point
-
cparadis, _ScreenCapture_Capture needs the actual coordinates of the 4 corners - by using WinGetPos you are getting WIDTH and HEIGHT as the [2] and [3] elements. Try changing the relevant line to this: _ScreenCapture_Capture("screenshot.jpg", $pos[0], $pos[1], $pos[0] + $pos[2], $pos[1] + $pos[3], 0) By the way, if you use _ScreenCapture_CaptureWnd instead, AutoIt does all the calculations for you. M231 point