Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Launching a program via a shortcut? (.lnk extention)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chopperdudes




PostPosted: Thu Sep 04, 2008 6:25 pm   Post subject: Launching a program via a shortcut? (.lnk extention)

well i know you can launch programs given the filename with with Sys.Exec. however, for example you want to launch the Internet Explorer shortcut from Desktop. how would you go about doing that?

a practical example would be because the location on different computers might not be the same, it would be useful to use Dir.Get to get and store the file names on the Desktop then be able to run them from there. however, Sys.Exec doesn't seem to be able to launch shortcuts.
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Thu Sep 04, 2008 7:02 pm   Post subject: Re: Launching a program via a shortcut? (.lnk extention)

well, if you only intend to be launching internet explorer/other web browsers, all you need to do is
<code>
if not Sys.Exec("www.yourwebsite.com") then
end if
</code>

however if you need it for something other than websites, I have no idea how you would open shortcuts.
hope that helped.
Insectoid




PostPosted: Fri Sep 05, 2008 12:51 pm   Post subject: RE:Launching a program via a shortcut? (.lnk extention)

The problem here is that unlike EXE's, a shortcut's name can be changed without consequence. So some people might have the shortcut for IE renamed to 'Internet'. Anyways, most people have it installed to program files, so it shouldn't be a problem. Just include an option to change the file directory.
btiffin




PostPosted: Fri Sep 05, 2008 8:59 pm   Post subject: Re: Launching a program via a shortcut? (.lnk extention)

As TheGuardian001 hinted at; one of the things about Windows is that if you "execute" a datafile, the filetype system may take over and launch the right application where ever it may be. It's the feature that allows you to double-click a .xls file and auto-start Excel.

It doesn't always work. Most system don't have the ever-cool Mac OS resource fork, so the filetype system needs to rely on extensions, and for things like .rtf, you might want Wordpad sometimes, Oo.org others or even Word.

If ... that is what you are aiming for that is.

To try out what will do what, open a cmd console and try something like
C:\somedir\> myfile.rtf
or mypage.html
and see what app launches.

Again this won't always work. Registry settings, PATH and a few other things can burn you.

Cheers
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: