当前位置:网站首页>Beauty of script │ VBS introduction interactive practice
Beauty of script │ VBS introduction interactive practice
2022-06-24 11:05:00 【Geek flying rabbit】
One 、 What is? VBS
VBSIt's a kind ofWindowsScripting language , The full name isMicrosoft Visual Basic Script Editon, Microsoft Visualization BASIC Script versionvbsIt's built-in , The code can be found inwindowsDirect execution in the system , No compilation environment is required , Very convenientvbsThe script is simple , Efficient , Most functions can be realized , Make good use ofvbsScript , Can greatly improve the efficiency , It can be used to do some repeated and tedious machine operations
Two 、 first VBS Script
- Create a new text document on the desktop
- Open a text document , Type in
msgbox "Hello World!" - Suffix the format of the text document
.txtChange it to.vbs - Then double click the run file

3、 ... and 、msgbox grammar
- grammar :
msgbox " Dialog content "," Dialog type ( Parameters :0,1,2,3,4,5)"," Dialog title " - Dialog content : It refers to the main content of the pop-up window
- Dialog type : You can choose
0-5common 6 Three types of dialog modes ,0 The dialog box only hasOK button;1 The dialog box hasOK button、Cancel button;2 The dialog box hasStop button、Retry button、Ignore button;3 The dialog box hasIt's a button、No button、Cancel button;4 The dialog box hasIt's a button、No buttonAnd it is forbidden to click on the... In the upper right corner of the dialog boxcloseButton ;5 The dialog box hasRetry button、Cancel button. If you don't fill in the silent opinion 0 - Dialog title : It refers to the title of the pop-up window
msgbox " Brother flying rabbit gives you a prize to receive ", 3, " Warm reminder "

Four 、 Chinese garbled
- You can see the Chinese garbled code in the above figure
- This is mainly caused by coding errors , The encoding format of a normal text document is
UTF-8Of , howeverVBSThe script needs to be encoded inANSICan run Chinese normally - At this time we need
Open a text document►Click on the file in the upper left corner►Save as►Select code as ANSI►determineCan solve

5、 ... and 、 Pop up interactive function
- We just implemented a very simple display function , Then we need to implement the interactive function , Variables are needed
- stay
vbsThroughdimDefining variables , The grammar is :dim Variable name 1, Variable name 2, Variable name 3... Variable name n - among
inputboxIt can be used to receive parameters manually entered by the user
dim name
name = inputbox(" Please tell me who you are ", " This is the title of the interaction ")
msgbox name,," Welcome "


6、 ... and 、 Confession mischief
- Before the very fire can not close the confession pop-up window , Namely
vbsmake - Use
dim a(5)You can define arrays ,5 Indicates how many elements are in the array - Use
Select CaseIndicates that this is an option - The return value of the selected consent is 6, The return value of disagree is 7
- If you click disagree , Then loop through the array to show
- If the user clicks agree , Then the plot will succeed , Exit options
MsgBox " The Buddha cries for "
MsgBox " Naihe bridge waits "
MsgBox " Look back 500 times "
MsgBox " Looking back over the millennia "
MsgBox " The reincarnation of all ages "
MsgBox " Change your present life love "
MsgBox " Would you please "
dim a(5)
a(0)=" Tian Da , Big land , Girlfriend is the biggest "
a(1)=" Pay up "
a(2)=" Write your name in the room "
a(3)=" Help clear the shopping cart "
a(4)=" Baoda "
a(5)=" Just promise me to ^o^"
Dim j
Do
Select Case msgbox (" The girl , Be my girlfriend ", 4)
Case 6
MsgBox "you are my girlfriend," + Chr(13) + "from this day until to my last days."
exit do
Case 7
msgbox a(i)
i=i+1
if i >= 6 then
i = 0
end if
end Select
Loop


边栏推荐
- How to convert an array to an object, and how to convert an object to an array
- 如何只导出word文档中的标题?(即将正文内容都删除,只保留标题)B站牛逼
- Rising bubble canvas breaking animation JS special effect
- Simple pricelist style code
- SQL Server about like operator (including the problem of field data automatically filling in spaces)
- Any and typevar make the automatic completion of IDE better
- ≥ 2012r2 configure IIS FTP
- Spark submission parameter -- use of files
- 脚本之美│VBS 入门交互实战
- "One good programmer is worth five ordinary programmers!"
猜你喜欢

Today in history: Turing's birth day; The birth of the founder of the Internet; Reddit goes online

MYSQL_ Elaborate on database data types

Plant growth H5 animation JS special effect

機械臂速成小指南(二):機械臂的應用
![[JS reverse sharing] community information of a website](/img/71/8b77c6d229b1a8301a55dada08b74f.png)
[JS reverse sharing] community information of a website

脚本之美│VBS 入门交互实战

Window function row in SQL Server_ number()rank()dense_ rank()
![[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)](/img/d6/8c20944ce354c9619a61a73f2c72b1.png)
[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)

SQL Server about like operator (including the problem of field data automatically filling in spaces)
![[graduation season · attacking technology Er] three turns around the tree, what branch can we rely on?](/img/0a/0ebfa1e5c1bea6033b538528242252.png)
[graduation season · attacking technology Er] three turns around the tree, what branch can we rely on?
随机推荐
今日睡眠质量记录76分
突然想到老家的木屋
Cloud vendor secondary virtualization restrictions
How to open a video number?
Svg+js drag slider round progress bar
cuda runtime error (801) : Raw out
Suddenly I thought of the wooden house in my hometown
Window function row in SQL Server_ number()rank()dense_ rank()
Besides technology, programmers also need to master a skill - self marketing ability
What is the function of the graphics card driver? Do you want to update the graphics card driver
服乔布斯不服库克,苹果传奇设计团队解散内幕曝光
Spark submission parameter -- use of files
Group policy export import
Learn how to use PHP to filter special symbols in strings
Quick completion guide for mechanical arm (zero): main contents and analysis methods of the guide
把騰訊搬到雲上,治愈了他們的技術焦慮
Quick completion guide for mechanical arm (II): application of mechanical arm
Network monitoring: active troubleshooting becomes simple
P5.js paper crane animation background JS special effect
历史上的今天:图灵诞生日;互联网奠基人出生;Reddit 上线