Jump to content

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


Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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!

Link to comment
Share on other sites

  • Developers

So where is this file test.exe you want to FileInstall() located when you Compile the script?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Developers

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 :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

giannis121,

Glad you got it working. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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...