WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

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

 
   Home -> Windows Other -> General Discussion RSS
Next:  Forgotten  
Author Message
Robbie Hatley

External


Since: Nov 16, 2007
Posts: 23



(Msg. 1) Posted: Sat Aug 02, 2008 2:11 am
Post subject: How can I pop up a message from a shell command?
Archived from groups: microsoft>public>win2000>general (more info?)

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
Back to top
Login to vote
"Pegasus

External


Since: Dec 22, 2007
Posts: 396



(Msg. 2) Posted: Sat Aug 02, 2008 12:20 pm
Post subject: Re: How can I pop up a message from a shell command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Robbie Hatley" <lonewolf DeleteThis @well.com> wrote in message
news:4Midnf_288g5uQnVnZ2dnUVZ_vednZ2d@giganews.com...
>
> 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"
Back to top
Login to vote
Robbie Hatley

External


Since: Nov 16, 2007
Posts: 23



(Msg. 3) Posted: Tue Aug 05, 2008 3:52 pm
Post subject: Re: How can I pop up a message from a shell command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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. Smile

Thanks!

--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant
Back to top
Login to vote
"Pegasus

External


Since: Dec 22, 2007
Posts: 396



(Msg. 4) Posted: Wed Aug 06, 2008 3:12 am
Post subject: Re: How can I pop up a message from a shell command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Robbie Hatley" <lonewolf RemoveThis @well.com> wrote in message
news:GsydnYlHop7rRAXVnZ2dnUVZ_rjinZ2d@giganews.com...
>
> 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. Smile
>
> Thanks!
>
> --
> Cheers,
> Robbie Hatley

Thanks for the feedback.
Back to top
Login to vote
Display posts from previous:   
       Home -> Windows Other -> General Discussion All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
  Windows Other
 Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET