Jump to content

Combine EXE with own Switches


Recommended Posts

Hi to All

I please need i bit some advise on this subject.

I have got allready 2 exe that does sepreate this i wane combine the 2 exe and just add i switch 2 it so only the one part of the exe get executed.

Any Ideas.?

For Example

CMD.exe NotePad.exe

Im Combining these 2 file with auto Archiver.

Like

Opt("TrayIconHide", 1)

FileInstall("CMD.exe",@TempDir & "\$$.tmp")

FileInstall("NotePad.exe",@TempDir & "\$$1.tmp")

FileMove ( @TempDir & "\$$.tmp",@TempDir & "\CMD.exe" ,1 )

FileMove ( @TempDir & "\$$1.tmp",@TempDir & "\NotePad.exe" ,1 )

;RunWait(@TempDir & "\temp.exe")

;FileDelete(@TempDir & "\temp.exe")

Now the Run i wont it to be run with u switch

is this possible

Link to comment
Share on other sites

What is it for? With your compiled script (call it S) you installed your two separate programs (call them X and Y) and can run them separately. If you insist on having only one executable able to launch one or the other program X or Y using, for instance, a switch on the command line, then you could still have yet another executable installed doing precisely that.

Realize that it's possible to make S launch another copy of S (call that second running instance S2) with ad hoc switches on the command line so that S2 launches X or Y at will and terminates immediately. That will use temporarily some memory but for only a very short period.

So yes, it's possible and not hard to do. Is that clear and what you're after?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

What is it for? With your compiled script (call it S) you installed your two separate programs (call them X and Y) and can run them separately. If you insist on having only one executable able to launch one or the other program X or Y using, for instance, a switch on the command line, then you could still have yet another executable installed doing precisely that.

Realize that it's possible to make S launch another copy of S (call that second running instance S2) with ad hoc switches on the command line so that S2 launches X or Y at will and terminates immediately. That will use temporarily some memory but for only a very short period.

So yes, it's possible and not hard to do. Is that clear and what you're after?

The thing what im after is lets say i have got 3 exe files in n folder that difrent verion of it i wanne compile 1 exe and if i execute that exe with switch APP1 the version 1 opens

if i execute the same compile exe with switch APP2 version 2 will op

if i execute the same compile exe with switch APP3 version 3 will op

How do i go about it is that very difficaltl.?

Link to comment
Share on other sites

Not really. You just need to get the commandline parameter via CmdLine[] then run it through a switch statement which decides which program to launch depending on the value.

Look up "Command Line Parameters", "Switch" and "Run" or "RunWait" in the help file index.

Edited by omikron48
Link to comment
Share on other sites

Yes Exacly that.. 1 EXE that has got Switches.

Did you ever take Cmenu.exe and decompiled it i just somme jused <redacted> to decompile it

I have seen in side Cmenu.exe is almost the same as what i wont to do or create.

Do you know of any easier why or shorter why of using the Autoit Archiver Command if you wonnne Compile 1 exe from multipul Folders

Im using This script at the moment

; Source files are in "C:\folder\"

; Choose folder to extract to without trailing backslash

Global $ArchiveExtractDir = @TempDir ;*** added @TempDir as extraction (FileInstall) path

;*** now I will add some code to make use of the functions that were generated.

;*** this line will call _ArchiveExtract() to FileInstall() all files in the user defined function (UDF)

;*** if the condition is true then it proceeds to the next line of code

If _ArchiveExtract() Then

;*** calling _ArchiveInstall() will run the exe in the UDF

$pid = _ArchiveInstall()

;*** i changed the UDF to return @error if something goes wrong so we may as well use it

If @error Then

;*** running the executable failed so message the error

MsgBox(0x40000, @ScriptName, 'Failed to run the executable')

Else

;*** I modified the previous UDF to return the PID so we use it to wait for the exe to close

ProcessWaitClose($pid)

EndIf

;*** calling _ArchiveRemove() will recusively remove the extraction folder

;*** if not removed, then message about failure

If Not _ArchiveRemove() Then

MsgBox(0x40000, @ScriptName, 'Failed to remove the extraction folder')

EndIf

EndIf

Exit

Func _ArchiveInstall()

;*** hmm, I modify this to return the PID so we can use it by adding Return SetError()

;*** also added double quotes to ensure no issues with whitespace in the path

;*** setup.exe can be changed to suit exe name that you want executed

Local $pid

$pid = Run('"' & $ArchiveExtractDir & '\setup.exe"')

Return SetError(@error, @extended, $pid)

EndFunc

Func _ArchiveRemove()

Return DirRemove($ArchiveExtractDir, 1)

EndFunc

Func _ArchiveExtract()

Local $AED = $ArchiveExtractDir

If DirCreate($AED) Then

DirCreate($AED & '\scanned folder\')

FileInstall('scanned folder\setup.exe', $AED & '\scanned folder\', 1)

FileInstall('scanned folder\data.cab', $AED & '\scanned folder\', 1)

Return 1

EndIf

EndFunc

Edited by Valik
Link to comment
Share on other sites

Yes Exacly that.. 1 EXE that has got Switches.

Did you ever take Cmenu.exe and decompiled it i just somme jused <redacted> to decompile it

We got a live one here.

Did you ever think MHz might not want his work decompiled?

Edited by Valik

wtfpl-badge-1.png

Link to comment
Share on other sites

MHz has brought it to my attention that the script in question was compiled with 3.2.0.1 (The official decompiler works) and also includes a command for extracting the script source. Under these circumstances I'm cutting the ban down to 2 weeks. The fact still remains that despite the fact that the program had a built-in method for decompilation, an EULA-violating third-party tool was use to retrieve the script source. If a user is willing to do that for a script where the author provides the source code, then I see no reason the user won't do that for a script where they aren't.

So, the ban is cut down to 14 days starting from now.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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