Jump to content

Recommended Posts

Posted (edited)

I've never used resource files so i don't no what to look for, but when i open the file in ResHack it showed a folder tree

In that case it may be better to use FileInstall() instead of my Resource UDF.  It's very simple.

Latest Scite4Autoit3 beta has new simpler syntax for adding resources (#AutoIt3Wrapper_Res_File_Add=) and it doesn't need reshacker.exe.

After Jos push it from beta to release state I will update my UDF and description accordingly.

Edited by Zedna
Posted

Well I downloaded the beta version, and no I got the file into the resource file. But it still don't show up, but i guess it's a bit closer!

Posted

That shouldn't be necessary.

#AutoIt3Wrapper_Res_File_Add=C:\path\to\file.ext,RT_RCDATA,MYRESOURCENAME

should work just fine.

I don't know why, but when i changed from RT_RCDATA to 10 it worked fine, but before it didn't

  • Moderators
Posted (edited)

PhilipG,

You need to use $RC_DATA, which is a Const value AutoIt understands. Of course, using the actual value of 10 also works as you found. :D

#AutoIt3Wrapper_Res_File_Add=C:\path\to\file.ext,$RT_RCDATA,MYRESOURCENAME

M23

Edit: Ignore all this - see below

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Developers
Posted (edited)

PhilipG,

You need to use $RC_DATA, which is a Const value AutoIt understands. Of course, using the actual value of 10 also works as you found. :D

#AutoIt3Wrapper_Res_File_Add=C:\path\to\file.ext,$RT_RCDATA,MYRESOURCENAME

M23

Don't think AutoIt3Wrapper will understand a variable. :huggles:

RT_RCDATA is a known sting.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

What he said :D AI3Wrapper reads the directive as a string, so it looks for "RT_RCDATA". Yes it also understands integers, which is why 10 works, but there's no reason the string value shouldn't work either. And as I've tested it myself... well, it works. Trying to use an AutoIt variable is useless since these are preprocessor directives and know nothing of the AutoIt script.

What version of AutoIt3Wrapper are you testing and where did you get it from? In some earlier builds I hadn't coded the string recognition yet, but those were private alphas.

Edited by wraithdu
Posted

Zedna, in your UDF I found a small bug related to memory leaks when using the _SetBitmapToCtrl(). After reading that, I corrected it.

Func _SetBitmapToCtrl($CtrlId, $hBitmap)

    Local Const $STM_SETIMAGE = 0x0172
    Local Const $STM_GETIMAGE = 0x0173
    Local Const $IMAGE_BITMAP = 0
    Local Const $SS_BITMAP = 0x0E
    Local Const $GWL_STYLE = -16

    Local $hWnd, $hPrev, $Style

    $hWnd = GUICtrlGetHandle($CtrlId)
    If $hWnd = 0 Then
        Return SetError(1, 0, 0)
    EndIf
    $Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
    If @error Then
        Return SetError(2, 0, 0)
    EndIf
    _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitOR($Style, $SS_BITMAP))
    If @error Then
        Return SetError(3, 0, 0)
    EndIf
    $hPrev = _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, 0)
    If $hPrev Then
        _WinAPI_DeleteObject($hPrev)
    EndIf
    _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)
    If @error Then
        Return SetError(4, 0, 0)
    EndIf
    $hPrev = _SendMessage($hWnd, $STM_GETIMAGE, $IMAGE_BITMAP, 0)
    If (@error) Or ($hBitmap = $hPrev) Then
        $hBitmap = 0
    EndIf
    If $hBitmap Then
        _WinAPI_DeleteObject($hBitmap)
    EndIf

    Return 1
EndFunc   ;==>_SetBitmapToCtrl

With this version doesn't work correctly my example from first post using animated GIFs resource_test_ani_gif.au3

so I will stick with my old version:

...

    $hPrev  = _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)
    If @error Then Return SetError(3, 0, 0)
    If $hPrev Then _WinAPI_DeleteObject($hPrev)
Posted (edited)

Updated first post:

2010-02-12
- all examples now use fixed #AutoIt3Wrapper_Res_File_Add directive from latest Scite4Autoit3 (no need for ResHacker.exe)
- added support for buttons (also checkboxes,radiobuttons,groupboxes) in _ResourceSetImageToCtrl()/_SetBitmapToCtrl() thanks Melba

EDIT: Also renamed title of this topic ;-)

Edited by Zedna
Posted (edited)

Just one note to adding data to resources by AutoIt3Wrapper directive:

#AutoIt3Wrapper_Res_File_Add=FileName, ResType, ResName

According to AutoIt3Wrapper sources - as ResType can be used these (case insensitive):

