Jump to content

compile a file and an exe with autoit


Pangu
 Share

Recommended Posts

hello,

I will like to know if it is possible to compile a file and an exe in a script

for example :

file : filesetup

executable : setup.exe

scritps autoit : install.au3

and compile the whole in a single file install.exe

it is possible with autoit because with "fileinsall" doesn't function

thank you

"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
Link to comment
Share on other sites

Hi,

FileInstall() in the helpfile

So long,

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

yes but for an executable i use :

FileInstall(".\setup.exe", @TempDir & "\setup.exe", 0)

whereas i have an error for files :

FileInstall(".\filesetup", @TempDir & "\filesetup", 0)

you are an idea :">

"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
Link to comment
Share on other sites

  • Moderators

yes but for an executable i use :

FileInstall(".\setup.exe", @TempDir & "\setup.exe", 0)

whereas i have an error for files :

FileInstall(".\filesetup", @TempDir & "\filesetup", 0)

you are an idea :">

The source file must be a string and not a variable so that the compiler can extract the filename to include. The source cannot contain wildcards.

You would also need a trailing back slash after @TempDir & '\filesetup\', 0). Each file will need it's own FileInstall().

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

these is always the small details that one does not see :lmao:

now now he says to me after having compiled :

unable to open the script file :ph34r:

however I put well as you said

