Jump to content

Resources UDF


Zedna
 Share

Recommended Posts

Heh, that's awesome :oops: I had no idea you could load an animated cursor from a resource. All the research I did last night made it seem like you had to save it out to a file first. I'm curious if you found somewhere that was documented, or if you just tried it out.

I just tried what I had in my first test script from yesterday and it worked perfectly despite what you said/expected :-)

Great.

Later I will add this example for cursors from resources also to my first post in this topic and to next version of my Resources UDF (despite it don't need my Resources UDF)

EDIT: I hope I will release new version soon ...

Edited by Zedna
Link to comment
Share on other sites

Now I tested this new AutoIt3Wrapper and it works fine with standard cursors (.cur) and also with animated cursors (.ani)

It works fine also with cursors (also animated) from my Windows7.

Here is testing script:

...
; cursors from Win XP
#AutoIt3Wrapper_Res_File_Add=3dsmove.cur, 1, CUR_2
#AutoIt3Wrapper_Res_File_Add=banana.ani, rt_anicursor, ANI_CUR_2

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
...

Just one note: Cursors are loaded/showed correctly also when UPX is used (now sucessfully tested).

So you can comment/remove this line:

#AutoIt3Wrapper_UseUpx=n

to get smaller compiled EXE without any loss of functionality :-)

Edited by Zedna
Link to comment
Share on other sites

Why not use the Keep Resource option of UPX ?

#AutoIt3Wrapper_Run_After=upx.exe --brute --force --compress-icons=0 --keep-resource=ANI "%out%"

Because it's not needed. CUR and ANI resources work fine even when they are compressed by UPX.

In that case you can't see them directly by reshacker.exe but at runtime it works fine.

Edited by Zedna
Link to comment
Share on other sites

Zedna,

Will this be incorporated into the next release of AutoIT ? The current Beta is moving right along and seems fairly close to becoming a release and I was just wondering.

Thanks

WhiteStar

No. I have no current plans about adding it into standard includes

because I'm not satisfied with it (there are some ineficiencies/hacks) and there are many things where I'm not sure about solving problems etc. and I haven't got so many time/will to finish all to the best state.

At current state this UDF is usable (at least for me) with some limitations and I want to release new version with some proposed fixes/changes posted here in this topic - hopefully soon but no ETA.

Link to comment
Share on other sites

  • 2 months later...

What am I doing wrong? The pictures do not show up

#AutoIt3Wrapper_Res_File_Add=C:\scripts\AutoIt\Build_Auto_Installer\Docs\Avistar Logo.jpg, rt_rcdata, logo
#AutoIt3Wrapper_Res_File_Add=C:\scripts\AutoIt\Build_Auto_Installer\Docs\avatar.jpg, rt_rcdata, avatar

#include "resources.au3"

$Image1 = GUICtrlCreatePic("", 115, 145, 179, 41)
_ResourceSetImageToCtrl($Image1, "logo")

$Pic1 = GUICtrlCreatePic("", 27, 35, 90, 60)
_ResourceSetImageToCtrl($Pic1, "avatar")
Edited by robinsiebler
Link to comment
Share on other sites

What am I doing wrong? The pictures do not show up

Try this:

- use image file names without space (with underscore)

- copy images to script directory and in ResFileAdd use just filename without path

- copy resources.au3 into script directory (to exclude problems with bad user defined path)

- do you compile your script with FULL Scite4AutoIt3?

- check by reshacker if images are in compiled output EXE

- your AU3 scipt looks OK

Link to comment
Share on other sites

Ok, II figured out the problem: I have a 2nd form and I placed the #AutoIt3Wrapper_Res_File_Add statement there, but they had to go into the 1st form. Now for the 2nd problem. The images are showing up but they are way larger than the sizes I specified for the controls.

I manually resized the images, but I would like to know if there is an alternate solution.

Edited by robinsiebler
Link to comment
Share on other sites

The images are showing up but they are way larger than the sizes I specified for the controls.

I manually resized the images, but I would like to know if there is an alternate solution.

Search this forum and also this topic. This was asked/answered many times.

As far as I can remember the simple solution should be to use static control's style SS_REALSIZECONTROL (for your picture control) - but I'm not sure because I haven't needed/used this yet.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb760773%28v=vs.85%29.aspx

Link to comment
Share on other sites

Hey Zedna!

Resources UDF is awesome. Thank you very much for that ;)

I've a problem including a .jpg to my script for a GUI.

I want to add the file from an SMB-Share like this:

