Launch another application?

Ken Ray kray at sonsothunder.com
Wed Mar 27 13:27:00 EST 2002


Magnus,

If you're trying to launch Excel, the code below won't work... it's only for
Acrobat Reader. ;-)  (Sorry, I just had to do that.)

Anyway, here's what works for me here in Win2000:

If you want to launch Excel without a document, you first need to find out
where it is located. Since it maps to the .xls extension, you need to look
in the Registry to get the type of Excel document on the target machine:

     put queryRegistry("HKEY_CLASSES_ROOT\.xls\") into sheetType

     On my machine returned >> Excel.Sheet.8

Then, you need to take the returned value, and look *it* up in the registry
to find the path to the Excel app:

     put queryRegistry("HKEY_CLASSES_ROOT\" & sheetType &
"\shell\Open\command\") into excelPath

     On my machine returned >> "C:\Program Files\Microsoft
Office\Office\EXCEL.EXE" /e

Then you just strip off the nasty bits to get the path:

     put value(word 1 of excelPath) into truePath

     >> C:\Program Files\Microsoft Office\Office\EXCEL.EXE

And finally, do an "open process for neither".

Here's the complete code:

on mouseUp
  put queryRegistry("HKEY_CLASSES_ROOT\.xls\") into sheetType
  put queryRegistry("HKEY_CLASSES_ROOT\" & sheetType &
"\shell\Open\command\") into excelPath
  put value(word 1 of excelPath) into truePath
  open process truePath for neither
end mouseUp

Voila!

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/


----- Original Message -----
From: "Magnus von Brömsen" <webmaster at studioalice.se>
To: <use-revolution at lists.runrev.com>
Sent: Wednesday, March 27, 2002 9:48 AM
Subject: Launch another application?


> Hello
>
> I want to start Excel from a button in a standalone on Windows. (I know
> that this has been an issue before,) but I have tried every possible
> solution:
>
> on mouseUp
>    launch "Acrobat Reader 5.0"
> end mouseUp
>
> on mouseUp
>    open process "Acrobat Reader 5.0" for neither
> end mouseUp
>
> and the tip from Ken Ray:
>
> > on mouseUp
> >   set the hideConsoleWindows to true
> >   get shell("C:\myfile.pdf")
> >   answer "Thank you!"
> > end mouseUp
> >
> But nothing seems to work. Every help will be very nice.
>
> /magnus
>
>
> -------------------------------------------------------------------
> "Bränt barn skyr Windows."
> -------------------------------------------------------------------
> Studio Alice
> Magnus von Brömsen
> 0702-212 495
> 0322-633 833
> www.studioalice.se
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list