Sign in to follow this  
Followers 0
giannis121

2 executable files in one...(???)

19 posts in this topic

My will is to run an executable file doing some things,

including running another exetutable and finally

create only one file.

For example:

#include <File.au3>

FileDelete("c:\test_file.txt")

ShellExecute("C:\test.exe")

My problem is how to create only one file that will include the exe file.

Any suggestions?

Share this post


Link to post
Share on other sites



giannis121,

Your explanation is far from clear. FileInstall will let you load an exe file inside your script which you can then extract and run. Is that what you are looking to do? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

No this is not what i am looking for, while FileInstall needs also the test.exe to be somewhere.

I need the test.exe to be included to the new exe file.

Is it now more clear?

Thank you...

Giannis

Share this post


Link to post
Share on other sites

giannis121,

I am still confused. Are you trying to compile a new exe file from within an existing one? :)

Please explain in detail the various steps you want to execute - I am sure that we can suggest ways to do what you want if we could only understand what it is you want to do! ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

ok. My reduced lexikon is also a problem that can't be solved(!!!)

I have an executable file that was not created by me (so i don't have the source code).

This is the test.exe.

I want to execute some code, and then run this test.exe.

Matter of protection, the code before the test.exe will check the hard disk serial and if it is correct,

will run the test.exe.

This is the new exe file:

$sn=DriveGetSerial("c:")

$data="bla bla bla"

If $sn = $data Then

FileDelete("C:test_file.txt")

ShellExecute("C:test.exe")

EndIf

Now i want to create only one file (the test.exe will be included to the new exe),

so nobody will be able to run seperatelly the test.exe without the check of serial No.

So, i think that the point is given now.

I want to include and executable inside one other, by creating only one exe.

Hope my Imagination does not exceed reality...

Giannis

Share this post


Link to post
Share on other sites

I've never done that and I don't think it's a trivial task.

You could search forum for "Run from memory" or you could take another approach.

If you code runs at startup, you could close the test.exe process if it exists, and the drive

serial has not been confirmed, or the process was not started by your script.

eg.

$sn=DriveGetSerial("c:")

$data="bla bla bla"

Local $Pid

If $sn = $data Then

FileDelete("C:test_file.txt")

$Pid = Run("C:test.exe")

EndIf

While 1

$pid2 = ProcessExists("test.exe")

If $pid2 And $pid <> $pid2 Then

ProcessClose($pid2)

EndIf

Sleep(100)

Wend

Or something like that (untested)


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

giannis121,

I still believe FileInstall will work for you. You can make the FileInstall line conditional on the hard disk serial passing the check. :)

Here is a small script to show that the principle works - the FileInstall only occurs if you press "Yes". You will need to replace the "File_Path" by a real file on your system:

If MsgBox(4, "Test", "Install?") = 6 Then
    FileInstall("File_Path", @ScriptDir & "\test.txt")
EndIf

So you have only the one exe file as the other only becomes visible if you tell it to do so. ;)

Does that solve your problem? :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

FileInstall("C:Test.exe", @ScriptDir & "Test.exe")
   Test()
FileDelete(@ScriptDir & "Test.exe")

   Func Test()
   ; Insert code here
   EndFunc

You can install the exe on the system and remove after function. When you compile the file you have only one .exe

Edited by johnmcloud

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I think you might be confused about how FileInstall works. You only need test.exe to be present when you compile your script, after which it's included inside your compiled script, and gets extracted when it reaches the FileInstall line.

$sn=DriveGetSerial("c:")
$data="bla bla bla"
If $sn = $data Then
FileDelete("C:test_file.txt")
FileInstall("test.exe", "C:")
ShellExecuteWait("C:test.exe")
FileDelete("C:test.exe")
EndIf

If the condition is met, text.exe will be extracted from the parent executable, run, and then be deleted.

Edited by Dana

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I get an error when converting to .exe:

Error Adding file:

c:\test.exe

The test.exe exists on C.

Why can that be?

Regards,

Giannis

Edited by giannis121

Share this post


Link to post
Share on other sites

giannis121,

Why can that be?

The most common reason for FileInstall to fail is to use anything other than a literal string for the source parameter. Please post the code you use so we can take a look. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

This is the code:

#NoTrayIcon

#include <File.au3>

$sn=DriveGetSerial("c:\")

$data="2024750000"

If $sn = $data Then

FileDelete("c:\test_file.txt")

FileInstall("c:\test.exe", "C:\test_files\test-code.exe", 1)

ShellExecute("C:\test_files\test-code.exe")

WinWaitActive("test-code")

WinWaitClose("test-code")

FileDelete("C:\test_files\test-code.exe")

Else

MsgBox(0, "Wrong Serial Number.", "Wrong Serial Number.")

EndIf

Do your magic Melba, you have saved me in the past again!

Share this post


Link to post
Share on other sites

giannis121,

As there seems to be nothing wrong with the syntax of the FileInstall line, we turn to other possibilities. Do you have permission to write a file to C:test_files? Can you copy it there manually without any OS complaints? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

He has an read issue at the time the File is added to the resources during Script compilation.

So my guess is that the file is not located at c:test.exe.

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

#18 ·  Posted (edited)

I don't know what was the problem, but finally FileInstall works and i like it!

Zedna, i followed your link, but all seems chinese to me! (i won't say greek)

Thank you for your time!!!

Giannis

Edited by giannis121

Share this post


Link to post
Share on other sites

giannis121,

Glad you got it working. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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