#AutoIt3Wrapper_Res_File_Add=\\content\shareIT$\GUI\Installlogo.jpg, rt_rcdata, installlogo_1

but it's not working?

Adding the same file by

#AutoIt3Wrapper_Res_File_Add=D:\Installlogo.jpg, rt_rcdata, installlogo_1

works fine.

Comparing the size of the compiled .exe - it's definitively not included in the exe.

Link to comment
Share on other sites

I want to add the file from an SMB-Share like this:

#AutoIt3Wrapper_Res_File_Add=contentshareIT$GUIInstalllogo.jpg, rt_rcdata, installlogo_1

but it's not working?

This has nothing to do with my Resources UDF.

Just add resources normal way from local directory and don't do such unusefull complications.

I can't imagine why you need such nonstandard functionality.

You may look at sources of AutoIt3Wrapper and look how it's implemented #AutoIt3Wrapper_Res_File_Add there and

of course you may make any modifications for your special needs.

AutoIt3Wrapper is part of Scite4AutoIt3:

http://www.autoitscript.com/site/autoit-script-editor/downloads/

EDIT:

Maybe you can use #AutoIt3Wrapper_Run_Before= to copy your icons from net to local before compilation

but I'm not sure if it would work

Edited by Zedna
Link to comment
Share on other sites

Hi to all

and many thanks to Zedna for the UDF resources.

... but I have trouble with your new UDF resources.

Here my problem:

------------------------------------------------------------------------

32Bit program with the new version of UDF resources:

If I use the new version of UDF resources and

I compile a 32Bit program with the parameter

#AutoIt3Wrapper_UseX64=N

only some of the pictures are visible

when I start the program on a Windows 7 32Bit system

only some of the pictures are visible

when I start the program on a Windows 7 64Bit system

The problem with the invisible pictures is on all types of grafics.

------------------------------------------------------------------------

64Bit program with the new version of UDF resources:

If I use the new version of UDF resources and

I compile a 64Bit program with the parameter

#AutoIt3Wrapper_UseX64=Y

all pictures are visible, everthing is ok

when I start the program on a Windows 7 64Bit system

#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <resources.au3>
#region
#AutoIt3Wrapper_UseX64=N
; the grafic is a 32x32 pixel BMP-File
#AutoIt3Wrapper_Res_File_Add=rot.bmp, rt_bitmap, rot
#endregion
$Form1 = GUICreate("", 800, 600, 0, 0, BitOR($WS_POPUP, $WS_BORDER))
GUISetState(@SW_SHOW)
$j = 1
For $j = 1 to 16
  For $i = 1 to 22
    GUICtrlCreatePic("", (32*$i)-32+($i*3), (32*$j)-32+($j*3), 32, 32)
    _ResourceSetImageToCtrl(-1, "rot", $RT_BITMAP) ; set BMP image to picture control from resource
  Next
Next
MsgBox(0,"","Wait for close")

I'm using AutoIT version 3.3.0.0.

I would be very glad if you could check my example.

If you could find a solution for me I would be very grateful.

Many thanks

Pino

Link to comment
Share on other sites

I tested your example with my bitmap and I could see similar behaviour on my Win7 64bit OS only with old AutoIt 3.2.12.1 (the same for#AutoIt3Wrapper_UseX64=Y/N).

With AutoIt beta 3.3.7.23 which I use as "latest" there is no problem no matter of #AutoIt3Wrapper_UseX64 directive.

Try to use newer (latest) version of AutoIt and Scite4AutoIt3 (and AutoIt3Wrapper which is part of it).

Edited by Zedna
Link to comment
Share on other sites

  • 3 weeks later...

So am I doing something wrong?

I downloaded resources, added the include to the right place and tried to run any of the examples and none of the pictures load in the gui's.

I'm running Win 7 enterprise x32 with AutoitIt 3.3.8.1

Link to comment
Share on other sites

I downloaded resources, added the include to the right place and tried to run any of the examples and none of the pictures load in the gui's.

Check this:

- is installed full Scite4AutoIt3

- do you compile script (by F7) and run compiled EXE

- are images in script directory (at compile time)

- try to use #AutoIt3Wrapper_UseX64=n

- test @error after _ResourceSetImageToCtrl()

- check by ResHacker if output compiled EXE contains desired resources added by #AutoIt3Wrapper_Res_File_Add=...

EDIT:

You can copy content of bottom Output panel from Scite after compilation with detailed LOG

so we can see what's going on at compile time

Edited by Zedna
Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

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