Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Message Box

HTVi
TV Discussion Newsgroups

Message Box
"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> 6/30/2007 5:04:32 PM
i have this script and i have it working the only thing is i need the no
button to logoff the workstation and i need to remove the x from the top
right, i am also just wondering wether it can be written so that you press
no it counts down from 10 to 0 then executes logoff.exe. I have been trying
all day for a response and nobody wants to know so far, i really need it
before the end of the day.

select case msgbox("{conditions of use text goes here}", _
vbquestion or vbyesno)
case vbyes
msgbox "having agreed, you may use this computer"
case vbno
msgbox "having NOT agreed, you should immediately log out"
end select


Re: Message Box
"B-Mann" <RemoveSpaces(b __ m a n n [ at ] h o t m a i l.c o m)> 6/30/2007 8:07:57 PM

"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
[Quoted Text]
>i have this script and i have it working the only thing is i need the no
>button to logoff the workstation and i need to remove the x from the top
>right, i am also just wondering wether it can be written so that you press
>no it counts down from 10 to 0 then executes logoff.exe. I have been
>trying all day for a response and nobody wants to know so far, i really
>need it before the end of the day.
>
> select case msgbox("{conditions of use text goes here}", _
> vbquestion or vbyesno)
> case vbyes
> msgbox "having agreed, you may use this computer"
> case vbno
> msgbox "having NOT agreed, you should immediately log out"
> end select
>
>

Ok, I had something that I modified to accommodate your request.
I agree with the others that this can be easily implemented through
Group Policy...

Scrap your msgbox and use an HTML Application instead.

Save the following to "agreement.hta".
========8<========================
<html>
<head>
<title>Agreement</title>

<HTA:APPLICATION
ID = "oApp"
APPLICATIONNAME = "Agreement"
BORDER = "dialog"
CAPTION = "No"
ICON = ""
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "yes"
SYSMENU = "yes"
WINDOWSTATE = "normal"
SCROLL = "no"
SCROLLFLAT = "no"
VERSION = "1.0"
INNERBORDER = "yes"
SELECTION = "no"
MAXIMIZEBUTTON = "no"
MINIMIZEBUTTON = "no"
NAVIGABLE = "no"
CONTEXTMENU = "no"
BORDERSTYLE = "raised"
/HTA:APPLICATION>

</head>
<style>

BODY
{
background-color: lightblue;
COLOR: black;
FONT-FAMILY: Verdana,Helv,Arial;
FONT-SIZE: 8pt;
FONT-WEIGHT: normal;
}

th
{
valign:top;
align:center;
color:green;
font-weight:bold;
font-size:20;
}

td
{
valign:top;
align:left;
color:black;
font-weight:normal;
}

..footer
{
width:'98%';
height:'10';
}

..header
{
color:green;
font-weight:bold;
font-size:32;
font-style:italic;
border-width:1px;
border-style:ridge;
}
</style>
<body onload="javascript:window.resizeTo(400, 400);
window.moveTo((screen.availWidth-400)/2,(screen.availHeight-400)/2);"
onunload="javascript:UnloadMe();">

<script language=vbscript>
Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,
(Backup, Security, Shutdown)}!\\.\root\cimv2")
Const EWX_LOGOFF = 0
Const EWX_FORCE = 4
Dim useragree
useragree="No"

