Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/04/2016 in all areas

  1. trancexx

    GIF Animation

    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
  2. Jon

    Forum Upgrade Status

    Forum upgraded to 4.1.12.1 This is a maintenance release to fix reported issues and add refinement to existing features. In addition to bug fixes and performance improvements, it includes following enhancements: New Features: • When you mouseover the badge showing who liked a post, you will now see a larger list of who liked that post. You can still click to get the full list. • Ratings now show half-stars for the average (for example, if one user votes 3 stars and another 4, it will show 3 and a half stars) and there is now an indication if you have rated something. • A "Preview" button has been added to the post editor which shows how the post will appear after BBCode processing. Tabs show how the post will appear on desktop, tablet and mobile. • Users can now choose to ignore notifications for being mentioned in posts by particular users. • You can now filter searches by specific forums/categories. • You can now control whether open and click tracking should be used for emails sent by SparkPost. Activity Stream enhancements: • The filter dropdowns now have an "Apply" button for better usability (previously you had to click outside the dropdown). • The "Expanded/Collapsed" toggles are now clearer. • Hitting back from a clicked item in any activity stream now remembers your position and loaded results. Other enhancements and improvements: • The way dates are formatted can now be customised by language strings. For example, if you want to change the date format to "DD-MM-YYYY" that is now possible. With this change, the new default is US-style ("March 4, 1992") rather than the previous European-style ("4 March 1992"). • Advertisements no longer have padding which makes them easier to position in other areas such as headers. • When comparing revisions of articles in Pages databases, a new browser-based diff tool is used which is more user-friendly and moves the computation from the server to the user's browser for greater performance. • Better indication of files pending approval in Downloads. • The version number for themes now displays in the AdminCP list. Also included: 4.1.11 This is a small maintenance release to fix a few issues reported in 4.1.10. In addition to bug fixes and performance improvements, it includes following new/changed features: • Integration with SparkPost replaces Mandrill for optional email service as Mandrill is stopping their current service toward the end of April. • Questions in Question and Answer forums can now be sorted by most votes. • The "All Activity" activity stream now has an RSS feed. • The filter bar at the top of the activity stream no longer sticks to the stop of the screen when scrolling. • If you receive a browser notification your notification menu will now reload to get the latest notification. • More consistent visual feedback when a post submit or edit is processing to reduce duplicates. • Sidebar widgets now how rounded corners to match rest of Suite. • Recaptcha style is now a per-theme setting. • You can now set which theme should be the default for the AdminCP separate to which should be the default for the front-end. Also included: 4.1.10 This is a maintenance release to fix reported issues and add refinement to existing features. In addition to bug fixes and performance improvements, it includes following new/changed features: • Instant notifications are now dismissible. • The sidebar has been added back to the stream pages. • You can now sort by most downloaded in Downloads app. • The ModeratorCP and AdminCP IP Address Tools now allow you to track the IP addresses used to vote in polls. • A new setting has been added to disable the RSS feed for activity streams. • A new setting has been added to specify the minimum display name length. • Adds a new "can unban" moderator permission separate to the "can edit profiles" permission being used previously. • IP addresses now show in reports. • There is now a constant-level setting to disable the ACP IP address check in case of being locked out of the ACP. • Several improvements to Commerce to make some features clearer: the Shipping Rates configuration pages now indicate to the admin if a potential mistake has been made, the front-end indicates to admins if no support departments have been set up, and the renewal settings wording has been clarified. Also included: 4.1.9 This release fixes reported issues from clients in our bug tracker and support tickets and adds refinement to existing features. New or Changed Features • When your link auto-embeds in a post such as with an image, YouTube video, Twitter link, etc. an option will now display to revert the embed back to a plain text link if you do not want the embed. • New setting to disable embedding. • Facebook/Twitter integration improvements • If you are an administrator and encounter a system error, additional debug output will now display. Regular members will see the normal error message. • Custom Fields for Support Requests in Commerce now show on the front-end. • If an advertisement is set up with a main image, but not smaller images for tablets/mobiles, the ad would not show at all on tablets/mobiles. This has changed so the main image will display on all devices unless smaller images are provided. • Topics scheduled to automatically lock or unlock will now reflect this in the topic listing and when viewing the topic. • Placing a link to a Facebook status will embed when possible. • When viewing a report, the container (for example, the forum) the content is from is displayed. • Three character searches are now allowed in the Admin CP Live Search. • The Account Settings page now uses vertical rather than horizontal tabs to prevent overflow. • If Gravatar is enabled, and a user has not defined an profile photo, then their email address will be used to fetch from Gravatar unless explicitly set not to. • Gfycat embeds now use their oEmbed endpoint rather than their JS API. • Using Amazon CloudFront as https provider will now be recognized as valid secure connection. • The member REST API endpoint will now return custom fields. • The Developer Center for Plugins now shows the filename in the list of hooks, and when editing a hook, a breadcrumb includes a link back to the list. • Inline notifications can now be dismissed • Efficiency improvements to the search index • You can now close a poll independently of the topic
    1 point
  3. dmob, Glad you like the new additions. I might steal that "drop-down on edit" idea, using the second parameter of _GUIListViewEx_SetEditStatus (currently True/False for readonly state when setting as a combo) along these lines: 0 - Standard combo 1 - Readonly combo +2 - Dropdown on edit That way the user can choose whether it happens. Let me have a play and see what I can do. M23 Edit: Works a treat - reloaded the Beta code yet again. Thanks for that suggestion.
    1 point
  4. You also might try the API $mytext = "Hello world. " & @crlf & "This is a test" $from = "en" $to = "ru" $url = "https://translate.googleapis.com/translate_a/single?client=gtx" $url &= "&sl=" & $from & "&tl=" & $to & "&dt=t&q=" & $mytext $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("POST", $url, False) $oHTTP.Send() $sData = $oHTTP.ResponseText Msgbox(0,"raw data", $sData) $sData = StringRegExpReplace($sData, '.*?\["(.*?)"[^\[]*', "$1" & @crlf) Msgbox(0,"output", $sData)
    1 point
  5. I knew you could make it work. I dont know if you need all the includes. Almost the same as yours: #include "UIAWrappers.au3" #AutoIt3Wrapper_UseX64=Y ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os _UIA_setVar("Global.Debug", False) _UIA_setVar("Global.Debug.File", False) _UIA_setVar("Global.Highlight", False) If Not ProcessExists("chrome.exe") Then Run("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") ProcessWait("chrome.exe") Sleep(3000) EndIf MsgBox(0, "", _getaddressbar()) Func _getaddressbar() Local $oChrome, $oChromeAddressBar, $oValueP, $sURL $oChrome = _UIA_getFirstObjectOfElement($UIA_oDesktop, "class:=Chrome_WidgetWin_1", $treescope_children) If Not IsObj($oChrome) Then Exit ConsoleWrite("Error in $oChrome" & @CRLF) $oChromeAddressBar = _UIA_getFirstObjectOfElement($oChrome, "controltype:=" & $UIA_EditControlTypeId , $treescope_subtree) If Not IsObj($oChromeAddressBar) Then Exit ConsoleWrite("Error in $oChromeAddressBar" & @CRLF) $oValueP = _UIA_getpattern($oChromeAddressBar, $UIA_ValuePatternId) If Not IsObj($oValueP) Then Exit ConsoleWrite("Error in $oValueP" & @CRLF) $sURL = "" $oValueP.CurrentValue($sURL) Return $sURL EndFunc Exit To stop the logs, go to the "UIAWrappers.au3" file and comment the 2 functions like this: (line 1570 and 1583) func _UIA_LogFile($strName="log.xml", $reset=false) ;~ if $reset=true Then ;~ $__g_hFileLog=fileopen($strName, $FO_OVERWRITE + $FO_UTF8) ;~ filewrite($__g_hFileLog,"<?xml version=""1.0"" encoding=""UTF-8""?>") ;~ filewrite($__g_hFileLog,"<log space=""preserve"">") ;~ ;;~ filewrite($__g_hFileLog,"<!DOCTYPE html><html><body>") ;~ ;;~ filewrite($__g_hFileLog,"<h1>UIA logging</h1>") ;~ Else ;~ $__g_hFileLog=fileopen($strName,$FO_APPEND + $FO_UTF8) ;~ EndIf EndFunc func _UIA_LogFileClose() ;~ ;;~ filewrite($__g_hFileLog,"</body></html>") ;~ filewrite($__g_hFileLog,"</log>" & @CRLF) ;~ fileclose($__g_hFileLog) EndFunc This will stop the log file, if you need it back just take the comment off. I dont know why the log dont stop after the "_UIA_setVar("Global.Debug.File", False)". I will try to look this later.
    1 point
  6. Yeah...lot of it is fixed in the next update! I will release it soon.. (Hope in the next week!) About the author of the project log: This is allready possible. Just go in your project settings -> Changelog. There it is!
    1 point
  7. Hi all, A really good day: won my golf match this morning, flew 3 times this afternoon and this evening coded another functionality for this UDF - you can now define a user sort function to use when ordering the ListView columns. Here is an example script which shows yesterday's header resize disable and user function for edit, plus today's user function for sort functionalities - look at the difference when sorting column 2 compared to the others: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> ; Just for display in example Global $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Beta Example", 500, 360) ; Create ListView $cListView = GUICtrlCreateListView("Tom|Dick|Harry", 10, 10, 480, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cListView,$LVS_EX_FULLROWSELECT ) _GUICtrlListView_SetColumnWidth($cListView, 0, 150) _GUICtrlListView_SetColumnWidth($cListView, 1, 150) _GUICtrlListView_SetColumnWidth($cListView, 2, 150) ; Create array and fill Left listview Global $aLV_List[15] For $i = 0 To 14 $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i GUICtrlCreateListViewItem("Tom " & $i & "|Dick " & $i & "|Harry " & $i, $cListView) Next ; Initiate LVEx - use filling array - no count parameter - default insert mark colour (black) - drag image - sortable + not select all text $iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List, 0, Default, Default, 1) ; Column 0 & 2 editable using user function _GUIListViewEx_SetEditStatus($iLV_Index, "0;2", 9, _UserFunction) ; Here we set both columns to use the user-defined function below <<<<<<<<<<<<<<<<<<<<<<<<<<< ; Set header data for edit - Col 0 uses an edit and cannot be resized ; Col 1 is not editable as column itself is not editable and can be resized ; Col 2 uses a combo and can be resized Local $aHdrData[][] = [["", "", ""], _ ["", "", ""], _ ["", "", "New 1|New 2|New 3"], _ [1, 0, 0]] ; Here is where the column resizing is set <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $iRet = _GUIListViewEx_LoadHdrData($iLV_Index, $aHdrData) ; This function initiates tooltips when items in col 0 are clicked as any path is likely to be too wide to fully display _GUIListViewEx_ToolTipInit($iLV_Index, "0") ; Use user sort function when sorting <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $iRet = _GUIListViewEx_UserSort(_UserSortFunction) $cDisplay_Button = GUICtrlCreateButton("Show content", 10, 320, 230, 30) $cExit_Button = GUICtrlCreateButton("Exit", 260, 320, 230, 30) ; Register for sorting, dragging and editing _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cDisplay_Button $aLV_List = _GUIListViewEx_ReturnArray($iLV_Index) If Not @error Then _ArrayDisplay($aLV_List, "Returned Left") Else MsgBox(0, "Left", "Empty Array") EndIf EndSwitch ; This function must be in the idle loop to anable editing of any kind $vRet = _GUIListViewEx_EditOnClick() ; Save error value Local $iError = @error ; If column edited by user function then $vret reflect return values from that function ; If column editable in modes 1-3 (internal UDF editing) then an array of edited items returned ; If no edits occurred then function returns empty string - so check array exists before viewing If IsArray($vRet) Then ; Uncomment to see returned array ;_ArrayDisplay($vRet, @error) ElseIf $vRet <> "" Then ; Uncomment to see returned values ;ConsoleWrite($vRet & " - " & $iError & " - " & @extended & @CRLF) EndIf ; This function enables the tooltips when cols 0 & 2 are clicked as the path is likely to be too wide to fully display _GUIListViewEx_ToolTipShow() WEnd ; User function must take 4 parameters - no more, no less ; ListView handle, ListView UDF index, Row clicked, Column clicked Func _UserFunction($hLV, $iIndex, $iRow, $iCol) ; Then depending on the column clicked Switch $iCol Case 0 ; Col 0 accepts an .au3 file $sRet = FileOpenDialog("Choose a file", "", "Files(*.au3)", 0, "", $hLV) If $sRet Then $aContent = _GUIListViewEx_ChangeItem($iIndex, $iRow, $iCol, $sRet) EndIf Case 2 ; Col 2 accepts a folder $sRet = FileSelectFolder("Choose a folder", "", 0, "", $hLV) If $sRet Then $aContent = _GUIListViewEx_ChangeItem($iIndex, $iRow, $iCol, $sRet) EndIf EndSwitch Return 1 EndFunc ; User sort function must take 5 parameters - no more no less - which match those used by _ArraySort ; ByRef array, Descending variable, Start (usually 1), End (usually 0, so need to convert to max index), Column to sort Func _UserSortFunction(ByRef $aArray, $vDescending, $iStart, $iEnd, $iCol) Switch $iCol Case 0, 1 ; Standard sort for columns 0 & 1 _ArraySort($aArray, $vDescending, $iStart, $iEnd, $iCol) Case 2 ; This column is sorted numerically on the numeric part of the content If $iEnd = 0 Then $iEnd = UBound($aArray) - 1 _ArrayColInsert($aArray, 0) For $i = $iStart To $iEnd $aArray[$i][0] = Number(StringRegExpReplace($aArray[$i][$iCol + 1], "^.\D+(\d+)$", "$1")) Next _ArraySort($aArray, $vDescending, $iStart, $iEnd, 0) _ArrayColDelete($aArray, 0) EndSwitch EndFunc And here is the Beta UDF required to run it: I also fixed a couple of small bugs in the previous Beta code while I was at it...... All comments welcome. M23 Edit: Added an "auto dropdown" option when using combos to edit - change the _SetEditStatus lines in the example to this to see the effect: _GUIListViewEx_SetEditStatus($iLV_Index, "0", 2, "1|2|3", 0) ; Normal combo _GUIListViewEx_SetEditStatus($iLV_Index, "1", 2, "1|2|3", 1) ; Read only combo _GUIListViewEx_SetEditStatus($iLV_Index, "2", 2, "1|2|3", 0 + 2) ; Normal combo with auto dropdown
    1 point
  8. A smart compiler can optimise memory storage better if it knows in advance that a particular subset of variables will not ever be resized. This can reduce fragmentation of virtual memory.
    1 point
  9. If that's the actual code being used then something went wrong with your copy and paste i think. The character set for $aB128 doesn't match what was originally posted. Make sure you download the .au3 file posted when doing your tests. ±n8M:¶BF°n´S%Py]_½;UµPxEbx=:@P§[[n)w% bad49c8aa9505e47ee6176feb1ec1aa9 **Test Passed**
    1 point
  10. water

    Creating new excel file

    What is the value of @error after you have called #include <Excel.au3> Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookNew($oExcelTest, 5) Global $sWorkbook = @ScriptDir & "\testFile.xlsx" _Excel_BookSaveAs($oWorkbook, $sWorkbook, $xlWorkbookDefault, True)
    1 point
×
×
  • Create New...