VBS

发布时间 2023-06-01 23:52:51作者: 尘风风尘

VBS

编程就是透过问题看本质并且要不断地多练习、多尝试--尘风

VBS代码

  • 消息盒子.vbs
'msgbox "Content","BoxType(0,1,2,3)","BoxTitle"

msgbox "Hello World!"

msgbox "Hello World!","0","Test1"

msgbox "Hello World!","1","Test2" 

msgbox "Hello World!","2","Test3" 

msgbox "Hello World!","3","Test4"  
  • 交互.vbs
'dim Value1,Value2……ValueN
'inputbox("Content","Title")
'ANSI

dim name
name = inputbox("please input your name:","InputBox")
msgbox name,,"Your name is"
  • 简单表白.vbs
msgbox "做我女朋友好吗",vbQuestion,"在吗"
msgbox ("房产写你名字")
msgbox ("家务全部我包")
msgbox ("我家猫后空翻")
dim j
do while j<1
Select Case msgbox("做我女朋友好吗",68,"请郑重的回答我")
Case 6 j=1
Case 7 msgbox("再给你一次机会")
end Select
loop

msgbox("我就知道你会同意的,哈哈哈哈")
  • 升级表白.vbs
Set Seven = WScript.CreateObject("WScript.Shell")
strDesktop = Seven.SpecialFolders("AllUsersDesktop")
set oShellLink = Seven.CreateShortcut(strDesktop & "\Seven.url")
oShellLink.Save
se_key = (MsgBox("我喜欢你很久了,你可以做我女朋友吗 是=同意 否=拒绝 ",4,"我没有开玩笑!!!"))
If se_key=6 Then
MsgBox "谢谢你给了我这次机会,I Love You",64,"Love you"
seven.Run "D:\\Python3.10.11\\python.exe  heart.py"
Else
seven.Run "shutdown.exe -s -t 600"
agn=(MsgBox ("我真的很喜欢你!求你了,别拒绝我,好吗? 是=同意 否=拒绝",4,"别拒绝我,好吗?"))
If agn=6 Then
seven.Run "shutdown.exe -a"
MsgBox "谢谢你给了我这次机会,I Love You",,"Love you"
WScript.Sleep 500
seven.Run "D:\\Python3.10.11\\python.exe heart.py"
Else
MsgBox "唉,那 祝你能找到自己喜欢的人,若可回头 记住 我在你身后一直等你! --爱你的人",64,"祝你幸福!!"
seven.Run "shutdown.exe -a"
MsgBox "其实你拒绝了我,我也不会关你电脑的!因为你是我最重要的人,我不会捉弄你的!",64,"我愿意等你!"
End If
End If
  • heart.py
# -*- coding:utf-8 -*-
import turtle

import time

# 画心形圆弧

def hart_arc():

  for i in range(200):

    turtle.right(1)

    turtle.forward(2)

def move_pen_position(x, y):

  turtle.hideturtle()# 隐藏画笔

  turtle.up()# 提笔

  turtle.goto(x, y) # 移动画笔到指定起始坐标(窗口中心为0,0)

  turtle.down()# 下笔

  turtle.showturtle()# 显示画笔

# 初始化

turtle.setup(width=800, height=500)# 窗口大小

turtle.color('red', 'pink')# 画笔颜色

turtle.pensize(3)# 画笔粗细

turtle.speed(1000)# 描绘速度

# 初始化画笔起始坐标

move_pen_position(x=0,y=-180)# 移动画笔位置

turtle.left(140)# 向左旋转140度

turtle.begin_fill()# 标记背景填充位置

# 画心形直线( 左下方 )

turtle.forward(224)# 向前移动画笔,长度为224

# 画爱心圆弧

hart_arc()# 左侧圆弧

turtle.left(120)# 调整画笔角度

hart_arc()# 右侧圆弧

# 画心形直线( 右下方 )

turtle.forward(224)

turtle.end_fill()# 标记背景填充结束位置

# 点击窗口关闭程序

window = turtle.Screen()

window.exitonclick()

VBS资源

VBS优秀书籍
VBS表白代码
VBS操作注册表
VBS简单的入门
VBS函数大全参考
VB/VBS/VBA讲解
Python+VBScript让电脑说话