program launcher
BlitzMax Forums/BlitzMax Beginners Area/program launcher
| ||
Ok all, I am in a bit of a bind. I have designed a program and I need an installer for it. I have a program to actually install the program to the computer. What I am after is a selector program to allow the user to install the required programs in any order desired. The code that I have come across is this: ' MyProgram.exe ' the following prints the contents of this source file file=OpenFile("D:\MyProgram.exe") If Not file RuntimeError "could not open file MyProgram.exe" While Not Eof(file) Print ReadLine(file) Wend CloseStream file When I use this program, all it does is prints the contents of this file encrypted. This is not what I am after. I need to have it where it actually launches to program to install. Let me give you an illustration. Using the LogicGUI Program, I created a UI. This is the code: 'Source Code created on 22 Sep 2007 21:46:06 with Logic Gui Version 2.2 Build 262 'John Doe 'Start of external Header File SuperStrict 'End Of external Header File Local Logic_Gui:TGadget = CreateWindow:TGadget("Logic_Gui",240,51,665,513,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE |WINDOW_MENU |WINDOW_STATUS |WINDOW_CLIENTCOORDS ) Local Button1:TGadget = CreateButton:TGadget("Button1",71,85,75,23,Logic_Gui:TGadget,BUTTON_PUSH) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE Select EventSource() Case Logic_Gui Logic_Gui_WC( Logic_Gui:TGadget ) End Select Case EVENT_GADGETACTION Select EventSource() Case Button1 Button1_GA( Button1:TGadget ) End Select End Select Forever Function Logic_Gui_WC( Window:TGadget ) DebugLog "Window Logic_Gui wants to be closed" ' HideGadget( Window:TGadget ) End End Function Function Button1_GA( Button:TGadget ) DebugLog "Button Button1 was pressed" End Function 'Start of external Append File 'Your additional code should be here! 'End Of external Append File When you launch this code, it brings up only 1 button labeled BUTTON1. When you press this button, it gives you the text message DebugLog "Button Button1 was pressed" What I need is when you press the button (will be labeled INSTALL PROGRAM, it needs to actually launch the .exe installer file. Can anyone assist me? Thanks in advance. James |
| ||
You want to execute another app, right? Then have a look at the module pub.freeprocess. With that you can run other apps, read their output/returnvalues etc... Search the forum for usage examples, should be selfexplaining. |
| ||
Jake, Thanks for your reply. I do have a followup question. I tested this and it works: Import PUB.FreeProcess Local proc:TProcess proc=TProcess.Create("Notepad",0) If proc.Status() Notify "Notepad is still running" EndIf This program runs and runs well. There is a problem. When it brings up the notification saying that NOTEPAD IS STILL RUNNING, it gives me an OK button to press. When I press the OK button, it closes the notepad. I tested this with the installer I want to use, in this case D:\setup.exe. the same thing happens. Setup.exe launches and goes through the process of installing. There is the notification window as well that will cancel the installer. Is there a way to eliminate this issue? |
| ||
When you press the OK button your program continue it's execution (Notify popups a modal window, stopping further program execution until closed). If you want to wait for a process to close, try: While proc.Status() Wend Jake PS: You should use codeboxes when posting code on the forums. Use {code}...{/code} for few lines and {codebox}...{/codebox} for larger blocks (Use [] instead of {} ) |
| ||
Jake, Works like a charm. Thanks. Combining it with the UI, Also works. Clicking on the button launches the file and the file remains. This was what I was in need of. Now, all I have to do is to code 3 other items in this launcher and give it an icon. Thanks again. |
| ||
To create setup's on Windows, you may have to have a look at InnoSetup. |
| ||
SebHoll, I have an installer program. I use Setup Factory 7 and it works well. I can easily create an autorun.ini file and program it to launch the installer of the program I wish to install. What I need is a program that does something similar to AutoPlay Media Studio in that when the CD is placed in the drive, it gives an installer program for the user to choose which program to install. Here is the best example I can give you: The autorun file launches an installer that has the following: BUTTON1: This installs DirectX 9 BUTTON2: This installs MyProgram BUTTON3: This installs Adobe Acrobat Reader BUTTON4: This installs Dot Net Framework So far, the code is only able to do one of these. I would like to know if it can do all 4 of these, or do I need to spend alot of money to buy AutoPlay Media Studio (or other similar program to do this) James P.S. Thanks for all the replies. They have been helpful |