Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Windows 2000

How can I pop up a message from a shell command?

 
Jump to:  
 
Robbie Hatley
PostPosted: Sat Aug 02, 2008 7:11 am    Post subject: How can I pop up a message from a shell command?
       
I have a program that can open certain types of files (such as
yenc-encoded data files) only from within itself, one of the reasons
being that such files have no standard extension, hence the program
requires the user to specify operations to be performed by clicking
one of several buttons in the program's GUI, before opening the file.

Hence trying to use file associations ("MyProg.exe" "%1") won't work,
because the program has no idea of WHAT you want to do with the
file after opening it.

SO, I put a reminder line in the shell in the registry, like so:

KEY: VALUE:
HKEY_CLASSES_ROOT
.ntx (default) = "yenc_data_file"
yenc_data_file (default) = "Yenc-Encoded Data File"
shell (default) = "launch_myprog"
launch_myprog (default) = "Plz launch MyProg manually."
command (default) = "" [empty string]

Since the command is an empty string, clicking it pops up a std
Windows error message:

"This file does not have a program associated with it for
performing this action. Create an association in the
Folder Options control panel."

Which is invalid advice, because file associations simply cannot
work in this situation.

SO, how do i pop up my OWN message instead, say:

"This file cannot be opened through the shell. Please
launch MyProg manually, specify action to be performed,
then navigate to the file from within MyProg."

Preferably this would be accompanied by the "Critical Stop" event
sound (which, on my computer, is Hal9000 saying "Sorry Dave, I'm
afraid I can't do that".)

Basically, I'm asking if there is a service available in Win2K
which can pop up message boxes with user defined text, either
via registry shell commands, or from within scripts or programs?
(Simultaneously playing a selectable event sound would be a bonus.)

Or perhaps there is a way to access the MessageBox API (I think
it's in user32.dll?) more directly? I could do that from within
a C program, but I don't know how to do it from within the registry.

--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant
 

 
Pegasus (MVP)
PostPosted: Sat Aug 02, 2008 8:20 am    Post subject: Re: How can I pop up a message from a shell command?
       
"Robbie Hatley" <lonewolf@well.com> wrote in message
news:4Midnf_288g5uQnVnZ2dnUVZ_vednZ2d@giganews.com...
Quote:

I have a program that can open certain types of files (such as
yenc-encoded data files) only from within itself, one of the reasons
being that such files have no standard extension, hence the program
requires the user to specify operations to be performed by clicking
one of several buttons in the program's GUI, before opening the file.

Hence trying to use file associations ("MyProg.exe" "%1") won't work,
because the program has no idea of WHAT you want to do with the
file after opening it.

SO, I put a reminder line in the shell in the registry, like so:

KEY: VALUE:
HKEY_CLASSES_ROOT
.ntx (default) = "yenc_data_file"
yenc_data_file (default) = "Yenc-Encoded Data File"
shell (default) = "launch_myprog"
launch_myprog (default) = "Plz launch MyProg manually."
command (default) = "" [empty string]

Since the command is an empty string, clicking it pops up a std
Windows error message:

"This file does not have a program associated with it for
performing this action. Create an association in the
Folder Options control panel."

Which is invalid advice, because file associations simply cannot
work in this situation.

SO, how do i pop up my OWN message instead, say:

"This file cannot be opened through the shell. Please
launch MyProg manually, specify action to be performed,
then navigate to the file from within MyProg."

Preferably this would be accompanied by the "Critical Stop" event
sound (which, on my computer, is Hal9000 saying "Sorry Dave, I'm
afraid I can't do that".)

Basically, I'm asking if there is a service available in Win2K
which can pop up message boxes with user defined text, either
via registry shell commands, or from within scripts or programs?
(Simultaneously playing a selectable event sound would be a bonus.)

Or perhaps there is a way to access the MessageBox API (I think
it's in user32.dll?) more directly? I could do that from within
a C program, but I don't know how to do it from within the registry.

--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant

You can set "command" to this string: wscript c:\winnt\msg.vbs
then put the following lines into c:\winnt\msg.vbs:
CR = chr(10)
Set objArgs = WScript.Arguments
if objArgs.count > 0 then parm = objArgs(0) else parm="this program"
msgbox "This file cannot be opened through the shell. " & CR & CR _
& "Please launch MyProg manually, specify action to be performed," & CR _
& "then navigate to the file from within " & parm & ".", 0, _
"File Association Notice"
 

 
Robbie Hatley
PostPosted: Tue Aug 05, 2008 8:52 pm    Post subject: Re: How can I pop up a message from a shell command?
       
I'd asked:

Quote:
Basically, I'm asking if there is a service available in Win2K
which can pop up message boxes with user defined text, either
via registry shell commands, or from within scripts or programs?
(Simultaneously playing a selectable event sound would be a bonus.)

and "Pegasus (MVP)" replied:

Quote:
You can set "command" to this string: wscript c:\winnt\msg.vbs
then put the following lines into c:\winnt\msg.vbs:
CR = chr(10)
Set objArgs = WScript.Arguments
if objArgs.count > 0 then parm = objArgs(0) else parm="this program"
msgbox "This file cannot be opened through the shell. " & CR & CR _
& "Please launch MyProg manually, specify action to be performed," & CR _
& "then navigate to the file from within " & parm & ".", 0, _
"File Association Notice"

Excellent! Yes, that works great. Thanks for the solution!

I did tweak it slightly. On researching msgbox, i found that if
I change the "0" to "16", it plays the "Critical Stop" event sound,
exactly as desired. :-)

Thanks!

--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant
 

 
Pegasus (MVP)
PostPosted: Wed Aug 06, 2008 3:45 am    Post subject: Re: How can I pop up a message from a shell command?
       
"Robbie Hatley" <lonewolf@well.com> wrote in message
news:GsydnYlHop7rRAXVnZ2dnUVZ_rjinZ2d@giganews.com...
Quote:

I'd asked:

Basically, I'm asking if there is a service available in Win2K
which can pop up message boxes with user defined text, either
via registry shell commands, or from within scripts or programs?
(Simultaneously playing a selectable event sound would be a bonus.)

and "Pegasus (MVP)" replied:

You can set "command" to this string: wscript c:\winnt\msg.vbs
then put the following lines into c:\winnt\msg.vbs:
CR = chr(10)
Set objArgs = WScript.Arguments
if objArgs.count > 0 then parm = objArgs(0) else parm="this program"
msgbox "This file cannot be opened through the shell. " & CR & CR _
& "Please launch MyProg manually, specify action to be performed," & CR
_
& "then navigate to the file from within " & parm & ".", 0, _
"File Association Notice"

Excellent! Yes, that works great. Thanks for the solution!

I did tweak it slightly. On researching msgbox, i found that if
I change the "0" to "16", it plays the "Critical Stop" event sound,
exactly as desired. :-)

Thanks!

--
Cheers,
Robbie Hatley

Thanks for the feedback.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

bingo online zabawki edukacyjne zasiƂek uchwyty lcd Parkiet