Jump to content
Sign in to follow this  
potitpanda

Error in compilation of my script Icons not shown

Recommended Posts

potitpanda

Hi

When I compile my script with personnalised Icon, the compilation is OK but my Icon is not appearing

Please Help Me ?

Icons are .ico files

Thanks

PotitPanda

Share this post


Link to post
Share on other sites
potitpanda

Post your source code and your AutoIt version.

Here is my source code

CODE
#include <Constants.au3>

Global Const $lciWM_SYSCommand = 274

Global Const $lciSC_MonitorPower = 61808

Global Const $lciPower_Off = 2

Global Const $lciPower_On = -1

Global $MonitorIsOff = False

HotKeySet("{F11}", "_Monitor_OFF")

HotKeySet("{F10}", "_Monitor_ON")

If @LogonDomain="ADMIN" then

Opt("TrayOnEventMode",1)

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$connectitem = TrayCreateItem("Deconnecter")

TrayItemSetOnEvent(-1,"Deconnecter")

TrayCreateItem("")

$infoitem= TrayCreateItem("Info...")

TrayItemSetOnEvent(-1,"Info")

$exititem = TrayCreateItem("Fermer")

TrayItemSetOnEvent(-1,"ExitScript")

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

TraySetState()

While 1

Sleep(10) ; Idle loop

WEnd

Else

#NoTrayIcon

While 1

Sleep(10) ; Idle loop

WEnd

EndIf

; Functions

Func Connecter()

run("net use \\172.26.0.163\Moliere /user:AD-0133490Y\moliere moliere","",@SW_HIDE)

TrayItemSetText($connectitem, 'Deconnecter')

TrayItemSetOnEvent($connectitem, "Deconnecter")

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

EndFunc

Func ExitScript()

Exit

EndFunc

Func Deconnecter()

Run("net use /delete \\172.26.0.163\Moliere","",@SW_HIDE)

TrayItemSetText($connectitem, 'Connecter')

TrayItemSetOnEvent($connectitem, "Connecter")

TraySetIcon(@Scriptdir & "\deconnecte.ico")

EndFunc

Func Info()

MsgBox(0,"Infos programme","Statuts Moliere Version 1.1 NOMSG (11/04/08) - P.B pour Clg Yves MONTAND")

EndFunc

Func _Monitor_ON()

$MonitorIsOff = False

Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')

DllCall('user32.dll', 'int', 'SendMessage', _

'hwnd', $Progman_hwnd, _

'int', $lciWM_SYSCommand, _

'int', $lciSC_MonitorPower, _

'int', $lciPower_On)

EndFunc ;==>_Monitor_ON

Func _Monitor_OFF()

$MonitorIsOff = True

Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')

While $MonitorIsOff = True

DllCall('user32.dll', 'int', 'SendMessage', _

'hwnd', $Progman_hwnd, _

'int', $lciWM_SYSCommand, _

'int', $lciSC_MonitorPower, _

'int', $lciPower_Off)

_IdleWaitCommit(0)

Sleep(20)

WEnd

EndFunc ;==>_Monitor_OFF

Func _IdleWaitCommit($idlesec)

Local $iSave, $LastInputInfo = DllStructCreate("uint;dword")

DllStructSetData($LastInputInfo, 1, DllStructGetSize($LastInputInfo))

DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($LastInputInfo))

Do

$iSave = DllStructGetData($LastInputInfo, 2)

Sleep(60)

DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($LastInputInfo))

Until(DllStructGetData($LastInputInfo, 2) - $iSave) > $idlesec Or $MonitorIsOff = False

Return DllStructGetData($LastInputInfo, 2) - $iSave

EndFunc ;==>_IdleWaitCommit

I have reinstalled Basic AutoIT 3.2.10.0

Share this post


Link to post
Share on other sites
potitpanda

Yes my personnalised icon is correct .ico file

Share this post


Link to post
Share on other sites
d4rk

how did you use the icon ?

Aut2exe or using Wrapper ?


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
potitpanda

I have entered icon in wrappers.... but i use "Compile" in AutoIt Menu with adding a icon on field "icon" before compilation.

Share this post


Link to post
Share on other sites
Jos

I have entered icon in wrappers.... but i use "Compile" in AutoIt Menu with adding a icon on field "icon" before compilation.

The "#AutoIt3Wrapper_icon=filetype2.ico" directives are used by AutoIt3Wrapper which is included in the separate SciTE4AutoIt3 installer.

It will use the AUT2EXE commandline options to add the personal ICO to the output program when you hit F7 in SciTE.

What about you post the output of the SciTE outputpane when you do F7 so we can see if all looks ok and attach the ICO file you use to see if its really a valid ICO file ?

Jos


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

Share this post


Link to post
Share on other sites
potitpanda

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "C:\Documents and Settings\Pascal\Bureau\Mes Scripts AutoIT\Mes Scripts AutoIT\Statuts Moliere\Statuts Moliere V1.2 Béta.au3" /autoit3dir "C:\Program Files\AutoIt3"

