Jump to content

how to compile to exe?


sahra

Recommended Posts

i compile the au3 file to exe and now i have compile au3 and my setup and i want to know how to compile them to one exe that will run the compile au3

and i want to write i My name in the setup..

and to do that the setp Could not be opened

thank you all

Link to comment
Share on other sites


FileInstall() may suit your need to store the setup.exe within your compiled executable.

Example below:


; fileinstall will extract to this path
$tempdir = @TempDir & '\MySetup'

If FileInstall('setup.exe', $tempdir, 1) Then
$pid = Run('"' & $tempdir & '\setup.exe"')
; perhaps some more code here
; wait for window to appear
WinWait('Setup Window Title')
; write your name into setup
ControlSetText('Setup Window Title', '', 'Edit1', 'My Name')
; perhaps some more code here
; wait for process to finish (added timeout)
ProcessWaitClose($pid, 60)
; cleanup
DirRemove($tempdir, 1)
EndIf

Compile with setup.exe in same directory as the au3 script.

Link to comment
Share on other sites

FileInstall() may suit your need to store the setup.exe within your compiled executable.

Example below:


; fileinstall will extract to this path
$tempdir = @TempDir & '\MySetup'

If FileInstall('setup.exe', $tempdir, 1) Then
$pid = Run('"' & $tempdir & '\setup.exe"')
; perhaps some more code here
; wait for window to appear
WinWait('Setup Window Title')
; write your name into setup
ControlSetText('Setup Window Title', '', 'Edit1', 'My Name')
; perhaps some more code here
; wait for process to finish (added timeout)
ProcessWaitClose($pid, 60)
; cleanup
DirRemove($tempdir, 1)
EndIf

Compile with setup.exe in same directory as the au3 script.

Can u explain it beter?

i have got a several files in folder with the compiled file au3 that i turn in to exe

now what to do next to put them all in one file?

please help

Thank u very much

Link to comment
Share on other sites

FileInstall() may suit your need to store the setup.exe within your compiled executable.

Example below:


; fileinstall will extract to this path
$tempdir = @TempDir & '\MySetup'

If FileInstall('setup.exe', $tempdir, 1) Then
$pid = Run('"' & $tempdir & '\setup.exe"')
; perhaps some more code here
; wait for window to appear
WinWait('Setup Window Title')
; write your name into setup
ControlSetText('Setup Window Title', '', 'Edit1', 'My Name')
; perhaps some more code here
; wait for process to finish (added timeout)
ProcessWaitClose($pid, 60)
; cleanup
DirRemove($tempdir, 1)
EndIf

Compile with setup.exe in same directory as the au3 script.

I did not understand what I should do with that code

Link to comment
Share on other sites

you could place it, run it, and delete it, while restricting user input

blockinput (1)

DirCreate ("C:\temp1") ;creates a temp destination

fileinstall ("setup.exe" , "C:\temp1", 1) ;rolls the setup.exe into your compile and when ran deploys it to c:\temp1, overwriting any other setup.exe in the folder.

runwait ("C:\temp1\setup.exe") ; runs the setup from the temp destination

sleep (3000) ; maybe necessary to wait for the setup to completely exit before you recursively delete the folder

DirRemove ("C:\temp1", 1) ; removes the c:\temp1 folder and all files and folders within

Edited by iamtheky
Link to comment
Share on other sites

Can u explain it beter?

i have got a several files in folder with the compiled file au3 that i turn in to exe

now what to do next to put them all in one file?

please help

Thank u very much

Perhaps sahra will also gain some knowledge from your similar question.

I usually give an answer as good as the question as I may not know how to respond in a correct manner if the question is not well explained of the issue.

Learn by example:

(Note: The example is not a working example as the FileInstall() parameters are invalid filenames. The example would need valid filenames to work correct and the same for the previous example I posted above).


; UAC Prompt if this script is executed without admin rights. Use this
; directive if setup.exe depends on admin rights to install correct.
#RequireAdmin

; Store the extraction path into a variable named $path_setup.
$path_setup = @TempDir & '\extract_folder_name'

; The code inside the _Extract() function will execute and will return
; a True value if the extraction path was created.
If _Extract($path_setup) Then

; Run the setup.exe file within the extraction folder
; and use @TempDir as a valid working directory.
; Note: I used a silent install switch (presume /S) for this example.
RunWait('"' & $path_setup & '\setup.exe" /S', @TempDir)

; Remove the extraction path to finish task
DirRemove($path_setup, 1)
EndIf

Exit

Func _Extract($path)

; Create a valid folder path to FileInstall() the setup files.
If DirCreate($path) Then

; FileInstall() the setup files to the extraction path.
; Note: Change the first parmeters to match your setup files names.
; Note: Add or remove FileInstall() lines as needed.
FileInstall('setup.exe', $path & '\', 1)
FileInstall('file2', $path & '\', 1)
FileInstall('file3', $path & '\', 1)
FileInstall('file4', $path & '\', 1)
FileInstall('file5', $path & '\', 1)
FileInstall('file6', $path & '\', 1)
FileInstall('file7', $path & '\', 1)

; Return True value if above condition (DirCreate()) is successful.
Return True
EndIf

; Return False value if above condition (DirCreate()) fails.
Return False
EndFunc

#cs ; Script summary
The $path_setup variable is assigned the string value of the path to extract
the setup files to. The _Extract() function will then execute the code within
it with the $path variable parameter passed to it. The $path parameter has the
value of the extraction path. The _Extract() function will return True on
successful creation of the extraction path. If the _Extract() function returns
True then the RunWait() function will run the path to the setup.exe. The
@TempDir working directory parameter used in the RunWait() function helps to
ensure a suitable working directory is initially set. The DirRemove() function
will then recursefully remove the extraction path previously created by the script.
#ce

Hopefully enough comments have been added to the script to help with understanding.

I did not understand what I should do with that code

It is an example to learn from. The example may help with some ideas to assist you. cluberti offers some good advice of looking at the AutoIt3 documentation to help you learn.

DirCreate ("C:\temp1") ;creates a temp destination

Thanks for the reminder as I left out the DirCreate() in my first example above which would make FileInstall() fail with a invalid path to extract to.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...