VenomIT Posted April 11, 2010 Share Posted April 11, 2010 Hi to all.. I need some advice PLEase. have got App its Now the Switch that i want to ad to the exe is /RunProcess Command-Line Options /AttachProcess <Process ID or .exe Filename> Attach the existing process. You can specify a process ID or process filename. /RunProcess <exe filename> Run the specified process /ProcessParams <parameters> Specify parameters for the process that you run with /RunProcess. /StartImmediately <0 | 1> Specify the "Start Immediately" value (0 or 1). /RegFileVersion <4 | 5> Specify the .Reg file version (4 or 5) /AddOnlyModifiedValues <0 | 1> Specify the value for "Add Only Modified Values" (0 or 1) /AutoSave <.reg filename - modified> <.reg filename - original> When you specify this option, RegFromApp automatically save the data to .reg files and exit when the process that you inspect is terminated. how can I make en excucutable file on its own that he can use the switch also. RegFromApp v1.20.exe /runprocess "execuablefile" can i use the folling Opt("TrayIconHide", 1) FileInstall(RegFromApp v1.20.exe",@TempDir & "\$$.tmp") FileMove ( @TempDir & "\$$.tmp", @temp & "RegFromApp v1.20.exe" ,1 ) RunWait(@TEMP & 'RegFromApp v1.20.exe /RUNPROCESS' , "%2"')RegFromApp v1.20.exe Link to comment Share on other sites More sharing options...
funkey Posted April 11, 2010 Share Posted April 11, 2010 Search the forum and the documentation for $CmdLine. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
MHz Posted April 11, 2010 Share Posted April 11, 2010 Welcome VenomIT, This is an incomplete free handout, i.e the error handling as you can choose how to message the user. Opt("TrayIconHide", 1) ; test if a switch passed If $CMDLINE[0] Then ; get 4 chars on the right of the passed switch Switch StringRight($CMDLINE[1], 4) Case '.msi', '.exe' If FileInstall('RegFromApp v1.20.exe', @TempDir & '\RegFromApp v1.20.exe') Then $exitcode = RunWait('"' & @TempDir & '\RegFromApp v1.20.exe" /RUNPROCESS "' & $CMDLINE[1] & '"') If @error or $exitcode Then ; message exitcode or @error status EndIf Else ; message that fileinstall failed EndIf Case Else ; message that it is not a msi or exe EndSwitch Else ; message help as no switches passed EndIf Link to comment Share on other sites More sharing options...
VenomIT Posted April 11, 2010 Author Share Posted April 11, 2010 Thanks youn are very clever with this ill try it out and see if all works. Just another thiing quickley If i create 5 file i can use the fileinstall command as below Opt("TrayIconHide", 1) FileInstall("IsoBuster.230.exe",@TempDir & "\$$.tmp") FileMove ( @TempDir & "\$$.tmp",@TempDir & "\temp.exe" ,1 ) RunWait(@TempDir & "\temp.exe") FileDelete(@TempDir & "\temp.exe") Exit How can i use the Autoit Archiver command "I install Cmenu and "SendToA3X1.7" How can i use the autoit Archiver Script that it can install all the file and extraxt all the file and execute an exeAutoIt Archive Script.au3 Link to comment Share on other sites More sharing options...
MHz Posted April 12, 2010 Share Posted April 12, 2010 Thanks for the clever comment though I just stand on the shoulder of giants. Your attached script has no executables that I am aware of so you can set a path to $ArchiveExtractDir, call _ArchiveExtract() to FileInstall() the directory of files and call _ArchiveRemove() to remove the FileInstall()ed directory and files.I will modify the example in the help file for AutoIt Archive Script to show you what you can do. Added additional comments starting with ;***.expandcollapse popup; 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 EndFuncThe template is old so modifications seemed fruitful to add to get a script that may work better. Hopefully the comments and code will help you learn else ask about what you fail to understand. Link to comment Share on other sites More sharing options...
VenomIT Posted April 12, 2010 Author Share Posted April 12, 2010 Thanks for the clever comment though I just stand on the shoulder of giants. Your attached script has no executables that I am aware of so you can set a path to $ArchiveExtractDir, call _ArchiveExtract() to FileInstall() the directory of files and call _ArchiveRemove() to remove the FileInstall()ed directory and files. I will modify the example in the help file for AutoIt Archive Script to show you what you can do. Added additional comments starting with ;***. expandcollapse popup; 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 The template is old so modifications seemed fruitful to add to get a script that may work better. Hopefully the comments and code will help you learn else ask about what you fail to understand. Thanks m8 I can use now the autoit archver to create fileinstall command then i use the script that you gave me now so it looks like its working very good. and i just go and specify every time witch exe i want to execute after extraction. :-) :-) Link to comment Share on other sites More sharing options...
VenomIT Posted April 12, 2010 Author Share Posted April 12, 2010 I used to write my exe files manually or i think i it could be manually any pictures that i wanted in the windows i used filed install and then filemove to make the picture show in the window Then for every button that had i had or functionn had i used the fileinstall AND FILEMOVE to execute the button without loding the main window. Just have i look and tell me if iets wrong.. or do you think the autoit archiver function can work better for compiling an exe from multipal file and subdirectories. Thank again for giving me advice about autoit. :-) :-)1 - Enabler Option Menu.au3 Link to comment Share on other sites More sharing options...
MHz Posted April 12, 2010 Share Posted April 12, 2010 I used to write my exe files manually or i think i it could be manually any pictures that i wanted in the windows i used filed install and then filemove to make the picture show in the window Then for every button that had i had or functionn had i used the fileinstall AND FILEMOVE to execute the button without loding the main window. I do not understand why you need to filemove after fileinstall. It seems like another step that is not required so I omitted them with the edit. Just have i look and tell me if iets wrong.. or do you think the autoit archiver function can work better for compiling an exe from multipal file and subdirectories. The AutoIt Archiver script is a convenience item. It has purpose when many files are to be fileinstalled. If you have no need, then do not bother. You were missing many backslashes. I added double quotes in the run functions in case whitespace in the paths. Moved the filedeletes at end of loop. And I removed those filemoves plus tidied the extraction paths of the fileinstalls. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=sd.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $YesID, $NoID, $ExitID, $msg, $Shid1ID, $Shid2ID, $manID, $modID, $hiditID GUICreate("Created By Willem Kleynhans", 500, 240) GUICtrlCreateLabel("Willem.kleynhans@gijima.com", 10, 10) $YesID = GUICtrlCreateButton("Enabler_1.0.0.14", 10, 70, 100, 40) $NoID = GUICtrlCreateButton("Enabler_1.0.0.15", 140, 70, 100, 40) $ExitID = GUICtrlCreateButton("Windows Enabler", 270, 70, 100, 40) $Shid1ID = GUICtrlCreateButton("ShidefWindow - 1.0", 10, 170, 100, 40) $Shid2ID = GUICtrlCreateButton("ShideWindow - 1.2", 140, 170, 100, 40) $manID = GUICtrlCreateButton("WindowMan - 1.0", 270, 170, 100, 40) $modID = GUICtrlCreateButton("WindowMan - 1.0", 400, 70, 100, 40) $hiditID = GUICtrlCreateButton("HideIT", 400, 170, 100, 40) FileInstall("1.ico", @TempDir & "\", 1) FileInstall("2.ico", @TempDir & "\", 1) FileInstall("3.ico", @TempDir & "\", 1) FileInstall("4.ico", @TempDir & "\", 1) FileInstall("5.ico", @TempDir & "\", 1) FileInstall("6.ico", @TempDir & "\", 1) FileInstall("7.ico", @TempDir & "\", 1) $YesID = GUICtrlCreateButton("1", 40, 30, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\1.ico", 0) $NoID = GUICtrlCreateButton("1", 170, 30, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\1.ico", 0) $ExitID = GUICtrlCreateButton("6", 300, 30, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\6.ico", 0) $Shid1ID = GUICtrlCreateButton("2", 40, 130, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\2.ico", 0) $Shid2ID = GUICtrlCreateButton("3", 170, 130, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\3.ico", 0) $manID = GUICtrlCreateButton("5", 300, 130, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\5.ico", 0) $modID = GUICtrlCreateButton("4", 430, 30, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\4.ico", 0) $hiditID = GUICtrlCreateButton("7", 430, 130, 40, 40, $BS_ICON) GUICtrlSetImage(-1, @TempDir & "\7.ico", 0) GUISetState() ; display the GUI1 password Do $msg = GUIGetMsg() Select Case $msg = $YesID ;run("Enabler_1.0.0.14\Enabler_1.0.0.14.exe") FileInstall("Enabler_1.0.0.14\Enabler_1.0.0.14.exe", @TempDir & "\") Run('"' & @TempDir & '\Enabler_1.0.0.14.exe"') ;FileDelete(@TempDir & "\Enabler_1.0.0.14.exe") Case $msg = $NoID ;run("Enabler_1.0.0.15\Enabler_1.0.0.15.exe") ;Opt("TrayIconHide", 1) FileInstall("Enabler_1.0.0.15\Enabler_1.0.0.15.exe", @TempDir & "\") Run('"' & @TempDir & '\Enabler_1.0.0.15.exe"') ;FileDelete("C:\Enabler_1.0.0.15.exe") ;MsgBox(0, "You clicked on", "No") ;FileDelete(@UserProfileDir & "\SendTo\SendToCommandPrompt.exe") ;MsgBox(4096, "SendToCommand Removed ", "Shortcut Removed", 10) Case $msg = $ExitID FileInstall("Enabler Window\Enabler window.exe", @TempDir & "\") Run('"' & @TempDir & '\Enabler window.exe"') ;FileDelete("C:\Enabler window.exe") ;MsgBox(0, "Windows Enabler", "Windows Enabler") Case $msg = $Shid1ID ;run("ShideWindow - 1.0\ShideWindow - 1.0.exe") FileInstall("ShideWindow - 1.0\ShideWindow - 1.0.exe", @TempDir & "\") Run('"' & @TempDir & '\shideWindow - 1.0.exe"') Case $msg = $Shid2ID FileInstall("ShideWindow - 1.2\ShideWindow - 1.2.exe", @TempDir & "\") Run('"' & @TempDir & '\ShideWindow - 1.2.exe"') ;run("ShideWindow - 1.2\ShideWindow - 1.2.exe") Case $msg = $manID FileInstall("WindowsMan\WindowsMan.exe", @TempDir & "\") Run('"' & @TempDir & '\WindowsMan.exe"') ;run("WindowsMan\WindowsMan.exe") Case $msg = $modID FileInstall("Windows Modifier\Windows Modifier.exe", @TempDir & "\") Run('"' & @TempDir & '\Windows Modifier.exe"') ;run("Windows Modifier\Windows Modifier.exe") Case $msg = $hiditID ;run("Enabler_1.0.0.14\Enabler_1.0.0.14.exe") FileInstall("HideIT\HideIT.exe", @TempDir & "\") Run('"' & @TempDir & '\HideIT.exe"') ;Case $msg = $GUI_EVENT_CLOSE ;MsgBox(0, "Application Will Exit", "Close") EndSelect Until $msg = $GUI_EVENT_CLOSE ; cleanup executables FileDelete(@TempDir & "\Enabler_1.0.0.14.exe") FileDelete(@TempDir & "\Enabler_1.0.0.15.exe") FileDelete(@TempDir & "\Enabler window.exe") FileDelete(@TempDir & "\shideWindow - 1.0.exe") FileDelete(@TempDir & "\ShideWindow - 1.2.exe") FileDelete(@TempDir & "\WindowsMan.exe") FileDelete(@TempDir & "\Windows Modifier.exe") FileDelete(@TempDir & "\HideIT.exe") ; cleanup ico files For $i = 1 To 7 FileDelete(@TempDir & "\" & $i & ".ico") Next EndFunc ;==>_Main Link to comment Share on other sites More sharing options...
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