+>14:42:38 Starting AutoIt3Wrapper v.1.10.1.7 Environment(Language:040C Keyboard:0000040C OS:WIN_XP/Service Pack 2 CPU:X86)

+> Added 4 Icons to the Output executable resources.

>14:42:41 Resource updating finished.

>Running:(3.2.10.0):C:\Program Files\AutoIt3\aut2exe\aut2exe.exe /in "C:\Documents and Settings\Pascal\Bureau\Mes Scripts AutoIT\Mes Scripts AutoIT\Statuts Moliere\Statuts Moliere V1.2 Béta.au3" /out "C:\Documents and Settings\Pascal\Bureau\Mes Scripts AutoIT\Mes Scripts AutoIT\Statuts Moliere\Statuts Moliere V1.2 Béta.exe" /icon "C:\Documents and Settings\Pascal\Bureau\Mes Scripts AutoIT\Mes Scripts AutoIT\Statuts Moliere\connecting.ico" /comp 4 /pack /Bin C:\DOCUME~1\Pascal\LOCALS~1\Temp\AUTOIT~1.BIN

+>14:42:43 Aut2exe.exe ended.rc:0

>Exit code: 0 Time: 5.971

Share this post


Link to post
Share on other sites
Jos

Ok, that means the the program ICO should now be:

/icon "C:\Documents and Settings\Pascal\Bureau\Mes Scripts AutoIT\Mes Scripts AutoIT\Statuts Moliere\connecting.ico"

So what is the problem with it ?

:D


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

Share this post


Link to post
Share on other sites
potitpanda

Instead of the icon "connecting.ico", my program has the icon like this picture :

Posted Image

I don't understand....

Share this post


Link to post
Share on other sites
Jos

As I said already: You need to post (attach) the ICO if you want us to test.

I also see you opened another topic for this script. You will need to show the Scipt for us to be able to help you but you first want ot look at the SciTE4AutoIt3 Helpfile (Ctrl+F1) where an example is shown how to do this.

Jos

Edited by Jos

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

Share this post


Link to post
Share on other sites
potitpanda

I have added the icon in attached pieces and I repost all the code of my script

#region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=connecting.ico
#AutoIt3Wrapper_compression=4
#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
#AutoIt3Wrapper_run_au3check=n
#endregion;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Constants.au3>

Global Const $lciWM_SYSCommand = 274
Global Const $lciSC_MonitorPower = 61808
Global Const $lciPower_Off = 2
Global Const $lciPower_On = -1

Global $MonitorIsOff = False

If $CmdLine[0] > 0 Then
    If $CmdLine[1] = "/help" Then
        #region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info, Modality=Task Modal, Miscellaneous=Top-most attribute
        MsgBox(270400, "Statuts Molière Version 1.2", "Statuts Molière Version 1.2" & @CRLF & "Pascal BARTOLI - Avril 2008" & @CRLF & @CRLF & "Ce programme a été dans un premier temps conçu pour permettre la connexion automatique a Molière a partir du réseau administratif du collège Yves MONTAND." & @CRLF & "Il a été ajouté une fonction supplémentaire permettant de désactiver l'écran sur les postes pédagogiques." & @CRLF & @CRLF & "Le programme sait bien faire la différence entre les deux modes." & @CRLF & "Des parametres peuvent etre passés en ligne de commande : " & @CRLF & @CRLF & "            /help : Affiche ce message d'aide" & @CRLF & "          /Notify : Indique de manière écritedans la barre des taches, les statuts de la connexion   " & @CRLF & @CRLF & "           Par défaut Il y a 3 modes : " & @CRLF & "              Dans le réseau administratif " & @CRLF & "                    Icone verte : Connecté" & @CRLF & "                    Icone rouge : Déconnecté" & @CRLF & @CRLF & "Dans le réseau pédagogique : " & @CRLF & "                     Icone écran : permet par simple appui de la touche F10 de vérouiller la session automatiquement et d'éteindre l'écran. Lorsque celui ci est éteint on le rallume en appuyant sur la touche F11." & @CRLF)
        #endregion --- CodeWizard generated code Start ---
    EndIf
EndIf

HotKeySet("{F10}", "_Monitor_OFF")
HotKeySet("{F11}", "_Monitor_ON")

If UBound(ProcessList(@ScriptName)) > 2 Then
    MsgBox(64, "Programme en cours d'exécution "
, "Ce programme est déjà en cours d'exécution")
    Exit
EndIf

If @LogonDomain = "ADMIN" Then

Run("net use \\172.26.0.163\Moliere /user:AD-0133490Y\moliere moliere", "", @SW_HIDE)

Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1); Default tray menu items (Script Paused/Exit) will not be shown.


$connectitem = TrayCreateItem("Deconnecter")
TrayItemSetOnEvent(-1, "Deconnecter")

