Jump to content

Recommended Posts

Posted

Hallo everyone,

I find this UDF very interesting as I hate to FileInstall my pictures for the GUI
(it is untidy)

But I have one, probably silly, question:
I am a terrible bad programmer and therefore I have to test my scripts a lot.
If I use this UDF and press at Scite F5 it does not work, only if I compile it.
This is intended, but compiling every time just to check if the picture in my
GUI is in the right place is a pain in the ass...
Is there an easy way to make this UDF change its behavior, like if compiled include
the files and if not just use normal picture as a resource?

 

Posted

You cannot change this UDF to behave the way you want because as you already mentioned it uses the attached resources in an exe to load and display.

 

An alternative way: http://www.autoitscript.com/forum/topic/165285-generate-image-within-compiled-script/?do=findComment&comment=1206538

 

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

Thats too bad.

Well in the example there is a "If @Compiled Then" switch.
Wouldn't if be possible to use such thing in the udf and if not compiled load pics directly?

But then again if it behaves just a bit different then the compiled version it would cause more harm...

  • 2 weeks later...
Posted
  On 5/8/2015 at 10:22 AM, VenusProject2 said:

Hello I came across a possible syntax inconsistency in ResourcesEx.au3

OnAutoItExitRegister(_GDIPlus_Shutdown)
OnAutoItExitRegister(_Resource_DestroyAll)

The help file says:

Syntax Example => OnAutoItExitRegister ( "function" )

So shouldn't the above code be:

OnAutoItExitRegister("_GDIPlus_Shutdown")
OnAutoItExitRegister("_Resource_DestroyAll")

My apologies if I missed something...:ermm:

​In my experience adlib reg/unreg do this too, i think its intentional.

What is what? What is what.

Posted

Both are fine as of v3.3.10.0+, as functions are now like first class objects. Search DevChat for a ton of examples Mat and I have wrote about this subject.

Verdict: No Bug

 

 

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • 2 weeks later...
Posted

Cant get ayn1 data at rt_rcdata

Whats reason ?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Res_File_Add=binary_1.dat, RT_RCDATA, BIN_1, 0
#AutoIt3Wrapper_Res_File_Add=text_1.txt, RT_RCDATA, TXT_1, 0
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; Binary/text resources.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include '..\ResourcesEx.au3' ; Improved by guinness.
Global $AString
$AString = _Resource_GetAsString('TXT_1')

MsgBox(0,0,$AString)
;~ MsgBox(0,0,_Resource_GetAsBytes("BIN_1"))
;~  _Resource_SaveToFile(@ScriptDir & '\binary_1.dat', 0, 0, @ScriptDir)

Im getting NULL data on msgbox

 

  • 1 month later...
Posted (edited)

Hello,

Sorry for my verry poor english...

When i try to use this UDF, it's seem running well, but _Resource_SetToCtrlID() return False and @Error = 13.

Where is my mistake please ?

 

#AutoIt3Wrapper_Res_File_Add=Avatar_poker.jpg, RT_RCDATA, JPG_1, 0
#include <GUIConstantsEx.au3>
#include "ResourcesEx.au3"
If Not @Compiled Then
    MsgBox(16, @ScriptName, "IDIOT TopXm, it's only running with a compiled script !!!!")
    Exit
EndIf
Global $hGUI = GUICreate('Halte aux FileInstall ! Vive les ressources', 600, 250)
GUISetFont(11, 600, 0, "Philosophe")
Global $iPic = GUICtrlCreatePic('', 10, 10, 160, 121)
Global $iMsg = GUICtrlCreateLabel('', 10, 140, 460, 100)
GUICtrlSetColor($iMsg, 0x0000FF)
If Not _Resource_SetToCtrlID($iPic, 'JPG_1') Then
    GUICtrlSetData($iMsg, '[_Resource_SetToCtrlID] Fatal Error : ' & @error & _
                            @CRLF & '@Extended : ' & @extended & @CRLF & '$iPic  : ' & $iPic)
EndIf
GUISetState(@SW_SHOW)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
_Unload()
Func _Unload()
    _Resource_DestroyAll()
    GUIDelete($hGUI)
    Exit
EndFunc
  Reveal hidden contents

1435635452.png

 

Edited by TopXm
  • 2 weeks later...
Posted (edited)

Hi,

Add fullpath to your image #AutoIt3Wrapper_Res_File_Add=Drive:\Folders\Avatar_poker.jpg, RT_RCDATA, JPG_1 and remove the ,0

Place the following under $iPic = GUICtrlCreatePic('', 10, 10, 160, 121)

 _Resource_SetToCtrlID($iPic , " JPG_1")

 

Try again,

Best regards,

 

Emiel

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Posted

Thanks for helping @Emiel Wieldraaijer

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • 2 months later...
Posted

Updated the UDF with minor changes, though they are only minor. Basically just wanted to show that I haven't forgotten about this UDF entirely.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • 1 month later...
Posted

Use Au3Wrapper by Jos

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Did you try this:

  On 11/2/2015 at 6:19 PM, guinness said:

Use Au3Wrapper by Jos

 

?

 

 

 

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Look at my signature for adding resources i.e. Resource Update, there you get an idea (hopefully)!

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • 1 month later...
Posted

I tried to keep it simple, thats why it is rather short.

#AutoIt3Wrapper_Res_File_Add=logo.jpg, rt_rcdata, TEST_JPG_1

#include "ResourcesEx.au3"

$gui = GUICreate("Simple example",441,137)
$pic1 = GUICtrlCreatePic("",0,0,441,137)
_Resource_SetToCtrlID($pic1, "TEST_JPG_1") ; set JPG image to picture control from resource
GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

The image is there if I compile with:

$pic1 = GUICtrlCreatePic("logo.jpg",0,0,441,137)

After compiling I deleted the image at the impression that it is compiled into the .exe file. But the space is for the image is empty.

I compile it with F7 and using AutoIt 3.3.12.0

Any help is appreciated.

  • 3 weeks later...
Posted

This is a very great UDF, I'm just missing a few things,

I'd like to encrypt the resources, I saw someone did in in another modified version of zednas udf: https://www.autoitscript.com/forum/topic/132160-zedna-resources-udf-encrypt-decrypt/

 

Another thing i'm missing is regarding this function: 

_Resource_GetAsString

It can't read binary files, ex. a msi file. 

Would be nice if it could be done with the fileopen attributes, like: _Resource_GetAsString("file",16)

Posted (edited)

You can do this without modifying the UDF. Think a little bit about it and good luck.

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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