Sign in to follow this  
Followers 0
potitpanda

How to switch between 4 Icons in my script

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yes, i have seen the example but I Don't understand it ...

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

OKay but i have problem which number is calling Which Icon with this little command ???

I have already tested this, with -5 to 5 range and my resource icons doesn't appear.....

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks A Lot

This is Solved !

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