打开系统应用程序
(defun c:xtyy();;;打开系统程序(setvar "CMDECHO" 0)
(setq dcl_id (load_dialog (setq Dcl_File (Write_Dcl)))) ;对话框加载
(vl-file-delete Dcl_File) ;加载后删除DCL文件
(new_dialog "Form1" dcl_id)
(setq key_list '("b11" "b12" "b13" "b14" "b21" "b22" "b23" "b24" "b31" "b32" "b33" "b34" "b35" "b41" "b42" "b51" "b52" "b53" "b54" "help" "cancle")) ;_ 结束setq
(foreach keykey_list
(if (eval (read (strcat key "_bak")))
(set_tile key (eval (read (strcat key "_bak"))))
) ;控件内容
(action_tile key "(done_dialog (atoi (substr $key 2)))")
) ;_ 结束foreach
(action_tile "help" "(help3_button)")
(action_tile "cancle" "(done_dialog 0)")
(setq dd (start_dialog))
(cond
((= dd 11) (startapp "control")) ;控制台
((= dd 12) (startapp "control desk.cpl")) ;屏幕分辨率
((= dd 13) (startapp "winver")) ;查看Windows版本
((= dd 14) (startapp "control intl.cpl")) ;区域与语言设置
((= dd 21) (command "start" "excel"))
((= dd 22) (command "start" "winword"))
((= dd 23) (startapp "cmd")) ;运行
((= dd 24) (command "start" "write")) ;写字板
((= dd 31) (command "start" "mspaint")) ;画图
((= dd 32) (command "start" "notepad")) ;记事本
((= dd 33) (command "start" "calc")) ;计算器
((= dd 34) (startapp "control hdwwiz.cpl")) ;设备管理器
((= dd 35) (startapp "control sysdm.cpl")) ;系统属性
((= dd 41) (startapp "control inetcpl.cpl")) ;Internet属性
((= dd 42) (startapp "control mmsys.cpl")) ;声音
((= dd 51) (command"start" "explorer")) ;资源管理器
((= dd 52) (startapp "control main.cpl")) ;鼠标属性
((= dd 53) (startapp "control timedate.cpl")) ;日期和时间
((= dd 54) (startapp "control appwiz.cpl")) ;程序和功能
) ;_ 结束cond
(unload_dialog dcl_id);退出时卸载对话框
(prin1)
) ;_ 结束defun
(defun Write_Dcl(/ Dcl_File file str)
(setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
(setq file (open Dcl_File "w"))
(foreach str'(
"Form1:dialog"
"{"
" label = \"Windows 应用程序启动---Author:高磊---\";"
" :row"
" {"
" :boxed_column"
" {"
" key = \"Frame1\" ;"
" label = \"应用按钮\" ;"
" :row"
" {"
":button"
"{"
" key = \"b11\" ;"
" label = \"控制面板\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b12\" ;"
" label = \"屏幕分辨率\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b13\" ;"
" label = \"系统版本信息\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b14\" ;"
" label = \"区域与语言设置\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
"}"
" :row"
"{"
":button"
"{"
" key = \"b21\" ;"
" label = \"EXCEL启动\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b22\" ;"
" label = \"WORD启动\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b23\" ;"
" label = \"运行\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b24\" ;"
" label = \"写字板\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
"}"
" :row"
"{"
":button"
"{"
" key = \"b31\" ;"
" label = \"画图\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b32\" ;"
" label = \"记事本\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b33\" ;"
" label = \"计算器\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b34\" ;"
" label = \"设备管理器\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
"}"
":row"
"{"
":button"
"{"
" key = \"b35\" ;"
" label = \"系统属性\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b41\" ;"
" label = \"Internet属性\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b42\" ;"
" label = \"声音\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
"}"
" :row"
" {"
":button"
"{"
" key = \"b51\" ;"
" label = \"资源管理器\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b52\" ;"
" label = \"鼠标属性\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b53\" ;"
" label = \"日期和时间\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
":button"
"{"
" key = \"b54\" ;"
" label = \"程序和功能\" ;"
" width = 9.75 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
"}"
"}"
" }"
" spacer_1;"
" :column"
" {"
" :text"
" {"
"key = \"Label1\" ;"
"width = 13.35 ;"
"height = 1.875 ;"
"fixed_height = true ;"
"fixed_width = true ;"
" }"
" :button"
" {"
"key = \"help\" ;"
"label = \"帮助\" ;"
"width = 16.95 ;"
"height = 1.875 ;"
"fixed_height = true ;"
"fixed_width = true ;"
" }"
" :button"
" {"
"key = \"cancel\" ;"
"label = \"取消\" ;"
"width = 16.95 ;"
"height = 1.875 ;"
"fixed_height = true ;"
"fixed_width = true ;"
"is_cancel = true ;"
" }"
" :text"
" {"
"key = \"Label2\" ;"
"width = 13.35 ;"
"height = 1.875 ;"
"fixed_height = true ;"
"fixed_width = true ;"
" }"
" }"
" }"
"}"
)
(write-line str file)
) ;_ 结束foreach
(close file)
Dcl_File
) ;_ 结束defun
(defun help3_button()
(setq msg
(strcat
"\t [ 应用程序快速启动 ]"
"\n"
"--------------------------------------------------------------"
"\nCopyright ㊣ 2017 - 2027All rights reserved.\n"
"--------------------------------------------------------------"
)
)
(alert msg)
)
原始程序对话框是这样的:
优化后:
(defun Write_Dcl(/ Dcl_File file str)
(setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
(setq file (open Dcl_File "w"))
(foreach str'(
"Form1:dialog{"
" label = \"Windows 应用程序启动---Author:高磊----From:dcl->lsp V1.8.6.1M(beta)\" ;"
" :row {"
" :boxed_column {"
" key = \"Frame1\" ;"
" label = \"应用按钮\" ;"
" :row {"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b11\" ;"
" label = \"控制面板\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b12\" ;"
" label = \"屏幕分辨率\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b13\" ;"
" label = \"系统版本信息\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b14\" ;"
" label = \"区域与语言设置\" ;"
" width = 22 ;"
" }"
" }"
" :row {"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b21\" ;"
" label = \"EXCEL启动\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b22\" ;"
" label = \"WORD启动\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b23\" ;"
" label = \"运行\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b24\" ;"
" label = \"写字板\" ;"
" width = 22 ;"
" }"
" }"
" :row {"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b31\" ;"
" label = \"画图\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b32\" ;"
" label = \"记事本\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b33\" ;"
" label = \"计算器\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b34\" ;"
" label = \"设备管理器\" ;"
" width = 22 ;"
" }"
" }"
" :row {"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b51\" ;"
" label = \"资源管理器\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b52\" ;"
" label = \"鼠标属性\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b53\" ;"
" label = \"日期和时间\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" fixed_width = true ;"
" height = 1.875 ;"
" key = \"b54\" ;"
" label = \"程序和功能\" ;"
" width = 22 ;"
" }"
" }"
" :row {"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b35\" ;"
" label = \"系统属性\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b41\" ;"
" label = \"Internet属性\" ;"
" width = 22 ;"
" }"
" :button {"
" fixed_height = true ;"
" height = 1.875 ;"
" key = \"b42\" ;"
" label = \"声音\" ;"
" width = 22 ;"
" }"
" }"
" }"
" spacer_1;"
" :column {"
" :text {"
" key = \"Label1\" ;"
" width = 13.35 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
" }"
" :button {"
" key = \"help\" ;"
" label = \"帮助\" ;"
" width = 16.95 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
" }"
" :button {"
" key = \"cancel\" ;"
" label = \"取消\" ;"
" width = 16.95 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
" is_cancel = true ;"
" }"
" :text {"
" key = \"Label2\" ;"
" width = 13.35 ;"
" height = 1.875 ;"
" fixed_height = true ;"
" fixed_width = true ;"
" }"
" }"
" }"
"}"
)
(write-line str file)
) ;_ 结束foreach
(close file)
Dcl_File
)
学习了,谢谢分享 好实用的,谢谢分享!
学习了,谢谢分享!!!!! Thanks for sharing ^^ Thanks for sharing ^^ 多处缺少分号?
页:
[1]