Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Greeting 1

Status
Not open for further replies.

stuarta99

IS-IT--Management
Oct 12, 2007
6
GB
Hi,

I'm trying to create a logon script and have my mappings and everything working, but struggling with the Greetings.

I have this at the moment

' let's display a welcome message
dim sTime, sDate, strUser
sTime = Hour (now)
sDate = Now
strUser = objnetwork.UserName

If sTime <=11 Then
GreetingTime = "Morning"
ElseIf sTime <=18 Then
GreetingTime = "Afternoon"
Else
GreetingTime = "Evening"
End If


msgbox "Good " & GreetingTime & " " & strUser & "!"
msgbox "You are now being logged into the system"
Dim t
For t = 1 To 100

next


I want it to stop asking the user to click ok and just prompt that it's happening and not require input.

Thanks
 
Have a look at the WshShell.Popup method

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yep looked at this, but I couldn't get it to work with returning the GreetingTime
 
Instead of a pop up, why don't you have the computer just talk to the user? Refer to my login script FAQ for sample code.

faq329-5798

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Yep did look at them, very nice.

On another script, it's using smessage, but I can't work out how to reuse this.
 
Using PHV's suggestion, you would need the following items in your code

This code would be listed at the start of your script

Code:
Set WshShell = CreateObject("WScript.Shell")

Each time you want a popup message to appear, simply use a variation of the script below

Code:
WshShell.Popup "Title",2,"Message Text"

Replace "Title" for your message popup title, 2 for the amount of seconds you want the popup to appear (I find 2 seconds acceptable for what I use it for), and "Message Text" with the text of your message.

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
ok thankyou. How can I include the following though

"Good " & GreetingTime & " " & strUser & "!"

I have the script before recognising what the time is and sending that to the GreetingTime so that it then prints depending on the time of day and then the user's name.
 
Code:
WshShell.Popup "Greetings",2,"Good " & GreetingTime & " " & strUser & "!"

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
ok thank you. I'll give this ago when I'm back in my office on Monday.
 
Excellent. Swapped a couple of the variables around and all works now.

WshShell.Popup "Good " & GreetingTime & " " & strUser & "!" ,2, "Welcome"

WshShell.Popup "You are now being logged into the system",2, "Log on"


Now to add my proxy configuration check.
 
Was just about to post that I had the Title and Message Text variables round the wrong way, sorry!!

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top