Local $aRESOURCE_TYPES[24] = _
["RT_CURSOR", "RT_BITMAP", "RT_ICON", "RT_MENU", "RT_DIALOG", "RT_STRING", "RT_FONTDIR", "RT_FONT", "RT_ACCELERATOR", _
 "RT_RCDATA", "RT_MESSAGETABLE", "RT_GROUPCURSOR", "", "RT_GROUPICON", "", "RT_VERSION", "RT_DLGINCLUDE", "", "RT_PLUGPLAY", _
 "RT_VXD", "RT_ANICURSOR", "RT_ANIICON", "RT_HTML", "RT_MANIFEST"]
Edited by Zedna
  • 1 month later...
Posted

For those who use the full version of SciTe and wish for the following commands to show in the command popup box, I have created entries for <au3.user.calltips.api> and <au3.userudfs.properties> (Located in the api and properties folders)

Add the following to <au3.user.calltips.api>

_ResourceGet($ResName [, $ResType [, $ResLang [, $DLL]]]) Get from Resource (as a pointer) (Requires: #Include <Resources.au3>)
_ResourceGetAsBitmap($ResName [, $ResType [, $DLL]]) Get from Resource as a Bitmap Image (Requires: #Include <Resources.au3>)
_ResourceGetAsBytes($ResName [, $ResType [, $ResLang [, $DLL]]]) Return bytes of Resource (Requires: #Include <Resources.au3>)
_ResourceGetAsImage($ResName [, $ResType [, $DLL]]) Get Picture from Resource as hImage type (Requires: #Include <Resources.au3>)
_ResourceGetAsString($ResName [, $ResType [, $ResLang [, $DLL]]]) Get String from Resource (Requires: #Include <Resources.au3>) 
_ResourceGetAsStringW($ResName [, $ResType [, $ResLang [, $DLL]]]) Get String from Resource (Unicode) (Requires: #Include <Resources.au3>)
_ResourcePlaySound($ResName [, $Flag [, $DLL]]) Play Sound from Resource (Requires: #Include <Resources.au3>)
_ResourceSaveToFile($FileName, $ResName [, $ResType [, $ResLang [, $CreatePath [, $DLL]]]]) Save Resource to File (Requires: #Include <Resources.au3>)
_ResourceSetImageToCtrl($CtrlId, $ResName [, $ResType [, $DLL]]) Set Image to picture control from Resource (Requires: #Include <Resources.au3>)
_SetBitmapToCtrl($CtrlId, $hBitmap) Set Bitmap to a Control (Requires: #Include <Resources.au3>)

Add the following to <au3.userudfs.properties>

au3.keywords.user.udfs=_resourceget _resourcegetasbitmap _resourcegetasbytes _resourcegetasimage _resourcegetasstring \
    _resourcegetasstringw _resourceplaysound _resourcesavetofile _resourcesetimagetoctrl _setbitmaptoctrl \

The UDF is very helpful...Thanks!

-Please edit and re-post if you find any inconsistencies (the descriptions might need changing)

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted (edited)

For those who use the full version of SciTe and wish for the following commands to show in the command popup box, I have created entries for <au3.user.calltips.api> and <au3.userudfs.properties> (Located in the api and properties folders)

...

Thanks! That's very good idea.

Later I will definitely test it and add it to my first post and to UDF itself.

EDIT: What is purpose of <au3.userudfs.properties>?

Edited by Zedna
Posted

What is purpose of <au3.userudfs.properties>?

From what I can gather au3.userudfs.properties is called when you first type the function into SciTe for the initial search and then au3.user.calltips.api is called when you are being more specific to the values of the proposed function.

And I think that the separation from the official au3.api and au3.keywords.properties is useful because I can update SciTe and simply re-copy au3.userudfs.properties & au3.user.calltips.api again.

I got the idea from WinAPIEx and it seemed to work, so I thought I would contribute to the forum.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

  • Moderators
Posted

Zedna,

What is purpose of <au3.userudfs.properties>?

I seem to remember that Jos added it last year to prevent user-created UDF abbreviations being overwritten when you updated SciTE. The format of the file is identical to the normal properties files and once created it comes up in the SciTE <Options> menu like all the others. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • 3 weeks later...
Posted (edited)

I have strange problem when I try use recources.au3.

Line 8 (File... resources.au3)
Global Const $RT_CURSOR = 1
Global Const ^ERROR

Error: Can not redeclare a constant.

Even if I Comment string with

$RT_CURSOR = 1
this error exists, but with line number 9 and
Global Const $RT_BITMAP = 2
Edited by VitAl2013
Posted (edited)

I have strange problem when I try use recources.au3.

Line 8 (File... resources.au3)
Global Const $RT_CURSOR = 1
Global Const ^ERROR

Error: Can not redeclare a constant.

You use another include (or UDF) where these constants are declared too.

Just comment global constants (declared in both of them) in one of these includes.

This is common problem with constants declared in various UDFs

and if you use them together you can easily fix this yourself.

Edited by Zedna

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...