New topic: 

Launching FolderItems: How to go from text to file?

<http://forums.realsoftware.com/viewtopic.php?t=46569>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        barrytraver          Post subject: Launching FolderItems: How to 
go from text to file?Posted: Tue Jan 15, 2013 5:45 am                         
Joined: Fri Sep 30, 2005 1:53 pm
Posts: 778
Location: Philadelphia, PA                If you have the text name for a file, 
how to you get from the text name to the file itself? (I'm running Windows, but 
I assume the answer would be similar for other platforms.)

For example, suppose I want to launch Notepad (in Windows).  I can't just use

Launch "Notepad" 

in REALbasic because "Notepad" is just a string of text, and Launch in 
REALbasic expects to use Launch with a FolderItem. 

Here is the syntax:

FolderItem.Launch

Here are two specific questions:

(1) If I want to Launch the file that is "C:\MyProgram.exe", how do I do that?

(2) If I want to Launch "Notepad", how do I do that?

For those not familiar with Windows, my understanding is that if you tell 
Windows to launch "Notepad" (say, by simply entering "Notepad" at a command 
prompt), Windows can find the the path by itself.

If I know the text name of a file I want to Launch, how do I get from the text 
name (the text string) to the FolderItem itself?

If I  understand things correctly, if I had the FolderItem I could easioly go 
from FolderItem (or file) to FolderItem.Name (which is text) or 
FolderItem.AbsolutePath (which is also text), but I want to go the opposite 
direction: from the text to the FolderItem itself.

This is probably something simple to do, but I've never needed to do it before, 
and what I've tried thus far hasn't worked. Any help will be much appreciated.

Barry Traver   
                             Top                pixe656          Post subject: 
Re: Launching FolderItems: How to go from text to file?Posted: Tue Jan 15, 2013 
6:13 am                         
Joined: Wed May 20, 2009 11:02 am
Posts: 398                What have you tried so far?

barrytraver wrote:(1) If I want to Launch the file that is "C:\MyProgram.exe", 
how do I do that?

(2) If I want to Launch "Notepad", how do I do that?
These are two different situations. In the first one you know the full path of 
the application you want to launch, so you can use folderitem. Check the 
constructor of the folderitem class: 
http://docs.realsoftware.com/index.php/FolderItem.Constructor(path_as_String,_PathType_as_Integer%3DPathTypeAbsolute)

In the second case you don't know the path of that file, so I don't think you 
can use folderitem for that. Check Shell.Execute instead: 
http://docs.realsoftware.com/index.php/Shell.Execute
This will work only because Windows knows the path to Notepad.exe, it will not 
work on just any file.

Pixe      
_________________
Using RS2011r4.3 on Windows7.  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to