[已解决] 如何读取控件并修改控件文字
本帖最后由 chishingchan 于 2019-8-30 09:54 编辑最近想汉化 Snapshot 软件,遇到难题!
请问如果读取和修改红色框的控件文字?谢谢!
Snapshot
本帖最后由 chishingchan 于 2019-8-30 00:18 编辑
$sTitle = "Snapshot - Select the Volumes you want to save"
WinActivate($sTitle)
$sSysListView321 = ControlListView($sTitle, "", "", "GetText",3,2)
MsgBox(0, "$sSysListView321", $sSysListView321)上面的代码也没能查询
还有最下面带色块的那行,窗口信息没法读取,不知有何办法修改?
#AutoIt3Wrapper_UseX64=n
#RequireAdmin
#include <GuiListView.au3>
#include <WinAPISysWin.au3>
Local $sTitle = "Snapshot - Select the Volumes you want to save"
Local $hWnd = _WinAPI_EnumChildWindows(WinGetHandle($sTitle))
For $i = 0 To UBound($hWnd)
If $hWnd[$i] = 'SysListView32' Then
$hWnd = $hWnd[$i]
ExitLoop
EndIf
Next
Local $sArray, $sColumnTitle, $sColumn = _GUICtrlListView_GetColumnCount($hWnd)
For $i = 0 To $sColumn
$sArray = _GUICtrlListView_GetColumn($hWnd, $i)
$sColumnTitle &= $sArray & '|'
Next
Local $sCount = _GUICtrlListView_GetItemCount($hWnd)
Local $aListView[$sColumn]
For $i = 0 To $sCount
_ArrayAdd($aListView, _GUICtrlListView_GetItemTextString($hWnd, $i))
Next
For $i = 0 To $sColumn
_GUICtrlListView_SetColumn($hWnd, $i, $i)
Next
_ArrayDisplay($aListView, _WinAPI_GetWindowText($hWnd) & ' ' & $hWnd, '', 64, '', StringTrimRight($sColumnTitle, 1))
本帖最后由 chishingchan 于 2019-8-30 14:08 编辑
[已解决] 不知为何,翻译字符串还需加上空格,否则显示不全:#RequireAdmin
#include <GuiListView.au3>
#include <WinAPISysWin.au3>
;窗口标题
Local $sTitle = "Snapshot - Select the Volumes you want to save"
WinActivate($sTitle)
;获取子窗口句柄
Local $hWnd = _WinAPI_EnumChildWindows(WinGetHandle($sTitle)) ;<WinAPISysWin.au3>
;获取 SysListView32 行句柄
For $i = 0 To UBound($hWnd)
If $hWnd[$i] = 'SysListView32' Then
$hWnd = $hWnd[$i]
ExitLoop
EndIf
Next
;定义翻译字符串
Local $sSysListView32 = StringSplit("驱动|HD|分区号|分区开始|分区大小|标签|文件系统|大小|已用|可用", "|", 2)
;设置翻译字符串
For $i = 0 To UBound($sSysListView32)
_GUICtrlListView_SetUnicodeFormat($hWnd, True)
_GUICtrlListView_SetColumn($hWnd, $i, $sSysListView32[$i]) ;<GuiListView.au3>
Next
chishingchan 发表于 2019-8-30 10:42
不知为何,翻译字符串还需加上空格,否则显示不全:
_GUICtrlListView_SetUnicodeFormat($hWnd, True) 繁星 发表于 2019-8-30 11:13
再次请教:
如何将第3列 (PartNo) 的 Pri 或 Log 写入(主分区 或 逻辑分区)翻译字符串?谢谢! For $i = 0 To _GUICtrlListView_GetItemCount($hWnd)
Local $sPartNo = _GUICtrlListView_GetItemText($hWnd, $i, 2)
If StringInStr($sPartNo, 'Pri') Then
_GUICtrlListView_SetItemText($hWnd, $i, '主分区' & StringTrimLeft($sPartNo, 3), 2)
EndIf
If StringInStr($sPartNo, 'Log') Then
_GUICtrlListView_SetItemText($hWnd, $i, '逻辑分区' & StringTrimLeft($sPartNo, 3), 2)
EndIf
Next 繁星 发表于 2019-8-30 15:33
无言感激! 处理64bitSnapshot时,sSysListView32这项会导致Snapshot结束进程
无法打开包含文件 <WinAPISysWin.au3>? 繁星 发表于 2019-8-30 15:33
老大,我还有一个类似的难题想请教您:
在顶楼的软件中,主界面 -> Backup Disk To File -> Next -> Browse
在保存类型中有两项字符(ComboBox3):
1、Snapshot Files (*.SNA)
2、All (*.*)
请问如何更改此两个字符?谢谢! 繁星 发表于 2019-8-30 15:33
以下语句没效果!!!
#RequireAdmin
#include <GuiComboBox.au3>
#include <WinAPISysWin.au3>
$Title = "Select Destination File for C:"
$hWnd = WinGetHandle($Title)
Local $Wnd = _WinAPI_EnumChildWindows($hWnd)
Local $j = 0
For $i = 0 To UBound($Wnd) - 1
If $Wnd[$i] = 'ComboBox' Then
$j += 1
If $j = 3 Then
$Wnd = $Wnd[$i]
ExitLoop
EndIf
EndIf
Next
_GUICtrlComboBox_BeginUpdate($Wnd)
_GUICtrlComboBox_SetEditText($Wnd, "Snapshot 文件(*.SNA)|所有(*.*)")
_GUICtrlComboBox_EndUpdate($Wnd)
chishingchan 发表于 2019-9-25 08:21
以下语句没效果!!!
#RequireAdmin
#include <WinAPISysWin.au3>
#include <GuiComboBox.au3>
$Title = "Select Destination File for C:"
Local $hWnd = WinGetHandle($Title)
Local $Wnd = _WinAPI_EnumChildWindows($hWnd, False)
For $i = UBound($Wnd) - 1 To 0 Step - 1
If $Wnd[$i] = 'ComboBox' Then
Local $idCombo = $Wnd[$i]
ExitLoop
EndIf
Next
_GUICtrlComboBox_InsertString($idCombo, 'Snapshot 文件(*.SNA)', 0)
_GUICtrlComboBox_DeleteString($idCombo, 1)
_GUICtrlComboBox_InsertString($idCombo, '所有(*.*)', 1)
_GUICtrlComboBox_DeleteString($idCombo, 2)
_GUICtrlComboBox_SetCurSel($idCombo, 0)
页:
[1]