FileInstall(".\files_setup\", @TempDir & "\file_setup\",0)
FileInstall(".\setup.exe", @TempDir & "\setup.exe",0)

Run(@TempDir & "\setup.exe")
"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
Link to comment
Share on other sites

  • Moderators

these is always the small details that one does not see :lmao:

now now he says to me after having compiled :

unable to open the script file :ph34r:

however I put well as you said

FileInstall(".\files_setup\", @TempDir & "\file_setup\",0)
FileInstall(".\setup.exe", @TempDir & "\setup.exe",0)

Run(@TempDir & "\setup.exe")
I guess you didn't read everything I posted.

You can't file install a directory.

FileInstall("C:\MyDirectory\Myfile.exe", @TempDir & "\file_setup\", 0)

Use the full path to the item you want to install. Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Sorry my english is very bad :lmao:

so it's impossible to compile a file, if I want the whole file I must rather copy it

"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
Link to comment
Share on other sites

Sorry my english is very bad :lmao:

so it's impossible to compile a file, if I want the whole file I must rather copy it

...no...

he is saying that you need to tell the compiler what file you want to include in your exe. If you just specifiy the directory it is in, it has no clue which file within the directory to install.

try this:

#include <file.au3>
Func _DirectoryInstall($sDir, $sDestinationDirectory)
    DirCreate($sDestinationDirectory)
    $aFiles = _FileListToArray($sDir)
    For $i = 1 to $aFiles[0]
        FileInstall($sDir & "\" & $aFiles[$i], $sDestinationDirectory & "\" & $aFiles[$i])
    Next
EndFunc
oÝ÷ Ù«­¢+Ø(íáµÁ±(¥¹±Õ±Ðí¥±¹ÔÌÐì)}¥ÉѽÉå%¹Íѱ°¡!½µÉ¥Ù°Í­Ñ½Á¥ÈµÀìÅÕ½ÐìÀäÈí5å%¹Íѱ±¥±ÌÅÕ½Ðì¤)Õ¹}¥ÉѽÉå%¹Íѱ° ÀÌØíͥȰÀÌØíÍÍÑ¥¹Ñ¥½¹¥ÉѽÉä¤(%¥É
ÉÑ ÀÌØíÍÍÑ¥¹Ñ¥½¹¥ÉѽÉä¤($ÀÌØí¥±Ìô}¥±1¥ÍÑQ½ÉÉä ÀÌØíͥȤ(%½ÈÀÌØí¤ôÄѼÀÌØí¥±ÍlÁt($%¥±%¹Íѱ° ÀÌØíͥȵÀìÅÕ½ÐìÀäÈìÅÕ½ÐìµÀìÀÌØí¥±ÍlÀÌØí¥t°ÀÌØíÍÍÑ¥¹Ñ¥½¹¥ÉѽÉäµÀìÅÕ½ÐìÀäÈìÅÕ½ÐìµÀìÀÌØí¥±ÍlÀÌØí¥t¤(%9áÐ)¹Õ¹
Link to comment
Share on other sites

  • Moderators

...no...

he is saying that you need to tell the compiler what file you want to include in your exe. If you just specifiy the directory it is in, it has no clue which file within the directory to install.

try this:

#include <file.au3>
Func _DirectoryInstall($sDir, $sDestinationDirectory)
    DirCreate($sDestinationDirectory)
    $aFiles = _FileListToArray($sDir)
    For $i = 1 to $aFiles[0]
        FileInstall($sDir & "\" & $aFiles[$i], $sDestinationDirectory & "\" & $aFiles[$i])
    Next
EndFunc
oÝ÷ Ù«­¢+Ø(íáµÁ±(¥¹±Õ±Ðí¥±¹ÔÌÐì)}¥ÉѽÉå%¹Íѱ°¡!½µÉ¥Ù°Í­Ñ½Á¥ÈµÀìÅÕ½ÐìÀäÈí5å%¹Íѱ±¥±ÌÅÕ½Ðì¤)Õ¹}¥ÉѽÉå%¹Íѱ° ÀÌØíͥȰÀÌØíÍÍÑ¥¹Ñ¥½¹¥ÉѽÉä¤(%¥É
ÉÑ ÀÌØíÍÍÑ¥¹Ñ¥½¹¥ÉѽÉä¤($ÀÌØí¥±Ìô}¥±1¥ÍÑQ½ÉÉä ÀÌØíͥȤ(%½ÈÀÌØí¤ôÄѼÀÌØí¥±ÍlÁt($%¥±%¹Íѱ° ÀÌØíͥȵÀìÅÕ½ÐìÀäÈìÅÕ½ÐìµÀìÀÌØí¥±ÍlÀÌØí¥t°ÀÌØíÍÍÑ¥¹Ñ¥½¹¥ÉѽÉäµÀìÅÕ½ÐìÀäÈìÅÕ½ÐìµÀìÀÌØí¥±ÍlÀÌØí¥t¤(%9áÐ)¹Õ¹
That won't work Chris... FileInstall() source must be a string, not a variable.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Here's a rough example of what I think pangu is trying to do:

#include <file.au3>
$Main = GUICreate('FileInstall Directory', 400, 380)
$Edit = GUICtrlCreateEdit('', 10, 10, 380, 300)
GUICtrlCreateLabel('Destination Path:', 20, 318, 90, 20, 0x001)
$DestinationPath = GUICtrlCreateInput('@TempDir & "\"', 110, 315, 200, 20)
GUICtrlCreateLabel('Flag:', 315, 318, 30, 20, 0x001)
$Flag = GUICtrlCreateCombo('', 345, 315, 40, 300)
GUICtrlSetData($Flag, '0|1|', '0')
$GetDir = GUICtrlCreateButton('Directory Get Files', 80, 345, 100, 30)
$Copy = GUICtrlCreateButton('Copy Data', 220, 345, 100, 30)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $GetDir
            $Dir = FileSelectFolder('Select a directory to fileinstall', @HomeDrive)
            If Not @error Then
                $Files = _FileListToArray($Dir, '*.*', 1)
                If IsArray($Files) Then
                    Dim $sHold = '', $sRead = GUICtrlRead($DestinationPath), $nFlag = GUICtrlRead($Flag)
                    For $iCC = 1 To UBound($Files) - 1
                        $sHold &= 'FileInstall("' & $Dir & '\' & $Files[$iCC] & '", ' & $sRead & ', ' & $nFlag & ')' & @CRLF
                    Next
                    GUICtrlSetData($Edit, '')
                    GUICtrlSetData($Edit, $sHold)
                EndIf
            EndIf
        Case $Copy
            ClipPut(GUICtrlRead($Edit))
    EndSwitch
WEnd
Now you don't have to hand write every file, just copy and paste.

Edit:

Forgot to clear the $sHold var.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

thank you for your script SmOke_N that is not appropriate and CHRIS95219, i don't understand your script

Posted Image

I need the directory named file_setup because the exe needs the file to continue the installation, when the exe runs, it searchs the files it needs to carry on and if they are not continuous inside it cannot continue. this is why I want to compile it with the exe

Edited by Pangu
"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
Link to comment
Share on other sites

thank you for your script SmOke_N that is not appropriate and CHRIS95219, i don't understand your script

Posted Image

I need the directory named file_setup because the exe needs the file to continue the installation, when the exe runs, it searchs the files it needs to carry on and if they are not continuous inside it cannot continue. this is why I want to compile it with the exe

Sounds like you need to use FileInstall with DirCreate.

DirCreate("C:\Test1\Folder1\Folder2")

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

after one night of reflexion, I realized that the script of Smoke should function :lmao:

here is what that gives me :

FileInstall(".\Installer.exe", @TempDir & "\Installer.exe", 0)
FileInstall("E:\directory_setup\data1.cab", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\data1.hdr", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\data2.cab", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\engine32.cab", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\layout.bin", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\Datas\Os\98\CATALOG3.CAB", @TempDir & "\directory_setup\Datas\Os\98\", 0)
FileInstall("E:\directory_setup\Datas\Os\98\NET10.CAB", @TempDir & "\directory_setup\Datas\Os\98\", 0)

and i don't understand why that doesn't function :ph34r:

Forgot to clear the $sHold var

Smoke, You meant what :geek: Edited by Pangu
"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
Link to comment
Share on other sites

  • Moderators

after one night of reflexion, I realized that the script of Smoke should function :whistle:

here is what that gives me :

FileInstall(".\Installer.exe", @TempDir & "\Installer.exe", 0)
FileInstall("E:\directory_setup\data1.cab", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\data1.hdr", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\data2.cab", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\engine32.cab", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\layout.bin", @TempDir & "\directory_setup\", 0)
FileInstall("E:\directory_setup\Datas\Os\98\CATALOG3.CAB", @TempDir & "\directory_setup\Datas\Os\98\", 0)
FileInstall("E:\directory_setup\Datas\Os\98\NET10.CAB", @TempDir & "\directory_setup\Datas\Os\98\", 0)

and i don't understand why that doesn't function ;)

Smoke, You meant what :P

You have to create the directory "directory_setup" with DirCreate() first before using the fileinstalls.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

You have to create the directory "directory_setup" with DirCreate() first before using the fileinstalls.

Sounds like a good suggestion for an future enhancement. :whistle:

I could never understand why most of the file copying functions won't create subdirs if they didn't exist. I know that FILECOPY now supports this via a option parameter but honestly, shouldn't functions like these automatically create the folders (or at least give you the option like the current FILECOPY)?

I'm ranting again...time for bed!

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Link to comment
Share on other sites

I've finally made the compilation for the whole folder

from the first window which couldn't manage to pass to the next one, I thus directly launched the second window and there it works, Smoke_N's way of work is thus good.

thank you all

"Donne un poisson à un homme, il mangera un jour. Apprends lui à pècher, il mangera toujours."-Proverbe chinois-
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...