CloseMaxScript6 自定义硬件绑定-1-自定义激活界面

操作步骤

在ui界面快速配置

然后点击【打印配置】。在配置中,需要做如下必要配置更改或添加

config.UseBeforeAction = true --开启前置动作
config.UseHardwareBinding = true --开启硬件绑定
config.HideHBRegisterWindow = true --隐藏默认硬件绑定的界面

成功后的截图

自定义硬件绑定UI前置.ms

fn runCustomBindingDialog =
(
	global _tool = Cmxs6Container.MxsRuntime.Get "LastTool"
	if 'true' != true then
	(
		messageBox "测试环境" beep:false
	)
	
	global regRoll
	try(destroyDialog regRoll)catch()
	rollout regRoll ""
	(
		label txt1 "序列号" align:#left
		edittext edtSn "" readonly:true
		
		label txt2 "激活码" align:#left
		edittext edtCode "" 
		
		button btnOk "确定" width:100 height:26
		
		label labInfo "这是你的斯喽更"
		
		on regRoll open do
		(
			regRoll.title = (_tool.Get "ScriptFileTag") + " - 需要激活才能使用"
			edtSn.text = _tool.Call "GetBindingSerialNumber"
		)
		
		on btnOk pressed do
		(
			err = _tool.Call "WriteBindingLicense" edtSn.text edtCode.text ""
			if err != "" then
			(
				messageBox ("写入文件出错:" + err)
			)
			else
			(
				--检查是否激活
				if (_tool.Call "IsBindingActived") == false then
				(
					messageBox ("错误的激活码")
					return ""
				)
				-- 写入成功,启动主代码
				_tool.Call "Launch"
			)
		)
	)
	
	--判断是否激活来显示窗口
	local isAct = _tool.Call "IsBindingActived"
	print ("激活情况:" + isAct as string)
	if (isAct == false) then
	(
		createDialog regRoll 300 150
	)
)

try 
(	
	runCustomBindingDialog()
)
catch
(
	print ("前置代码执行逻辑错误:" + getCurrentException())
)

--必要,让整个表达式返回一个布尔值,这是前置动作的要求规则
--返回true,让其不会中断运行逻辑
true
posted @ 2024-01-01 17:30  trykle  阅读(4)  评论(0编辑  收藏  举报