Jump to content

How to switch between 4 Icons in my script


Recommended Posts

I have added 4 icons in my script with this method.

#AutoIt3Wrapper_res_Icon_Add=C:\connecting.ico

#AutoIt3Wrapper_res_Icon_Add=C:\connecte.ico

#AutoIt3Wrapper_res_Icon_Add=C:\deconnecte.ico

#AutoIt3Wrapper_res_Icon_Add=C:\screen.ico

How to switch betweenn them ?

Actually I use this method

TraySetIcon(@ScriptDir & "\connecte.ico")

and I want to change it.... in order to use the 4 wrappers.

Link to comment
Share on other sites

  • Developers

Use FileInstall() To install it to the temp dir, and then later use: TraySetIcon("...")!

Nothing wrong with using the ICO's from the resources. This example is included in the SciTE4AutoIt3 helpfile:

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

Link to comment
Share on other sites

Hi,

you need to compile it. The icons are stored int your exe.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

#include <ButtonConstants.au3>
#AutoIt3Wrapper_res_Icon_Add=c:\Downloads\Icons\Applications\App001.ico
#AutoIt3Wrapper_res_Icon_Add=c:\Downloads\Icons\Applications\App005.ico
#AutoIt3Wrapper_res_Icon_Add=c:\Downloads\Icons\Applications\App010.ico
#AutoIt3Wrapper_res_Icon_Add=c:\Downloads\Icons\Applications\App015.ico
GUICreate("Demo resource ICO's")
$h_Button1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
GUISetState()
For $x = 4 To 7
    $rc = TraySetIcon(@ScriptFullPath, -$x)
    $rc2 = GUICtrlSetImage($h_Button1, @ScriptFullPath, -$x)
    TrayTip("New ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)
    Sleep(2000)
Next

GUIDelete()

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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