Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - VbSystemModal type functionality for Read-Host input

Reply
 
Old 01-22-2009   #1 (permalink)
trsix


 
 

VbSystemModal type functionality for Read-Host input

Hi, Ive got a question regarding "Read-Host" input.

In vbscript, you can use vbSystemModal to make your input box always stay on
top even if you lose focus (the way task manager does) .

Is there any way of achieving the same results with "Read-Host" input?
(running from within a .ps1 script)

Thanks for any input

My System SpecsSystem Spec
Old 01-23-2009   #2 (permalink)
trsix


 
 

Re: VbSystemModal type functionality for Read-Host input

> Sorry, you're trying to duplicate read-host via a GUI? I have the
Quote:

> latest v2, and although help shows me a "-Gui" switch, it isn't working
> on XP SP2.
>
> This is a cmdlet though. You could overwrite that with a function of
> you're liking. I'm sure .NET has a way to handle this, otherwise the
> prompting from WSH/VBScript takes a model #, if I remember correctly.
>
> Marco
Yes, I have a script which basically runs mundane tasks for me but requires
user input sometimes. When I run the script from PowerGUI Script Editor
(instead of from the powershell prompt) the Read-Host pops up what looks like
an VBInputBox.

I like the idea of writing my own cmdlet that would basically do what I want
it to, but... like most of my scripting/programming, I'm self taught.

Do you have a site in mind which would have a tutorial or something that
closely address my situation?

Creating an inputbox that stays on top regardless of focus.

Ill do some searching but please post if you have any ideas.

six
My System SpecsSystem Spec
Old 01-23-2009   #3 (permalink)
BJ


 
 

Re: VbSystemModal type functionality for Read-Host input

On 23 Jan., 17:15, trsix <tr...@xxxxxx> wrote:
Quote:
Quote:

> > Sorry, you're trying to duplicate read-host via a GUI? *I have the
> > latest v2, and although help shows me a "-Gui" switch, it isn't working
> > on XP SP2.
>
Quote:

> > This is a cmdlet though. *You could overwrite that with a function of
> > you're liking. *I'm sure .NET has a way to handle this, otherwise the
> > prompting from WSH/VBScript takes a model #, if I remember correctly.
>
Quote:

> > Marco
>
> Yes, I have a script which basically runs mundane tasks for me but requires
> user input sometimes. *When I run the script from PowerGUI Script Editor
> (instead of from the powershell prompt) the Read-Host pops up what looks like
> an VBInputBox.
>
> I like the idea of writing my own cmdlet that would basically do what I want
> it to, but... like most of my scripting/programming, I'm self taught.
>
> Do you have a site in mind which would have a tutorial or something that
> closely address my situation?
>
> Creating an inputbox that stays on top regardless of focus.
>
> Ill do some searching but please post if you have any ideas.
>
> six
Hello trsix,
have a look at this Technet Scriptcenter "Powershell Tip of the Week"

http://www.microsoft.com/technet/scr...pstip0208.mspx

Regards
BJ
My System SpecsSystem Spec
Old 01-23-2009   #4 (permalink)
BJ


 
 

Re: VbSystemModal type functionality for Read-Host input

On 23 Jan., 17:15, trsix <tr...@xxxxxx> wrote:
Quote:
Quote:

> > Sorry, you're trying to duplicate read-host via a GUI? *I have the
> > latest v2, and although help shows me a "-Gui" switch, it isn't working
> > on XP SP2.
>
Quote:

> > This is a cmdlet though. *You could overwrite that with a function of
> > you're liking. *I'm sure .NET has a way to handle this, otherwise the
> > prompting from WSH/VBScript takes a model #, if I remember correctly.
>
Quote:

> > Marco
>
> Yes, I have a script which basically runs mundane tasks for me but requires
> user input sometimes. *When I run the script from PowerGUI Script Editor
> (instead of from the powershell prompt) the Read-Host pops up what looks like
> an VBInputBox.
>
> I like the idea of writing my own cmdlet that would basically do what I want
> it to, but... like most of my scripting/programming, I'm self taught.
>
> Do you have a site in mind which would have a tutorial or something that
> closely address my situation?
>
> Creating an inputbox that stays on top regardless of focus.
>
> Ill do some searching but please post if you have any ideas.
>
> six
You can use the static InputBox-Method in the Microsoft.VisualBasic
Namespace in .NET as well

http://msdn.microsoft.com/en-us/libr....inputbox.aspx

Use this syntax to call the Method within Powershell:

[microsoft.VisualBasic.Interaction]::InputBox("Give me
input","InputBox")

Regards
BJ
My System SpecsSystem Spec
Old 01-24-2009   #5 (permalink)
BJ


 
 

Re: VbSystemModal type functionality for Read-Host input

On 23 Jan., 23:23, BJ <p...@xxxxxx> wrote:
Quote:

> On 23 Jan., 17:15, trsix <tr...@xxxxxx> wrote:
>
>
>
>
>
Quote:
Quote:

> > > Sorry, you're trying to duplicate read-host via a GUI? *I have the
> > > latest v2, and although help shows me a "-Gui" switch, it isn't working
> > > on XP SP2.
>
Quote:
Quote:

> > > This is a cmdlet though. *You could overwrite that with a function of
> > > you're liking. *I'm sure .NET has a way to handle this, otherwise the
> > > prompting from WSH/VBScript takes a model #, if I remember correctly.
>
Quote:
Quote:

> > > Marco
>
Quote:

> > Yes, I have a script which basically runs mundane tasks for me but requires
> > user input sometimes. *When I run the script from PowerGUI Script Editor
> > (instead of from the powershell prompt) the Read-Host pops up what looks like
> > an VBInputBox.
>
Quote:

> > I like the idea of writing my own cmdlet that would basically do what Iwant
> > it to, but... like most of my scripting/programming, I'm self taught.
>
Quote:

> > Do you have a site in mind which would have a tutorial or something that
> > closely address my situation?
>
Quote:

> > Creating an inputbox that stays on top regardless of focus.
>
Quote:

> > Ill do some searching but please post if you have any ideas.
>
Quote:

> > six
>
> You can use the static InputBox-Method in the Microsoft.VisualBasic
> Namespace in .NET as well
>
> http://msdn.microsoft.com/en-us/libr...lbasic.interac...
>
> Use this syntax to call the Method within Powershell:
>
Forget to mention that this needs the Microsoft.VisualBasic Assembly
Load it first:
[reflection.assembly]::loadwithpartialname("Microsoft.VisualBasic")
Quote:

> [microsoft.VisualBasic.Interaction]::InputBox("Give me
> input","InputBox")
>
> Regards
> BJ- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
write into an <input type=file> field VB Script
Input Type Hidden and Checkbox? VB Script
Read-Host issue, won't store to variable when using multiple read-host lines PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46