Sign in to follow this  
Followers 0
kris

Quick Question On Gui's With Pictures.

9 posts in this topic

I am new but have been doing basic auto script writing and finally decided to mess around with GUI's.

Anyway, I have pictures that I use for my splash window and my buttons. I understand that the pictures have to be in the same folder as the script/compiled exe. I have about no knowledge on what im going to ask here but I am going to try make it as clear as possible :mellow:

Is there anyway to put the images into the compiled .exe or a seperate file, instead of a zip file containing the compiled script and pictures.

For example I currently have the following setup:

TestGui.exe

Splash.jpg

Button1.bmp

Button2.bmp

Button3.bmp

Here is what I was wondering if its possible:

TestGui.exe

Images.blah

And have the script get the images from the 2nd file or even just have them in the .exe its self.

Any information regarding this topic will be greatly appreciated :)

-Kris :)

Share this post


Link to post
Share on other sites



Alright i'll take a look :) Thanks for the quick reply

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Alright I messed around with it for a bit and I don't have a clue what I am doing but... I used FileInstall and changed the picture to a .dll and have the program view it from the .dll which is awesome, exactly what I wanted. I don't want to have 5-6 different .dll for each pictures so I was wondering if it's possible to put multiple images in a single .dll file? If so... how would I go about doing that - and how would I call the different images. Thanks.

Also I tried that Autoit 1-2-3 program and I kept getting errors on the view demo's/wouldnt let me click Next after answering the first page of questions. Plus- with voice enabled it would just take forever using microsoft sam to talk.

Edited by kris

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i dont know how you used the DLL... and i dont think you can place muiltiple pics in a DLL ( not sure )

on Welcome to Autoit 123... did you register at the top... BEFORE you took the exam????

microsoft sam can be turned OFF at the tray icon

on the errors... did you install SciTE??

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

FileInstall("image1.bmp", @TempDir & "/image1.bmp")
SplashImageOn ( "TEST FILEINSTALL", @TempDir & "/image1.bmp" )
Sleep(5000)
SplashOff()
Exit

A small demo program demostrating the use of FileInstall.

Breakdown (as usual):

FileInstall("image1.bmp", @TempDir & "/image1.bmp")
This Line tells the compilier to pack the file "image1.bmp" into the EXE.

When the exe is run, the file will be extracted from the exe to @TempDir & "/image1.bmp".

SplashImageOn ( "TEST FILEINSTALL", @TempDir & "/image1.bmp" )
Display a Splash image using the extracted file at @TempDir & "/image1.bmp"

Sleep(5000)
Wait for 5 seconds (= 5000 milliseconds)

SplashOff()
Turn off the splash

Exit
Exit the program

Hope this helps

#)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I have and use SciTE - and I really love it.

In Autoit 123 I have registered and I complete all the questions but the next button does not activate.

I got the .dll file infomation from the GUICtrlSetImage online document page.link here

Where if you change the IconID you get a different picture from the shell32.dll

So... I just messed around with InstallFile and did the following:

#include <GUIConstants.au3>

FileInstall("close.bmp", "test.dll")
Opt("GUIOnEventMode", 1)

$ConfigWindow = GUICreate("Options", 350, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEConfig")

$CloseButton = GUICtrlCreateButton("Close",30, 100, 100, 25, $BS_BITMAP)
GUICtrlSetImage (-1, "test.dll")
GUICtrlSetTip(-1, "Click to exit.")
GUICtrlSetOnEvent($CloseButton, "CLOSEConfig")

GUISetState(@SW_SHOW, $ConfigWindow)

While 1
  Sleep(1000)
WEnd

Func CLOSEConfig()
  GUISetState(@SW_HIDE, $ConfigWindow)
  Exit
EndFunc

I didn't post my whole script, I just edited this one to meet the needs of what I am trying to do. Attached is the .bmp used

close.bmp

Edited by kris

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

FileInstall("close.bmp", @TempDir&"\image_close.bmp")
Opt("GUIOnEventMode", 1)

$ConfigWindow = GUICreate("Options", 350, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEConfig")

$CloseButton = GUICtrlCreateButton("Close",30, 100, 100, 25, $BS_BITMAP)
GUICtrlSetImage (-1, @TempDir&"\image_close.bmp")
GUICtrlSetTip(-1, "Click to exit.")
GUICtrlSetOnEvent($CloseButton, "CLOSEConfig")

GUISetState(@SW_SHOW, $ConfigWindow)

While 1
  Sleep(1000)
WEnd

Func CLOSEConfig()
  GUISetState(@SW_HIDE, $ConfigWindow)
  FileDelete(@TempDir&"\image_close.bmp")
  Exit
EndFunc

Ok...

I think you need an explaination of what fileinstall does...

FileInstall("close.bmp", @TempDir&"\image_close.bmp")

When you Compile your script to an .exe, the file, "close.bmp", is included in the exe.

Which means that the exe can be distributed on it's own, without "close.bmp".

When you RUN the exe, the file is extracted to @TempDir&"\image_close.bmp".

When you are going to exit the application, it is recommended you delete the extracted files, like so: FileDelete(@TempDir&"\image_close.bmp")

Next time read EVERYTHING which people have to tell you (this includes the HelpFile) instead of scanning through...

#)

Share this post


Link to post
Share on other sites

DOH. I am very sorry for that - It was late at night here and I must have read that way to fast and skipped a line. Thank you for the help :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0