?
Solved

check box in .vbs script

Posted on 2004-11-30
6
Medium Priority
?
1,688 Views
Last Modified: 2006-11-17
Is it possible to put a checkbox in a .vbs script?

If yes, I want to make a .vbs script that will start in windows startup. It should ask what registry setting you want to run by checking an checkbox.

regards,
Martijn
0
Comment
Question by:mvanthof
  • 3
  • 2
6 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 12705369
Not as far as I know.  VBScript doesn't have a GUI interface, except for the Input and Echo commands.
0
 

Author Comment

by:mvanthof
ID: 12705494
ok thanks, then another question(125 points) I want to display my IP / DNS-hostname / DNS-domain name ion a msg box.

I have this and want to add the options.

'display message
Message = "You have now access to:" & vbCR & vbCR
Message = Message & "- Regedit" & vbCR
Message = Message & "- Network Connections Properties" & vbCR
Message = Message & "- Internet Options Tabs" & vbCR
Message = Message & "- Changing Wallpaper" & vbCR
Message = Message & "- System in control pannel" & vbCR
Message = Message & "- C-Drive view (after restart)" & vbCR
Message = Message & "- More download connections" & vbCR
Message = Message & "- Faster internet" & vbCR
Message = Message & "- Clear History" & vbCR
Message = Message & "- Start Menu Properties" & vbCR

X = MsgBox(Message, vbOKOnly + vbInformation, "Activate script by MH")
Set WshShell = Nothing
Set fso = Nothing
0
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 12705886
If you want to show what options are available via a message box, you'll have to poll each option and only add it to Message if the permission exists...

The only way to work GUI and VBS(cript) together is via a web form.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 76

Expert Comment

by:David Lee
ID: 12706589
Here's how to get the information you want using WMI:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True", , 48)
For Each objItem In colItems
    If objItem.IPAddress(0) <> "0.0.0.0" Then
        Wscript.Echo "DNSDomain: " & objItem.DNSDomain
        Wscript.Echo "DNSHostName: " & objItem.DNSHostName
        Wscript.Echo "IPAddress: " & objItem.IPAddress(0)
    End If
Next

I don't know how you want to integrate it into your existing message so I'll leave that to you.
0
 

Author Comment

by:mvanthof
ID: 12713458
Ok thanks BlueDevilFa, working great, but how to put this in a existing message box? Now I get 3 msg boxes after my own.

0
 
LVL 76

Accepted Solution

by:
David Lee earned 520 total points
ID: 12713490
Assuming you want to add it on to the message box you showed above, then something like this:


Message = "You have now access to:" & vbCR & vbCR
Message = Message & "- Regedit" & vbCR
Message = Message & "- Network Connections Properties" & vbCR
Message = Message & "- Internet Options Tabs" & vbCR
Message = Message & "- Changing Wallpaper" & vbCR
Message = Message & "- System in control pannel" & vbCR
Message = Message & "- C-Drive view (after restart)" & vbCR
Message = Message & "- More download connections" & vbCR
Message = Message & "- Faster internet" & vbCR
Message = Message & "- Clear History" & vbCR
Message = Message & "- Start Menu Properties" & vbCR

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True", , 48)
For Each objItem In colItems
    If objItem.IPAddress(0) <> "0.0.0.0" Then
        Message = Message & "- DNSDomain: " & objItem.DNSDomain & vbCR
        Message = Message & "- DNSHostName: " & objItem.DNSHostName & vbCR
        Message = Message & "- IPAddress: " & objItem.IPAddress(0) & vbCR
    End If
Next
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question