Leaderboard
Popular Content
Showing content with the highest reputation on 07/14/2014 in all areas
-
So if you haven't noticed Zedna's Resources UDF has been a very popular UDF over the last 7 years and was last updated in 2011, but now is the time to bring the UDF up to date with the current AutoIt language syntax (v3.3.14.2). So with the blessing of Zedna may I present to you ResourcesEx. It's built using the UDF standards I have tried to enforce around here, with improved documentation and an overall UDF structure. I please ask that you try and break the UDF, criticise, educate, whatever, just play around with the functions and example. I do ask that you just don't say "you've missed the point" and leave at that. Provide an alternative or constructive reason as to why I have "missed the point". Thanks. IMPORTANT: You must be using SciTE4AutoIt3, as this comes included with AutoItWrapper Changes between Zedna's UDF and guinness' UDF. _ResourceGet() => _Resource_Get() _ResourceGetAsString() => _Resource_GetAsString() with an additional param of whether to return ANSI. _ResourceGetAsStringW() => _Resource_GetAsString() _ResourceGetAsBytes() => _Resource_GetAsBytes() _ResourceGetAsImage() => _Resource_GetAsImage() _ResourceGetAsBitmap() => _Resource_GetAsBitmap() _ResourceSaveToFile() => _Resource_SaveToFile() _ResourceSetImageToCtrl() => _Resource_SetToCtrlID() _SetBitmapToCtrl() => _Resource_SetBitmapToCtrlID() As to JFX's question of what makes this different... Known problems/limitations: (Taken for Zedna's Resources UDF) _ResourceGet() returns resource size (in bytes) in @extended macro but not for resource type RT_BITMAP [FIXED] _ResourceSetImageToCtrl() works with "static/button" type of controls (picture,label,icon,button,checkbox,radiobutton,groupbox) [NO_ISSUE] _ResourcePlaySound() plays only WAV files (not MP3 files) [FIXED] _ResourceGetAsBytes() doesn't work for RT_BITMAP type because _ResourceGet() returns hBitmap instead of memory pointer in this case there could be used _ResourceGetAsImage() as workaround _ResourceGet() has potential memory leak releasing of resources UnlockResource, FreeResource (opposite of LoadResource, LockResource) is not done because it must be done after using of resources at the end and not inside UDF [FIXED] _GDIPlus_Startup() is called once at start of whole include --> no _GDIPlus_Shutdown() is called [FIXED] Download the ZIP and play around with the Example/UDF. ResourcesEx.zip Jos: 15-9-2022 Updated version replaced $__WINVER with _WinAPI_GetVersion() Jos: 27-4-2023 updated script as they required extra #include: ResourcesEx.zip Changelog: 2015/09/26 Changed: Comments throughout the UDF, removing trailing dot Fixed: Various cosmetic changes 2015/01/12 Fixed: Example directive using double equals sign Fixed: Delete functions not being cast as a bool value. (Thanks Synix) Fixed: @error and @extended not be passed back in nested functions e.g. _Resource_GetAsRaw() 2014/07/19 Added: _Resource_SetBitmapToCtrlID() formely known as _Resource_SetImageToCtrlID() Added: Note about using #AutoIt3Wrapper_Res_Icon_Add to the example. (Thanks Zedna) Added: Passing a blank string to _Resource_SetToCtrlID() through the $sResNameOrID parameter, will delete the image and previous handle Changed: _Resource_SetImageToCtrlID() now accepts a hBitmap not a HBITMAP object Fixed: _Resource_GetAsBitmap() now works the same way as _ResourceGetAsBitmap() did, by converting a jpg, png etc... to HBITMAP Fixed: Memory management of some functions 2014/07/18 Fixed: Destroying a cursor Fixed: Regression from loading the current of external module. (Thanks UEZ) 2014/07/17 Added: Additonal checks to destroy cursors and icons Added: Checking if the dll or exe filepath has a valid extension Added: Example of using an icon and image on a button control Fixed: Icons and cursors (finally) being re-sized to a control Fixed: Using GUIGetStyle() on a non-AutoIt handle would cause issue with controls Fixed: Variable naming of $sDLL to $sDllOrExePath for improved clarity Removed: Workaround for setting icons to AutoIt controls 2014/07/17 Added: Commented workaround in the example for re-sizing an icon control Added: ResourcesEx_PE.au3 created by PreExpand for all you constant variable haters out there!!! Fixed: Changelog comments and source code comments Fixed: Re-sizing icons when the control was different to the icon's size. (Thanks czardas for the MSDN link and Jon.) Fixed: Re-sizing cursors and icons in general 2014/07/15 Added: Comments about using SOUND for wav files and RT_RCDATA for mp3 files. (Thanks Melba23) Added: Option to relevant functions to re-size the image based on the control's dimensions. (Requested by kinch: http://www.autoitscript.com/forum/topic/51103-resources-udf/?p=1147525) Added: Using _Resource_LoadFont() example. (Thanks UEZ) Changed: Certain example resources to now use those found in %AUTOITDIR%\Examples\Helpfile\Extras Changed: Constants and enums readability. (Thank mLipok) Changed: Internal functions for destroying resources Changed: Removed changes made from the previous version for loading resources multiple times. The design needs to be re-thought Changed: Setting styles of controls using native AutoIt functions Fixed: Destroying control resource images would fail to show if reinstated again Fixed: Documentation comments Fixed: Missing certain users who helped with creating this UDF Fixed: Outdated SciTE files 2014/07/14: Added: _Resource_GetAsCursor(), for the loading of animated cursors and standard cursors which can then be used with _WinAPI_SetCursor() Added: _Resource_GetAsIcon(), for loading icon resource types Added: _Resource_LoadFont(), which retrieves a font resource and adds to the current memory of the associated module Added: _Resource_SetCursorToCtrlID() and _Resource_SetIconToCtrlID() Added: Additional resource types to destroy on exit, including $RT_FONT, $RT_ICON and $RT_MENU Added: Playing Mp3s to _Resource_LoadSound(). (Thanks to UEZ and Melba23 with changes made by me.) Changed: _Resource_GetAsBitmap() returns a HTBITMAP handle without converting from hBitmap to HBITMAP Changed: _Resource_PlaySound() to _Resource_LoadSound() Changed: _Resource_SetBitmapToCtrlID() to _Resource_SetImageToCtrlID() Changed: _SendMessage() to GUICtrlSendMsg() Changed: Example files Changed: Setting $iError in the internal get function Changed: Signature of _Resource_Destroy() Changed: Updated example to reflect major changes to the ResourcesEx UDF Changed: Various UDF tweaks that I didn't document because I simply couldn't keep track of all the playing around I did in the last week Fixed: _Resource_GetAsImage() not returning an error when a bitmap couldn't be found in the resource table Fixed: Retrieving length of a string Fixed: Using the current module instead of zero in _Resource_LoadSound() Fixed: Various comment changes. (Thanks mLipok) Fixed: Loading resources multiple times. This is fixed thanks to using the internal storage array 2014/07/07: Added: _Resource_Destroy() and _Resource_DestroyAll() to destroy a particular resource name or all resources Added: Checking if the resource name of id value is empty Added: Descriptions, though could do with a little tweaking Changed: _Resource_Get() to _Resource_GetAsRaw() Changed: Internal workings of __Resource_Storage() Changed: Re-size the storage array when destroyed or on shutdown Fixed: _Resource_GetAsString() with default encoding of ANSI Fixed: Calltips API referencing Resources.au3 and not ResourcesEx.au3 Removed: _Resource_Shudown() due to the addition of _Resource_Destroy() and _Resource_DestroyAll() 2014/07/06: Added: _Resource_Shudown() to free up those resources which aren't loaded using _WinAPI_LockResource(). UnlockResource is obsolete Added: Support for using $RT_STRING Changed: _Resource_GetAsString() now works correctly for most encodings. (Thanks Jos) Changed: _Resource_GetAsString() will now load as a string if the resource type requested is $RT_STRING 2014/07/04: Added: #Regions. (Thanks mLipok) Added: #Tidy_Parameters=/sort_funcs /reel (Thanks mLipok) Added: All optional params now accept the default keyword Added: Link to this thread. (Thanks mLipok) Added: Main header. (Thanks mLipok) Changed: $f.... >> $b..... (Thanks mLipok) 2014/07/03: Initial release1 point
-
GetCommonStartups v3.07
232showtime reacted to ripdad for a topic
GetCommonStartups v3.00 Initial Release: September 17, 2012 Last Updated: July 29, 2014 Current Version: 3.07 What is it? It had a very humble beginning with some minimal coding to display Run Keys and their values in the registry. Since then, it has grown into a tool that I use to trouble-shoot computers. Credits and Updates: This script must be compiled 64Bit if used on a 64Bit OS. Download Version 3.07 GetCommonStartups_v3.07.zip Please let me know if you have any issues or complaints.1 point -
Sort files by type?
richietheprogrammer reacted to mikell for a topic
You should have a look at the helpfile before asking First try this $aFileList = _FileListToArray(@DesktopDir, '*', 1, 1) Then try _FileListToArrayRec() with the needed params1 point -
Sort files by type?
richietheprogrammer reacted to AZJIO for a topic
#include <File.au3> #include <Array.au3> $aFileList = _FileListToArray(@DesktopDir, '*', 1) ; $aFileList =_FileListToArray(@HomeDrive, '*', 1) If @error Then Exit MsgBox(0, "", '@error = ' & @error) Local $aFileList_2D[$aFileList[0] + 1][2] For $i = 1 To $aFileList[0] $aFileList_2D[$i][0] = $aFileList[$i] $aFileList_2D[$i][1] = StringRegExpReplace($aFileList[$i], '^(?:.+?)(?:\.([^.\\]+))?$', '\1') Next ; _ArrayDisplay($aFileList_2D,"$aFileList_2D") _ArraySort($aFileList_2D, 0, 1, 0, 1) For $i = 1 To $aFileList[0] $aFileList[$i] = $aFileList_2D[$i][0] Next _ArrayDisplay($aFileList, "$aFileList")1 point -
FileWriteLine automatically adds the @CRLF to every line you write with it. It's in the help file. If you want to combine the lines into one, you should only write it after you've combined the text and then write it once instead of every line.1 point
-
GetCommonStartups v3.07
232showtime reacted to ripdad for a topic
232showtime, Quote: This script must be compiled 64Bit if used on a 64Bit OS.1 point -
Need help debugging GUIRichEdit.au3 statements
BrewManNH reacted to Richard Robertson for a topic
Yeah. Ternary is actually intuitive. Read it as question ? yes : no1 point -
czardas, I would really advise that you put your efforts into complaining about those UDF authors who use unnecessary Global variables instead of Global constants. PreExpand has show it's relatively simple to reduce code into an unreadable state, which is why I feel it's time you moved on. Remember pre-optimisation is the root of all evil. Edit: I have spent the best part of 30 mins modifying examples in the help file due to adding $STM_GETIMAGE and $STM_SETIMAGE. This is not because I enjoy annoying the community of old AutoIt programmers, but because I want to improve AutoIt's reputation and improve standards.1 point
-
Thanks, BrewManNH. It now makes sense. I guess the time to debate 'ternaries' has passed ... but it's sad to see the cryptic quality they inject into what is otherwise a refreshingly forthright and readable language. Anyway, the problem I'm chasing appears to be related to the EM_STREAMIN message calls. I'm streaming rich content from a variable and I'm getting a "transformed" result ... the biggest problem of which is the insertion of an unwanted/unneeded font, MS Shell Dlg. I've attached an example, if anyone happens to have ideas. I'm testing alternative methods.1 point