autoit3转换php,AutoIt3 GUI事件模式 实现字符串大小写转换功能

AutoIt3版本:

Version 3.5.4

AutoIt3 GUI官方介绍:

A GUI consists of one or more windows and each window contains one or more controls. GUIs are "event driven" which means you react to events - like a button that is clicked. You spend most of your time idling and waiting for an event to happen - this is a little different to a normal script where you are in control of what happens and when! Think of it as waiting by the door for the postman - you sit there until a letter pops through the postbox and then you look at the letters and decide what to do with them - this is exactly how GUIs work - you wait for the postman to come to you.

AutoIt3脚本代码:#include 

#include 

;UGI使用事件模式

Opt("GUIOnEventMode", 1)

;创建一个窗口

Local $window=GUICreate("大小写转-小奋斗", 400, 300)

;绑定事件

GUISetOnEvent($GUI_EVENT_CLOSE, "CloseWindow")

;创建文本域

Local $inputEdit=GUICtrlCreateEdit("", 30,10,340,100)

;创建按钮

Local $transforUpperButton=GUICtrlCreateButton("大写", 100,135,60,25)

Local $transforLowerButton=GUICtrlCreateButton("小写", 170,135,60,25)

Local $clearButton=GUICtrlCreateButton("清除", 240,135,60,25)

;创建文本域

Local $outputEdit=GUICtrlCreateEdit("", 30, 180,340,100)

;事件绑定

GUICtrlSetOnEvent($transforUpperButton, "TransforUpperButton")

GUICtrlSetOnEvent($transforLowerButton, "TransforLowerButton")

GUICtrlSetOnEvent($clearButton, "ClearButton")

;显示当前窗口

GUISetState(@SW_SHOW)

; 消息循环模式

While 1

Sleep(100);

WEnd

;关闭窗口

func CloseWindow()

MsgBox($MB_OK, "提示", "您选择了关闭窗口! 正在退出...")

Exit

EndFunc

;转换成大写

Func TransforUpperButton()

; 获取控件内容

$sourceTxt = GUICtrlRead($inputEdit)

; 从控件上修改数据

GUICtrlSetData($outputEdit,StringUpper($sourceTxt))

EndFunc

;转换成小写

Func TransforLowerButton()

; 获取控件内容

$sourceTxt = GUICtrlRead($inputEdit)

; 从控件上修改数据

GUICtrlSetData($outputEdit,StringLower($sourceTxt))

EndFunc

;转换成小写

Func ClearButton()

; 从控件上修改数据

GUICtrlSetData($inputEdit,"")

GUICtrlSetData($outputEdit,"")

EndFunc

AutoIt3运行效果:

1540818899172028587.jpg

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值