TrayCreateItem("")

$infoitem = TrayCreateItem("Info...")
TrayItemSetOnEvent(-1, "Info")

$exititem = TrayCreateItem("Fermer")
TrayItemSetOnEvent(-1, "ExitScript")

TraySetIcon(@ScriptDir & "\connecte.ico")
If $CmdLine[0] > 0 Then
    If $CmdLine[1] = "/notify" Then
        TrayTip("Connecté a Moliere", "Vous pouvez accéder à Moliere", 5, 16)
        Sleep(5000)
        TrayTip("", "", 0, 16)
    EndIf
EndIf
TraySetState()

While 1
    Sleep(10); Idle loop
WEnd
;Else
TraySetIcon("C:\screen.ico", 1)
Opt("TrayMenuMode", 1)
If $CmdLine[0] > 0 Then
    If $CmdLine[1] = "/notify" Then
        TrayTip("Mode écran", "Pressez F10 pour couper l'écran " & @LF & "Pressez F11 pour réactiver l'écran", 5, 16)
        Sleep(5000)
        TrayTip("", "", 0, 16)
    EndIf
EndIf
While 1
    Sleep(10); Idle loop
WEnd
EndIf

; Functions
Func Connecter()
    Run("net use \\172.26.0.163\Moliere /user:AD-0133490Y\moliere moliere", "", @SW_HIDE)
    TrayItemSetText($connectitem, 'Deconnecter')
    TrayItemSetOnEvent($connectitem, "Deconnecter")
    TraySetIcon(@ScriptDir & "\connecte.ico")
    If $CmdLine[0] > 0 Then
        If $CmdLine[1] = "/notify" Then
            TrayTip("Connecté a Moliere", "Vous pouvez accéder à Moliere", 5, 16)
            Sleep(5000)
            TrayTip("", "", 0, 16)
        EndIf
    EndIf
EndFunc  ;==>Connecter

Func ExitScript()
    Exit
EndFunc  ;==>ExitScript

Func Deconnecter()
    Run("net use /delete \\172.26.0.163\Moliere", "", @SW_HIDE)
    TrayItemSetText($connectitem, 'Connecter')
    TrayItemSetOnEvent($connectitem, "Connecter")
    TraySetIcon(@ScriptDir & "\deconnecte.ico")
    If $CmdLine[0] > 0 Then
        If $CmdLine[1] = "/notify" Then
            TrayTip("Déconnecté de Moliere", "Vous ne pouvez plus acceder à Molière", 5, 16)
            Sleep(5000)
            TrayTip("", "", 0, 16)
        EndIf
    EndIf
EndFunc  ;==>Deconnecter

Func Info()
    MsgBox(0, "Infos programme", "Statuts Moliere Version 1.2 Bétà (20/04/08) - P.B pour Clg Yves MONTAND")
EndFunc  ;==>Info

Func _Monitor_ON()
    $MonitorIsOff = False
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')

    DllCall('user32.dll', 'int', 'SendMessage', _
            'hwnd', $Progman_hwnd, _
            'int', $lciWM_SYSCommand, _
            'int', $lciSC_MonitorPower, _
            'int', $lciPower_On)
EndFunc  ;==>_Monitor_ON

Func _Monitor_OFF()
    $MonitorIsOff = True
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')

    While $MonitorIsOff = True
        DllCall('user32.dll', 'int', 'SendMessage', _
                'hwnd', $Progman_hwnd, _
                'int', $lciWM_SYSCommand, _
                'int', $lciSC_MonitorPower, _
                'int', $lciPower_Off)
        _IdleWaitCommit(0)
        Sleep(20)
    WEnd
EndFunc  ;==>_Monitor_OFF

Func _IdleWaitCommit($idlesec)
    Local $iSave, $LastInputInfo = DllStructCreate("uint;dword")
    DllStructSetData($LastInputInfo, 1, DllStructGetSize($LastInputInfo))
    DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($LastInputInfo))
    Do
        $iSave = DllStructGetData($LastInputInfo, 2)
        Sleep(60)
        DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($LastInputInfo))
    Until (DllStructGetData($LastInputInfo, 2) - $iSave) > $idlesec Or $MonitorIsOff = False
    Return DllStructGetData($LastInputInfo, 2) - $iSave
EndFunc  ;==>_IdleWaitCommit

I have joined the four icons in a zipfile in order to test ...

icons.zip

Share this post


Link to post
Share on other sites
Zedna

I think your EXE contains your icoms but you don't use them.

Look at your EXE by Resahacker to prove that.

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

should be something like

TraySetIcon(@ScriptFullPath, -5)

The same applies also for another icons operations in your script.

Edited by Zedna

Share this post


Link to post
Share on other sites
potitpanda

I have resized my icons, it seems to be work for the program Icon

But with the command Line

TraySetIcon(@ScriptFullPath,-1)

Is still Not Working...

Edited by potitpanda

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.