-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**新增:** * ESC键清空power-input输入框内容 * 获取 CATIA V5 R2020 算法适配 * ESC 清除POWER-INPUT功能提供启用选项 * 结构树自动排序功能 * 排序算法优化,更快更准确, 输入错误别名的判断机制BUG修复 **优化:** * 启动windows计算器功能优化,CATIA别名算法优化 * space按键的算法优化,与其他功能的算法函数复用 * Change Title Match Mode to option 2 * 优化配置文件缺失时的提示信息 * IME库文件整合到windows.ahk * README 更新
- Loading branch information
Showing
9 changed files
with
386 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,61 @@ | ||
#Requires AutoHotKey v2.0 | ||
#include stdio.ahk | ||
#Include AHK_LOG.ahk | ||
#Include CAT_Automatic.ahk | ||
|
||
/** | ||
* 获取用户别名配置文件中指定的key值 | ||
* | ||
* @param alias_list_ini_path(string) 配置文件的路径 | ||
* @param section(string) ini 文件的section, 一般是工作台名称 | ||
* @param key(string) 键值, 一般是输入的别名 | ||
* | ||
* @example: | ||
* - GR = CATPstReorderHdr ; 图形树重新排序 | ||
* @return arr[1] | ||
* - arr[1] == "CATPstReorderHdr" | ||
* | ||
* @example: | ||
* - AGR = CATPstReorderHdr &cat_auto_graph_tree_reorder ; 图形树自动排序 | ||
* @return arr[2] | ||
* - arr[1] == "CATPstReorderHdr" | ||
* - arr[2] == "cat_auto_graph_tree_reorder" | ||
*/ | ||
read_user_alias(alias_list_ini_path, section, key) { | ||
command_id_and_cb_array := Array() | ||
|
||
; 读取CATAlias.ini配置文件中的别名, 并返回别名字符串 | ||
; 返回的字符串会自动排除 “;” 以后的内容 | ||
readAlias(k_Section, k_Key) { | ||
try { | ||
; 返回 CATAlias.ini 内 Key 的对应值 | ||
AHK_LOGI("调用 " k_Section) | ||
return StrSplit(IniRead(alias_ini_path, k_Section, k_Key), ";")[1] | ||
AHK_LOGI("调用 " section) | ||
command_id_and_cb_str := StrSplit(StrReplace(IniRead(alias_list_ini_path, section, key), A_Space, ''), ";")[1] | ||
command_id_and_cb_array := StrSplit(command_id_and_cb_str, "&") | ||
return command_id_and_cb_array | ||
} | ||
catch as e { | ||
if e | ||
{ | ||
try { | ||
AHK_LOGI("调用 通用") | ||
return StrSplit(IniRead(alias_ini_path, "通用", k_Key), ";")[1] | ||
command_id_and_cb_str := StrSplit(StrReplace(IniRead(alias_list_ini_path, "通用", key), A_Space, ''), ";")[1] | ||
command_id_and_cb_array := StrSplit(command_id_and_cb_str, "&") | ||
return command_id_and_cb_array | ||
} | ||
catch as e { | ||
k_ToolTip("没有找到与" k_Key "对应的命令", 1000) | ||
return "" | ||
k_ToolTip(Format("没有找到与 {1} 对应的命令",key), 1000) | ||
return command_id_and_cb_array | ||
; Exit | ||
} | ||
} | ||
} | ||
} | ||
|
||
; 查找 ini 文件,匹配 [Hotkey] 的对应快捷键 | ||
SendAliasCommand(ThisHotkey) { | ||
register_command(ThisHotkey) { | ||
try { | ||
ControlSetText("", FocuseHwnd) | ||
SendInput("c:" readAlias("HotKey", ThisHotkey) "{Enter}") | ||
SendInput(" ") | ||
ControlSetText("", ControlGetFocus("A")) | ||
SendInput("c:" read_user_alias(alias_ini_path, "HotKey", ThisHotkey)[1] "{Enter}") | ||
} | ||
catch as e { | ||
k_ToolTip("热键注册失败,请检查" alias_ini_path "目录是否正确", 3000) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
#Requires AutoHotkey v2.0 | ||
|
||
#Include CATAlias.ahk | ||
#Include AHK_LOG.ahk | ||
|
||
|
||
/** | ||
* 根据输入的用户别名, 执行配置文件中的 COMMAND_ID 以及 函数调用 | ||
* @param alias_strings 用户别名字符串, 不区分大小写 | ||
* @param power_input_hwnd 超级输入框的 hwnd 值 | ||
* | ||
*/ | ||
cat_alias_exexcution(alias_string, power_input_hwnd) | ||
{ | ||
current_workbench := CAT_CURRENT_WORKBENCH() | ||
|
||
command_id_and_cb_array := read_user_alias(alias_ini_path, current_workbench, StrUpper(alias_string)) | ||
|
||
if command_id_and_cb_array.Length == 0 | ||
{ | ||
k_ToolTip(Format("没有找到与 '{1}' 对应的命令", alias_string), 1000) | ||
return | ||
} | ||
|
||
; hwnd_current := ControlGetHwnd("A") | ||
ControlSetText("c:" . command_id_and_cb_array[1], power_input_hwnd) | ||
; ControlSetText("c:" . "ViewAlignment", power_input_hwnd) | ||
SendInput "{Enter}" | ||
|
||
if command_id_and_cb_array.Length == 2 | ||
{ | ||
%command_id_and_cb_array[2]%() | ||
} | ||
|
||
} | ||
|
||
; 获取装配设计下的 "图形树重新排序" 窗口, 自动执行排序操作 | ||
cat_auto_graph_tree_reorder() | ||
{ | ||
GroupAdd "ReorderTree", "Graph tree reordering" | ||
GroupAdd "ReorderTree", "图形树重新排序" | ||
raw_lists_string := "" | ||
|
||
dialogbox_hwnd := WinWait("ahk_group ReorderTree", , 5) | ||
if dialogbox_hwnd == 0 | ||
{ | ||
Exit | ||
} | ||
|
||
Listbox_items := ControlGetItems("ListBox1", dialogbox_hwnd) | ||
|
||
for item in Listbox_items { | ||
raw_lists_string .= item "," | ||
} | ||
|
||
sorted_lists_string := Sort(raw_lists_string, "D,") | ||
refrence_lists_array := StrSplit(SubStr(sorted_lists_string, 1, StrLen(sorted_lists_string) - 1), ',') | ||
|
||
listbox_classnn := "ListBox1" | ||
free_move_button := ControlGetHwnd("自由移动", dialogbox_hwnd) | ||
|
||
listbox_items := ControlGetItems(listbox_classnn, dialogbox_hwnd) | ||
|
||
; 检查当前的排序状态 | ||
loop listbox_items.Length | ||
{ | ||
if (listbox_items[A_Index] == refrence_lists_array[A_Index]) { | ||
if (A_Index == listbox_items.Length) | ||
{ | ||
k_ToolTip("已排序完成, 不用继续排序", 3000) | ||
Sleep 1000 | ||
PostMessage(0x10, 0, , , dialogbox_hwnd) | ||
Exit | ||
} | ||
continue | ||
} | ||
else { | ||
break | ||
} | ||
} | ||
|
||
try { | ||
; 执行排序 | ||
refrence_item_index := 0 | ||
|
||
for item in refrence_lists_array | ||
{ | ||
refrence_item_index += 1 | ||
ControlChooseString(refrence_lists_array[A_Index], listbox_classnn, dialogbox_hwnd) | ||
if (ControlGetIndex(listbox_classnn, dialogbox_hwnd) == A_Index) | ||
{ | ||
continue | ||
} | ||
SendMessage(0xF5, 0, 0, free_move_button, dialogbox_hwnd) | ||
ControlChooseIndex(A_Index, listbox_classnn, dialogbox_hwnd) | ||
|
||
while ControlChooseString(item, listbox_classnn, dialogbox_hwnd) != refrence_item_index | ||
{ | ||
Sleep 1 | ||
} | ||
} | ||
} | ||
catch Error as e | ||
{ | ||
AHK_LOGI(Format("函数: {1} 执行失败`n错误信息: {2} on Line {3} `n 文件: {4}", e.What, e.Message, e.Line, e.File)) | ||
Exit | ||
} | ||
|
||
k_ToolTip("结构树排序完成", 2000) | ||
} | ||
|
||
; 检测当前 CATIA 工作台,并返回字符串 | ||
CAT_CURRENT_WORKBENCH() | ||
{ | ||
WinExist("A") | ||
|
||
workbench_name := "NULL" | ||
visible_text := WinGetTextFast_A(false) | ||
|
||
; 获取工作台列表 | ||
if WORKBENCH_LIST_A.Length = 0 | ||
{ | ||
INI_GET_ALL_VALUE_A(config_ini_path, "workbench") | ||
} | ||
|
||
for value1 in visible_text { | ||
for value2 in WORKBENCH_LIST_A { | ||
; FileAppend "WORKBENCH_LIST_A: " value1 " " "visible_text: " value2 "`n", ".\log.txt" | ||
if (value1 != value2) | ||
{ | ||
continue | ||
} | ||
AHK_LOGI("value1: " value1 "`n" "value2: " value2 "`n" "A_index: " A_Index) | ||
workbench_name := value1 | ||
return workbench_name | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.