giannis121 Posted January 17, 2012 Posted January 17, 2012 My will is to run an executable file doing some things,including running another exetutable and finallycreate 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?
Moderators Melba23 Posted January 17, 2012 Moderators Posted January 17, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
giannis121 Posted January 17, 2012 Author Posted January 17, 2012 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
Moderators Melba23 Posted January 17, 2012 Moderators Posted January 17, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JohnOne Posted January 17, 2012 Posted January 17, 2012 Sounds to me like the OP wants to run a resource executable from within memory space of a parent executable. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
giannis121 Posted January 17, 2012 Author Posted January 17, 2012 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 ThenFileDelete("C:test_file.txt")ShellExecute("C:test.exe")EndIfNow 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
JohnOne Posted January 17, 2012 Posted January 17, 2012 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 driveserial has not been confirmed, or the process was not started by your script.eg.$sn=DriveGetSerial("c:")$data="bla bla bla"Local $PidIf $sn = $data ThenFileDelete("C:test_file.txt")$Pid = Run("C:test.exe")EndIfWhile 1$pid2 = ProcessExists("test.exe")If $pid2 And $pid <> $pid2 ThenProcessClose($pid2)EndIfSleep(100)WendOr something like that (untested) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators Melba23 Posted January 17, 2012 Moderators Posted January 17, 2012 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") EndIfSo 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? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
johnmcloud Posted January 17, 2012 Posted January 17, 2012 (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 January 17, 2012 by johnmcloud
Dana Posted January 17, 2012 Posted January 17, 2012 (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 January 17, 2012 by Dana
giannis121 Posted January 23, 2012 Author Posted January 23, 2012 (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 January 23, 2012 by giannis121
Moderators Melba23 Posted January 24, 2012 Moderators Posted January 24, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
giannis121 Posted January 24, 2012 Author Posted January 24, 2012 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.")EndIfDo your magic Melba, you have saved me in the past again!
Developers Jos Posted January 24, 2012 Developers Posted January 24, 2012 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.
Moderators Melba23 Posted January 24, 2012 Moderators Posted January 24, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Developers Jos Posted January 24, 2012 Developers Posted January 24, 2012 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.
Zedna Posted January 25, 2012 Posted January 25, 2012 If you don't want to use FileInstall() and rather run EXE directly from resources/memory then look here Resources UDF ResourcesEx UDF AutoIt Forum Search
giannis121 Posted January 28, 2012 Author Posted January 28, 2012 (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 January 28, 2012 by giannis121
Moderators Melba23 Posted January 28, 2012 Moderators Posted January 28, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now