Jump to content

Include icons in compiled script


Jango
 Share

Recommended Posts

Hi,

I'm using the following code add icons to my tray menu:

TraySetIcon($ScriptDir & "\data\tray.ico")
Local $hImg[4]
$hImg[0] = _LoadImage($ScriptDir & "\data\main.ico", $IMAGE_ICON)
$hImg[1] = _LoadImage($ScriptDir & "\data\fp.ico", $IMAGE_ICON)
$hImg[2] = _LoadImage($ScriptDir & "\data\set.ico", $IMAGE_ICON)
$hImg[3] = _LoadImage($ScriptDir & "\data\quit2.ico", $IMAGE_ICON)
_TrayMenuAddIcon($hImg[0], 0)   
_TrayMenuAddIcon($hImg[1], 2)   
_TrayMenuAddIcon($hImg[2], 6)   
_TrayMenuAddIcon($hImg[3], 9)

But is there a way to incude my icons into the compiled script and avoid to use _LoadImage or TraySetIcon ?

Link to comment
Share on other sites

In Scite press Ctrl+F1 and go to Extra Utilities/AutoIt3Wrapper/Adding Icons to the program resources

Here is example from there

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\au3.ico

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype1.ico

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype2.ico

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype3.ico

#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

#include <GUIConstants.au3>

GUICreate("Demo resource ICO's")

$h_Button1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)

GUISetState()

For $x = 0 To 7

   $rc = TraySetIcon(@ScriptFullPath, $x)

   $rc2 = GUICtrlSetImage($h_Button1, @ScriptFullPath, $x)

   If $x < 3 Then

      TrayTip("Default ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)

   Else

      TrayTip("New ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)

   EndIf

   Sleep(2000)

Next

GUIDelete()
Link to comment
Share on other sites

  • Developers

I updated these 2 lines in the example for the next version of the helpfile:

$rc = TraySetIcon(@ScriptFullPath, -$x)
$rc2 = GUICtrlSetImage($h_Button1, @ScriptFullPath, -$x)

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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