当前位置:网站首页>Beauty of script │ VBS introduction interactive practice
Beauty of script │ VBS introduction interactive practice
2022-06-23 22:25:00 【InfoQ】
One 、 What is? VBS
VBSIt's a kind ofWindowsScripting language , The full name isMicrosoft Visual Basic Script Editon, Microsoft Visualization BASIC Script version
vbsIt's built-in , The code can be found inwindowsDirect execution in the system , No compilation environment is required , Very convenient
vbsThe 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

边栏推荐
- TMUX support, file transfer tool Trz / Tsz (trzsz) similar to RZ / SZ
- How to wrap QR code data
- In the new easygbs kernel version, the intranet mapping to the public network cannot be played. How to troubleshoot?
- Nanny level anti crawling teaching, JS reverse implementation of font anti crawling
- How to set the life cycle of API gateway
- 在宇宙的眼眸下,如何正确地关心东数西算?
- How does the fortress remote login server operate? What is the application value of Fortress machine?
- Tencent News's practice based on Flink pipeline model
- EDI mandatory manual
- How to build the server fortress machine? What is the function of the fortress machine?
猜你喜欢

Pourquoi une seule valeur apparaît - elle sur votre carte de données?

為什麼你的數據圖譜分析圖上只顯示一個值?

Peking University, University of California Berkeley and others jointly | domain adaptive text classification with structured knowledge from unlabeled data (Domain Adaptive Text Classification Based o

应用实践 | Apache Doris 整合 Iceberg + Flink CDC 构建实时湖仓一体的联邦查询分析架构

游戏安全丨喊话CALL分析-写代码

在宇宙的眼眸下,如何正确地关心东数西算?

万字长文!一文搞懂InheritedWidget 局部刷新机制

Why is only one value displayed on your data graph?

北大、加州伯克利大學等聯合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基於未標記數據的結構化知識的領域自適應文本分類)

为什么你的数据图谱分析图上只显示一个值?
随机推荐
Targeted, real-time audio and video optimization in remote control
Achieve scoring (Star scoring) effect through native JS
What happened when the fortress remote login server was blocked? What can be done to solve it?
Freiburg University, Hildesheim University and other universities in Germany jointly | zero shot automl with pre trained models (zero sample automl based on pre training model)
Change sql- Tencent cloud database tdsql elite challenge - essence Q & A
Relevant logic of transaction code MICn in SAP mm
How ppt creates a visual chart
How to set the life cycle of API gateway
Why is only one value displayed on your data graph?
SLSA: 成功SBOM的促进剂
Second kill design of 100 million level traffic architecture
In depth understanding of Internet of things device access layer
there can be only one auto column and it must be defined as a key
应用实践 | Apache Doris 整合 Iceberg + Flink CDC 构建实时湖仓一体的联邦查询分析架构
How does the fortress machine log in to the production server? What is the function of the fortress machine?
How to deploy API gateways and split services under multi services?
Nanny level anti crawling teaching, JS reverse implementation of font anti crawling
Flush cache clear
Teach you how to write a delay queue
Implement sequence restriction on memory operations