Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-28-2004, 09:13 AM
Siltman Siltman is offline
Registered User
 
Join Date: May 2004
Posts: 6
MessageBox Popup Script to Display Information

# $language = "VBScript"
# $interface = "1.0"

Sub Main

cap = "FKey Mappings"

result = crt.Dialog.MessageBox("F1 = TACACS" & Chr(10) & "F2 = WBY Firewall" & Chr(10) & "F3 = INC Firewall" & Chr(10) & "F4 = MLW Firewall" & Chr(10) & "F5 = KAN/BMH Firewall" & Chr(10) & "F6 = Preneed Firewall" & Chr(10) & "F7 = Old combo" & Chr(10) & "F8 = New combo" & Chr(10) & "F9-F11 Tips" & Chr(10) & "F12 = This Message Box", cap)

End Sub


This was my first attempt at using a VBScript other than login scripts. I wanted to make a pop-up box that would display information back to me with text + carriage returns to manuever the text the way I wanted it. I have this as my F12 key and it displays what my other eleven Fkeys are mapped too.

Hopefully another new person to VBscripting may find this useful.

Steve
Reply With Quote
  #2  
Old 08-03-2004, 09:51 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,034
Thumbs up

Nice example!

Here is some additional related information that I hope those new to VBScript will find useful.

Since VBScript is involved, you can make use of the MsgBox function built in to the VBScript engine.

In addition, there is a trick for continuing one line onto the next using the '_' (underscore) character at the end of a line of text so the interpreter will consider the next line as a continuation of the current line. This (arguably) adds to better code readability.

For example:
Code:
   MsgBox "F1 = TACACS" & vblf & _
          "F2 = WBY Firewall" & vblf & _
          "F3 = INC Firewall" & vblf & _
          "F4 = MLW Firewall" & vblf & _
          "F5 = KAN/BMH Firewall" & vblf & _
          "F6 = Preneed Firewall" & vblf & _
          "F7 = Old combo" & vblf & _
          "F8 = New combo" & vblf & _
          "F9-F11 Tips" & vblf & _
          "F12 = This Message Box", vbOKOnly, "FKey Mappings"
Also note the usage of vblf as a substitute for chr(10). Other built-in constants similar to vblf are:
vbcr = chr(13)
vbcrlf = chr(13) & chr(10)

I find it is easier for me to type vbcr than to type chr(13) , so I have found these VBScript built-ins to be very helpful.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:59 AM.