realbasic-nug
[Top] [All Lists]

Launching a Program And Passing Parameters

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Launching a Program And Passing Parameters
From: Barry Traver <rblog at ix dot netcom dot com>
Date: Tue, 31 Jan 2006 19:58:40 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20060131220844 dot D19C110A6CAA at lists dot realsoftware dot com> <F5B672C8-2E9C-423C-9370-1C9B5012469C at elfdata dot com> <43DFFD0E dot 1020505 at utoronto dot ca>
I know how to have an RB program launch another program. For example, if I have my RB program in the same folder as Notepad, I can do it like that:

 Dim F As FolderItem
 F = App.ExecutableFile.Parent.Child ("Notepad.exe")
 If F <> Nil and F.Exists Then
   F.Launch
 End If

BUT what I don't remember how to do in REALbasic (and can't even remember if I ever knew how to do it in RB) is this: Have a REALbasic program launch Notepad with a particular file loaded in NotePad (such as "goodnews.txt")

When DOS was still around, you could do this by putting something like this in a .bat file:

    notepad.exe "goodnews.txt"

That is, you could pass along the parameter by putting it right on the command line.

Visual Basic was less friendly. In Visual Basic, you could either use "Shell" to open a particular application like Notepad, but with no specific document loaded. Or you could use the "ShellExecute" API call to load in a specific document _using the application associated with that particular type of document_. But neither serves the purpose. I want to be able to designate both the application _and_ the specific document to be loaded in.

Is there a way to do this in REALbasic?

Thanks in advance for any advice.

Barry Traver

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
<Prev in Thread] Current Thread [Next in Thread>