Sub Logoff()
Set OpSysSet = oWMIService.ExecQuery("select * from Win32_OperatingSystem
where Primary=true")
for each OpSys in OpSysSet
OpSys.Win32Shutdown EWX_LOGOFF + EWX_FORCE
next
End Sub

Sub No()
useragree="No"
self.close
End Sub

Sub Yes()
useragree="Yes"
self.close
End Sub

Sub UnloadMe()
if useragree<>"Yes" then Logoff
End Sub
</script>

<table width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr align=center valign=middle><td>

<table width="100%" height="100%" cellspacing="5" cellpadding="5">
<tr valign="top" align="center" height="10px"><td>
<div
id="divHeader"
name="divHeader"
class="header">
<script language=javascript>
document.write(oApp.applicationName + ' v' + oApp.version);
</script>
<hr>
</div>
</td></tr>

<tr valign="bottom"><td>
<hr>
<div
id="divFooter"
name="divFooter"
class="footer">
<table width="100%" height="100%" cellspacing="2" cellpadding="2">
<tr valign=bottom align=center><td>
<textarea
id="txtProgress"
rows="12"
cols="35"
style="overflow:scroll;"
readonly></textarea>
</td></tr>
<tr valign="bottom">
<td align="right">
<input
type=button
name=butPrev
value=" Yes "
style="visibility:visible;"
onClick="Yes()">
<input
type=button
name=butNext
value=" No "
onClick="No()">
</td></tr>
</table>
</div>
</td></tr>
</table>
</td></tr>
</table>

</body>
</html>
========8<========================

There is word wrap but you will need to fix this yourself.

You sounded desperate and I was up for a challenge today
so you lucked out! How you implement it is up to you.

I have only tested this on my Windows XP workstation...

Good luck.

B-Mann


Re: Message Box
"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> 6/30/2007 8:37:32 PM
Can you elaborate on what a word wrap is please.

"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
[Quoted Text]
>i have this script and i have it working the only thing is i need the no
>button to logoff the workstation and i need to remove the x from the top
>right, i am also just wondering wether it can be written so that you press
>no it counts down from 10 to 0 then executes logoff.exe. I have been
>trying all day for a response and nobody wants to know so far, i really
>need it before the end of the day.
>
> select case msgbox("{conditions of use text goes here}", _
> vbquestion or vbyesno)
> case vbyes
> msgbox "having agreed, you may use this computer"
> case vbno
> msgbox "having NOT agreed, you should immediately log out"
> end select
>
>

Re: Message Box
"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> 6/30/2007 8:43:40 PM
I dont know hta either so that doesnt really help as such, i dont know waht
a word wrap is and also i dont know how to edit it either to fix it.

"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
[Quoted Text]
>i have this script and i have it working the only thing is i need the no
>button to logoff the workstation and i need to remove the x from the top
>right, i am also just wondering wether it can be written so that you press
>no it counts down from 10 to 0 then executes logoff.exe. I have been
>trying all day for a response and nobody wants to know so far, i really
>need it before the end of the day.
>
> select case msgbox("{conditions of use text goes here}", _
> vbquestion or vbyesno)
> case vbyes
> msgbox "having agreed, you may use this computer"
> case vbno
> msgbox "having NOT agreed, you should immediately log out"
> end select
>
>

Re: Message Box
"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> 6/30/2007 8:44:40 PM
I know that .vbs was better for me because atleast i slightly understand it.
if anyone else has any ideas or better suggestions please help.

"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
[Quoted Text]
>i have this script and i have it working the only thing is i need the no
>button to logoff the workstation and i need to remove the x from the top
>right, i am also just wondering wether it can be written so that you press
>no it counts down from 10 to 0 then executes logoff.exe. I have been
>trying all day for a response and nobody wants to know so far, i really
>need it before the end of the day.
>
> select case msgbox("{conditions of use text goes here}", _
> vbquestion or vbyesno)
> case vbyes
> msgbox "having agreed, you may use this computer"
> case vbno
> msgbox "having NOT agreed, you should immediately log out"
> end select
>
>

Re: Message Box
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 7/3/2007 4:30:58 AM
You cannot disable the "X" in a msgbox - using an HTA is the common
workaround, which is why B-Mann suggested it. And the HTA he provided
contains some VBSCRIPT code to do the logoff for you. All you do is place
the text of his HTA into a file whose name ends with .HTA, and run it.

And, if it fails to run, that could be because perhaps one of the lines he
provided was so long that the software you are using to read his posts
"wrapped" that line. That is what is called "linewrap".

As for better suggestions, that is all we have been giving you. And that
better suggestion is to use the built-in ability of windows to display a
disclaimer notice. This has the advantage of:

- taking you less time to implement than you have spent on this wild goose
chase;
- being a more reliable way to be sure that people read and understand your
usage policies.


/Al

"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
news:092893E4-FC35-4F6D-B32C-1EDD13921F38[ at ]microsoft.com...
[Quoted Text]
>I know that .vbs was better for me because atleast i slightly understand
>it.
> if anyone else has any ideas or better suggestions please help.
>
> "Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
> news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
>>i have this script and i have it working the only thing is i need the no
>>button to logoff the workstation and i need to remove the x from the top
>>right, i am also just wondering wether it can be written so that you press
>>no it counts down from 10 to 0 then executes logoff.exe. I have been
>>trying all day for a response and nobody wants to know so far, i really
>>need it before the end of the day.
>>
>> select case msgbox("{conditions of use text goes here}", _
>> vbquestion or vbyesno)
>> case vbyes
>> msgbox "having agreed, you may use this computer"
>> case vbno
>> msgbox "having NOT agreed, you should immediately log out"
>> end select
>>
>>
>


Re: Message Box
"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> 7/3/2007 8:28:08 AM
This is a multi-part message in MIME format.

------=_NextPart_000_0103_01C7BD54.789A0210
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=response
Content-Transfer-Encoding: 7bit

can someone fix the word wrap on this for me or atleat point out what i need
to move around.


"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
news:%23LjZasSvHHA.4520[ at ]TK2MSFTNGP02.phx.gbl...
[Quoted Text]
> You cannot disable the "X" in a msgbox - using an HTA is the common
> workaround, which is why B-Mann suggested it. And the HTA he provided
> contains some VBSCRIPT code to do the logoff for you. All you do is place
> the text of his HTA into a file whose name ends with .HTA, and run it.
>
> And, if it fails to run, that could be because perhaps one of the lines he
> provided was so long that the software you are using to read his posts
> "wrapped" that line. That is what is called "linewrap".
>
> As for better suggestions, that is all we have been giving you. And that
> better suggestion is to use the built-in ability of windows to display a
> disclaimer notice. This has the advantage of:
>
> - taking you less time to implement than you have spent on this wild goose
> chase;
> - being a more reliable way to be sure that people read and understand
> your usage policies.
>
>
> /Al
>
> "Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
> news:092893E4-FC35-4F6D-B32C-1EDD13921F38[ at ]microsoft.com...
>>I know that .vbs was better for me because atleast i slightly understand
>>it.
>> if anyone else has any ideas or better suggestions please help.
>>
>> "Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
>> news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
>>>i have this script and i have it working the only thing is i need the no
>>>button to logoff the workstation and i need to remove the x from the top
>>>right, i am also just wondering wether it can be written so that you
>>>press no it counts down from 10 to 0 then executes logoff.exe. I have
>>>been trying all day for a response and nobody wants to know so far, i
>>>really need it before the end of the day.
>>>
>>> select case msgbox("{conditions of use text goes here}", _
>>> vbquestion or vbyesno)
>>> case vbyes
>>> msgbox "having agreed, you may use this computer"
>>> case vbno
>>> msgbox "having NOT agreed, you should immediately log out"
>>> end select
>>>
>>>
>>
>
>

------=_NextPart_000_0103_01C7BD54.789A0210
Content-Type: application/hta;
name="agreement.hta"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="agreement.hta"

<html>
<head>
<title>Agreement</title>

<HTA:APPLICATION
ID =3D "oApp"
APPLICATIONNAME =3D "License Agreement"
BORDER =3D "dialog"
CAPTION =3D "No"
ICON =3D ""
SHOWINTASKBAR =3D "no"
SINGLEINSTANCE =3D "yes"
SYSMENU =3D "yes"
WINDOWSTATE =3D "normal"
SCROLL =3D "no"
SCROLLFLAT =3D "no"
VERSION =3D "1.1"
INNERBORDER =3D "yes"
SELECTION =3D "no"
MAXIMIZEBUTTON =3D "no"
MINIMIZEBUTTON =3D "no"
NAVIGABLE =3D "no"
CONTEXTMENU =3D "no"
BORDERSTYLE =3D "raised"
/HTA:APPLICATION>

</head>
<style>

BODY
{
background-color: lightblue;
COLOR: black;
FONT-FAMILY: Verdana,Helv,Arial;
FONT-SIZE: 8pt;
FONT-WEIGHT: normal;
}

th
{
valign:top;
align:center;
color:green;
font-weight:bold;
font-size:20;
}

td
{
valign:top;
align:left;
color:black;
font-weight:normal;
}

..footer
{
width:'98%';
height:'10';
}

..header
{
color:green;
font-weight:bold;
font-size:32;
font-style:italic;
border-width:1px;
border-style:ridge;
}
</style>
<body onload=3D"javascript:window.resizeTo(400, 400);
window.moveTo((screen.availWidth-400)/2,(screen.availHeight-400)/2);"
onunload=3D"javascript:UnloadMe();">

<script language=3Dvbscript>
Set oWMIService =3D =
GetObject("winmgmts:{impersonationLevel=3Dimpersonate,=20
(Backup, Security, Shutdown)}!\\.\root\cimv2")
Const EWX_LOGOFF =3D 0
Const EWX_FORCE =3D 4
Dim useragree
useragree=3D"No"

Sub Logoff()
Set OpSysSet =3D oWMIService.ExecQuery("select * from =
Win32_OperatingSystem=20
where Primary=3Dtrue")
for each OpSys in OpSysSet
OpSys.Win32Shutdown EWX_LOGOFF + EWX_FORCE
next
End Sub

Sub No()
useragree=3D"No"
self.close
End Sub

Sub Yes()
useragree=3D"Yes"
self.close
End Sub

Sub UnloadMe()
if useragree<>"Yes" then Logoff
End Sub
</script>

<table width=3D"100%" height=3D"100%" cellspacing=3D"0" =
cellpadding=3D"0">
<tr align=3Dcenter valign=3Dmiddle><td>

<table width=3D"100%" height=3D"100%" cellspacing=3D"5" =
cellpadding=3D"5">
<tr valign=3D"top" align=3D"center" height=3D"10px"><td>
<div
id=3D"divHeader"
name=3D"divHeader"
class=3D"header">
<script language=3Djavascript>
document.write(oApp.applicationName + ' v' + oApp.version);
</script>
<hr>
</div>
</td></tr>

<tr valign=3D"bottom"><td>
<hr>
<div
id=3D"divFooter"
name=3D"divFooter"
class=3D"footer">
<table width=3D"100%" height=3D"100%" cellspacing=3D"2" =
cellpadding=3D"2">
<tr valign=3Dbottom align=3Dcenter><td>
<textarea
id=3D"txtProgress"
rows=3D"12"
cols=3D"35"
style=3D"overflow:scroll;"
readonly></textarea>
</td></tr>
<tr valign=3D"bottom">
<td align=3D"right">
<input
type=3Dbutton
name=3DbutPrev
value=3D" Yes "
style=3D"visibility:visible;"
onClick=3D"Yes()">
<input
type=3Dbutton
name=3DbutNext
value=3D" No "
onClick=3D"No()">
</td></tr>
</table>
</div>
</td></tr>
</table>
</td></tr>
</table>

</body>
</html>
------=_NextPart_000_0103_01C7BD54.789A0210--

Re: Message Box
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 7/5/2007 3:17:36 AM
On "this" I don't think there is any wordwrap - assuming that by "this" you
mean the very short script shown a few lines down. If you mean the longer
HTA that B-Mann provided, what makes you think it is wordwrapped?

Also, please realize that:

- The word-wrapping I see might be different from what you see, as I think
it is a function of the newsreader software one uses.
- If what you see is word-wrapped, and I provide you an unwrapped version,
being the same as the original, you would likely see it word wrapped.

But on the off-chance that what I see is what you see, here are some
possibilities:

This should be one line:

Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,
(Backup, Security, Shutdown)}!\\.\root\cimv2")

this too:

Set OpSysSet = oWMIService.ExecQuery("select * from Win32_OperatingSystem
where Primary=true")

and lines that look like this should not be included in the hta:

========8<========================


As this discussion progresses, I get the distinct feeling that that this
project may be somewhat beyond your means. That would seem one more
excellent reason to accept the advice we have been giving you to stop trying
to re-invent something that is already there.


/Al

"Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
news:OOYdYwUvHHA.2068[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text]
> can someone fix the word wrap on this for me or atleat point out what i
> need
> to move around.
>
>
> "Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
> news:%23LjZasSvHHA.4520[ at ]TK2MSFTNGP02.phx.gbl...
>> You cannot disable the "X" in a msgbox - using an HTA is the common
>> workaround, which is why B-Mann suggested it. And the HTA he provided
>> contains some VBSCRIPT code to do the logoff for you. All you do is place
>> the text of his HTA into a file whose name ends with .HTA, and run it.
>>
>> And, if it fails to run, that could be because perhaps one of the lines
>> he
>> provided was so long that the software you are using to read his posts
>> "wrapped" that line. That is what is called "linewrap".
>>
>> As for better suggestions, that is all we have been giving you. And that
>> better suggestion is to use the built-in ability of windows to display a
>> disclaimer notice. This has the advantage of:
>>
>> - taking you less time to implement than you have spent on this wild
>> goose
>> chase;
>> - being a more reliable way to be sure that people read and understand
>> your usage policies.
>>
>>
>> /Al
>>
>> "Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
>> news:092893E4-FC35-4F6D-B32C-1EDD13921F38[ at ]microsoft.com...
>>>I know that .vbs was better for me because atleast i slightly understand
>>>it.
>>> if anyone else has any ideas or better suggestions please help.
>>>
>>> "Matt Setters" <mattsetters[ at ]blueyonder.co.uk> wrote in message
>>> news:33F6CDA6-D477-4787-98A5-0251348A69A9[ at ]microsoft.com...
>>>>i have this script and i have it working the only thing is i need the no
>>>>button to logoff the workstation and i need to remove the x from the top
>>>>right, i am also just wondering wether it can be written so that you
>>>>press no it counts down from 10 to 0 then executes logoff.exe. I have
>>>>been trying all day for a response and nobody wants to know so far, i
>>>>really need it before the end of the day.
>>>>
>>>> select case msgbox("{conditions of use text goes here}", _
>>>> vbquestion or vbyesno)
>>>> case vbyes
>>>> msgbox "having agreed, you may use this computer"
>>>> case vbno
>>>> msgbox "having NOT agreed, you should immediately log out"
>>>> end select
>>>>
>>>>
>>>
>>
>>
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen