Sign in to follow this  
Followers 0
Fire

How to correct apply my icon(Which Opened FileOpenDialog() to my external compiled.exe

5 posts in this topic

Hi Dears:)

My problem is:

I wrote script.It generates simple batch (*.bat) file and if the checkbox is checked it defaultly compile it)(*.bat file) to *.exe with external compiler.

This compiler is allow from commandline apply icon,define which method of ExEcUtE(silent or ghost(0) and the 2`nd visible(1)) and compile it.

Snippets from my script:

For compile generated *.bat file it should be compiled to-> *.exe under this cli(command line usage).

####### Valid compilation command from cli for Compile batch file in ghost mode (0) and define some icon("myicon.ico") #######

compiler.exe sourceBAt.bat compiled.exe "myicon.ico" 0

############## END OF COMMAND #############

Where:

compiler.exe is external compiler(Bat2exe compiler)

sourceBat.bat is generated my batch file(Which generated by my script )

"myicon.ico" this is an icon file (It`s not incorrect bcuz compiler.exe allow this usage. In this case with quotes like this --> "ikon.ico" (for ex.)

If " (quotes at begin and at the end is not defined compilation will fail and no icon was applied to generated *.exe(In this case this is a compiled.exe)

And i create

FileOpenDialog("Ikonu Menimset", "", "Ikonlar(*.ico)")
in my script.If Checkbox is checked it will pass execution to FileOpenDialog()

Below snippet from my script:

#include <GUIConstants.au3>
#NoTrayIcon
opt("MustDeclareVars",1)
Local $Myvaiables1,$Myvariables2,$MyvariablesN                     ;all variables are probably Local. Theris no problem.
    some GUI CODES ...
... some Conditions ...
 SOME STATEMENTS...
...

$Checkbox1 = GUICtrlCreateCheckbox("Kompile Et.", 336, 288, 105, 17)
GUICtrlSetFont(-1, 8, 400, 2, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF00FF)
GUICtrlSetBkColor(-1, 0xFF0000)
again some statements ...

... under Loop ...
                    Case $Checkbox1
            if BitAND(Guictrlread($Checkbox1), $GUI_CHECKED) Then
                $ikon = FileOpenDialog("Define your Icon", "", "Ikonlar(*.ico)")
                $ikonread = GUICtrlGetHandle($ikon)            ;  also i try GuictrlRead($ikon) but no success:( #
                MsgBox(64,"Compilation bat2exe", "Compilation bat2exe",  @CRLF )
            EndIf

and here is snippet from other location of my script it will compile my *.bat file to *.exe with parameters(Here is compiler parameters:Ghost mode is (0),with icon which i define("someicon.ico")

$quote = """"
$zero ="0"
$lola =run(@ComSpec  & " /c  compiler.exe sourceBat.bat compiler.exe " &$quote &$ikonread &$quote &$zero , "", @SW_HIDE )

My dears problem with defined icon.Compilation is successfull.But script is unable apply $ikon and as result compiled.exe was compiled with no icon.

I try replace someicon.ico with same directory with compiler.exe no success again for apply icon.

I want correctly apply my icon(Which Opened FileOpenDialog() to my compiled.exe file but script is unable to apply my icon to should be generated => compiled.exe

I try debug it with:(Reason: for find where is misconfiguration)

MsgBox(64, "Debug of errors",  $quote &$ikonread &$quote)

It returns to me "0" In MessageBoxA

In this case i know my mistakes in $ikonread .

Q): How to read correctly $ikonread and correctly apply it to compiled.exe?

I try GuiCtrlread($ikon) and GUICtrlGetHandle($ikon) and equal it to $ikonread but no success.

Note:I`m unsure GuiCtrlread($ikon) and GUICtrlGetHandle($ikon) is correct ways to do this.

Can somebody say me what is the correct way GuiCtrlread($ikon) or GUICtrlGetHandle($ikon) or any other ways?

And what i did incorrect?How to solve this?

I am sure in that somebody will help me about this little trouble.

Sorry for my awfull english. I Try learn it too :)

Thank to whoever take his(her) gold time for help me =)


[size="5"] [/size]

Share this post


Link to post
Share on other sites



Try writing it like this in case there are spaces in the path.

if BitAND(Guictrlread($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                $ikon = FileOpenDialog("Define your Icon", "", "Ikonlar(*.ico)")
                If NOT @Error Then
                    $ikon = '"' & $ikon & '"'
                ;MsgBox(64,"Compilation bat2exe", "Compilation bat2exe",  @CRLF );; WRONG!
                    MsgBox(64,"Compilation bat2exe", "Compilation bat2exe" & @CRLF & $ikon)
            EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Case $Checkbox1
            if BitAND(Guictrlread($Checkbox1), $GUI_CHECKED) Then
                $ikon = FileOpenDialog("Define your Icon", "", "Ikonlar(*.ico)")
                $long = FileGetLongName($ikon)                    ;Here is change FileGetLongName($ikon)    
                MsgBox(64,"Compilation bat2exe", "Compilation bat2exe" & @CRLF & $ikon) ;Fixed Thanks To  GEOSoft

            EndIf

and then i change it in run() 

$quote = """"
$zero ="0"
$lola =run(@ComSpec  & " /c  compiler.exe sourceBat.bat compiled.exe " &$quote &$long &$quote &$zero , "", @SW_HIDE )

Now works fine=)

Thanks you very much too GEOSoft.

Edited by Sh3llC043r

[size="5"] [/size]

Share this post


Link to post
Share on other sites

Case $Checkbox1
            if BitAND(Guictrlread($Checkbox1), $GUI_CHECKED) Then
                $ikon = FileOpenDialog("Define your Icon", "", "Ikonlar(*.ico)")
                $long = FileGetLongName($ikon)                    ;Here is change FileGetLongName($ikon)    
                MsgBox(64,"Compilation bat2exe", "Compilation bat2exe",  @CRLF )
            EndIf

and then i change it in run() 

$quote = """"
$zero ="0"
$lola =run(@ComSpec  & " /c  compiler.exe sourceBat.bat compiled.exe " &$quote &$long &$quote &$zero , "", @SW_HIDE )

Now works fine=)

Thanks you very much too GEOSoft.

It's good that it works fine with run becuase you made the same mistake again with the MsgBox()

Hint: @CRLF is not a valid value for Timeout.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

It's good that it works fine with run becuase you made the same mistake again with the MsgBox()

Hint: @CRLF is not a valid value for Timeout.

OO I`m very sorry.Thanks i fix it in my application.

Thanks again GEOSoft


[size="5"] [/size]

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