• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1223
  • Last Modified:

Use lotus scripts to launch applications

I want to create a lotus script, if the attachment is text file, automatically launch the "notepad.exe", if a wav, launch "recorder", if a doc, launch "word", etc. Just like the "launch" button shown in attachment tab works. Is that possible? in the program, first, detach the attachment to a specified location, this is easy to be done, second, launch programs corresponding to the file type, and open the file.
0
zhangjing
Asked:
zhangjing
  • 3
  • 2
  • 2
1 Solution
 
HemanthaKumarCommented:
Yes you can do that by using 'shell' command in lotus script.

Syntax: shell( "program name <filename>",windowstyle)

eg:  t% = Shell ("notepad.exe \Chipset.txt",1)

Good Luck
Hemanth
0
 
zhangjingAuthor Commented:
Yes, I know the Shell function.

But how can I know what is attached to my document? Maybe it's a text file, maybe it's a bitmap, maybe it's a Word......

I want to open different file with different applications, just like the "launch" button do in "Attachment" dialog.

I can't use @Command too, because I want to control where the file will be extract too.
0
 
HemanthaKumarCommented:
Detach the file to a temp directory and pass the filename to the shell function. The file will be opened with the registered application, if file type is not registered, windows will prompt for the application.

Hemanth
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
zhangjingAuthor Commented:
This is what I copied from the Notes help. You know the Shell can't work.

Syntax
Shell ( program [ , windowStyle ] )
Elements
program
A string expression whose value is the name of the program to run, including arguments. program be the name of an executable file that uses a file name extension of BAT, COM, PIF, or EXE. You can omit the file name extension, and you can optionally include a complete path specification.
Using an internal DOS command name generates an error.
0
 
brelCommented:
This "dirty code" it might work.
I've use it in MS Access to launch different files regardless were the registrered application is installed.

Call Shell(Environ$("COMSPEC") & " /c START <detached_file>", 6)

It works fine in NT4 and should also work in W9x.

/Brel
0
 
zhangjingAuthor Commented:
Thank you very much! It works! Although a little ugly, everytime it will first show a black DOS screen, is there anyway to "hide" it? That will be more better. :)
0
 
brelCommented:
In NT4 the DOS screen opens and closes directly then the application is launched. The behavior on W9x I haven't tested.

Your welcome
/Brel
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now