V1
适配win10和 win11
#SingleInstance Force
SendMode Input
SetWorkingDir %A_ScriptDir%
; Global variables
global TaskList := []
global CurrentFileConfig := "current_file.ini"
global RemainingFilesConfig := "remaining_files.ini"
global FileListConfig := "file_list.ini"
global ConfigFile := A_ScriptDir "\sender_config.ini"
global LogFile := A_ScriptDir "\sender_log.txt"
global SignalFile := A_ScriptDir "\signal.ini"
global MainSeedFile := A_ScriptDir "\main_seed.txt"
global SupplementSeedFile := A_ScriptDir "\supplement_seed.txt"
global SendPosX, SendPosY
global IncludeFileName, WithExt, WithoutExt, IncludeFullPath
global CustomKey, TriggerDelay, MoveUpKey, MoveDownKey, DeleteFileKey, StartSendKey, SendSupplementKey, SkipFileKey, PauseSendKey
global TriggerCustomKeyAfterSend
global StartTriggerMode
global NextTriggerMode
global IsPaused := false
global StartTriggerKey := "^!s"
global NextTriggerKey := "^!m"
global AutoTriggerKey := "^!n"
global SignalMonitorName := "TriggerSender"
global SignalNextName := "TriggerMonitor"
global SignalHasSupplement := "HasSupplement"
global SignalTriggerNextSend := "TriggerNextSend"
global IsSending := false
global MainGuiHwnd
global FloatGuiHwnd
global GuiVisible := 1
global FloatVisible := 1
global SignalValue := 0
global Countdown := 5
global DetectionStatus := "未启动"
global CurrentTaskIndex := 0
global SendingSupplement := false
CoordMode, Mouse, Screen
CoordMode, ToolTip, Screen
CoordMode, Gui, Screen
IniWrite, 0, %SignalFile%, Signals, %SignalMonitorName%
IniWrite, 0, %SignalFile%, Signals, %SignalNextName%
IniWrite, 0, %SignalFile%, Signals, %SignalHasSupplement%
IniWrite, 0, %SignalFile%, Signals, %SignalTriggerNextSend%
IniWrite, 0, %SignalFile%, Signals, ReadyForNote ; 初始化 ReadyForNote
IfNotExist, %ConfigFile%
{
IniWrite, 300, %ConfigFile%, Settings, SendPosX
IniWrite, 500, %ConfigFile%, Settings, SendPosY
IniWrite, 0, %ConfigFile%, Settings, IncludeFileName
IniWrite, 0, %ConfigFile%, Settings, WithExt
IniWrite, 0, %ConfigFile%, Settings, WithoutExt
IniWrite, 0, %ConfigFile%, Settings, IncludeFullPath
IniWrite, 500, %ConfigFile%, Settings, TriggerDelay
IniWrite, 1, %ConfigFile%, Settings, TriggerCustomKeyAfterSend
IniWrite, 0, %ConfigFile%, Settings, StartTriggerMode
IniWrite, 0, %ConfigFile%, Settings, NextTriggerMode
IniWrite, ^Up, %ConfigFile%, Hotkeys, MoveUpKey
IniWrite, ^Down, %ConfigFile%, Hotkeys, MoveDownKey
IniWrite, ^Delete, %ConfigFile%, Hotkeys, DeleteFileKey
IniWrite, ^!s, %ConfigFile%, Hotkeys, StartSendKey
IniWrite, ^!u, %ConfigFile%, Hotkeys, SendSupplementKey
IniWrite, ^!k, %ConfigFile%, Hotkeys, SkipFileKey
IniWrite, ^!p, %ConfigFile%, Hotkeys, PauseSendKey
IniWrite, ^!t, %ConfigFile%, Hotkeys, CustomKey
IniWrite, ^!s, %ConfigFile%, Hotkeys, StartTriggerKey
IniWrite, ^!m, %ConfigFile%, Hotkeys, NextTriggerKey
IniWrite, ^!n, %ConfigFile%, Hotkeys, AutoTriggerKey
IniWrite, 1, %ConfigFile%, Settings, GuiVisible
}
IfNotExist, %RemainingFilesConfig%
IniWrite, 0, %RemainingFilesConfig%, Settings, RemainingFiles
IfNotExist, %FileListConfig%
IniWrite, "", %FileListConfig%, Tasks
IfNotExist, %SignalFile%
{
IniWrite, 0, %SignalFile%, Signals, %SignalMonitorName%
IniWrite, 0, %SignalFile%, Signals, %SignalNextName%
IniWrite, 0, %SignalFile%, Signals, %SignalHasSupplement%
IniWrite, 0, %SignalFile%, Signals, %SignalTriggerNextSend%
IniWrite, 0, %SignalFile%, Signals, ReadyForNote
}
IfNotExist, %MainSeedFile%
FileAppend, ww, %MainSeedFile%
IfNotExist, %SupplementSeedFile%
FileAppend, aa, %SupplementSeedFile%
IniRead, SendPosX, %ConfigFile%, Settings, SendPosX, 300
IniRead, SendPosY, %ConfigFile%, Settings, SendPosY, 500
IniRead, IncludeFileName, %ConfigFile%, Settings, IncludeFileName, 0
IniRead, WithExt, %ConfigFile%, Settings, WithExt, 0
IniRead, WithoutExt, %ConfigFile%, Settings, WithoutExt, 0
IniRead, IncludeFullPath, %ConfigFile%, Settings, IncludeFullPath, 0
IniRead, TriggerDelay, %ConfigFile%, Settings, TriggerDelay, 500
IniRead, TriggerCustomKeyAfterSend, %ConfigFile%, Settings, TriggerCustomKeyAfterSend, 1
IniRead, StartTriggerMode, %ConfigFile%, Settings, StartTriggerMode, 0
IniRead, NextTriggerMode, %ConfigFile%, Settings, NextTriggerMode, 0
IniRead, MoveUpKey, %ConfigFile%, Hotkeys, MoveUpKey, ^Up
IniRead, MoveDownKey, %ConfigFile%, Hotkeys, MoveDownKey, ^Down
IniRead, DeleteFileKey, %ConfigFile%, Hotkeys, DeleteFileKey, ^Delete
IniRead, StartSendKey, %ConfigFile%, Hotkeys, StartSendKey, ^!s
IniRead, SendSupplementKey, %ConfigFile%, Hotkeys, SendSupplementKey, ^!u
IniRead, SkipFileKey, %ConfigFile%, Hotkeys, SkipFileKey, ^!k
IniRead, PauseSendKey, %ConfigFile%, Hotkeys, PauseSendKey, ^!p
IniRead, CustomKey, %ConfigFile%, Hotkeys, CustomKey, ^!t
IniRead, StartTriggerKey, %ConfigFile%, Hotkeys, StartTriggerKey, ^!s
IniRead, NextTriggerKey, %ConfigFile%, Hotkeys, NextTriggerKey, ^!m
IniRead, AutoTriggerKey, %ConfigFile%, Hotkeys, AutoTriggerKey, ^!n
IniRead, GuiVisible, %ConfigFile%, Settings, GuiVisible, 1
Gui, Main:New, +LastFound +Resize
MainGuiHwnd := WinExist()
StartTriggerModeKey := !StartTriggerMode
StartTriggerModeSignal := StartTriggerMode
NextTriggerModeKey := !NextTriggerMode
NextTriggerModeSignal := NextTriggerMode
Gui, Main:Add, Text, x20 y10 w280 h20, 待处理任务
Gui, Main:Add, ListView, x20 y30 w360 h150 vToProcessList gListViewClick AltSubmit, 序号|任务名|补充文件
Gui, Main:Add, Button, x20 y190 w70 h30 gImportFiles, 导入任务
Gui, Main:Add, Button, x100 y190 w70 h30 gImportSupplementFiles, 导入补充文件
Gui, Main:Add, Button, x180 y190 w70 h30 gSmartRecognizeSort, 智能识别排列
Gui, Main:Add, Button, x260 y190 w70 h30 gSetSendPos, 定位发送
Gui, Main:Add, Button, x20 y230 w70 h30 gMoveUp, 上移
Gui, Main:Add, Button, x100 y230 w70 h30 gMoveDown, 下移
Gui, Main:Add, Button, x180 y230 w70 h30 gDeleteFile, 删除
Gui, Main:Add, Button, x260 y230 w70 h30 gStartSend, 发送主任务
Gui, Main:Add, Button, x340 y230 w70 h30 gSendSupplement, 发送补充文件
Gui, Main:Add, Button, x20 y270 w70 h30 gSkipFile, 跳过
Gui, Main:Add, Button, x100 y270 w70 h30 gPauseSend, 暂停
Gui, Main:Add, Button, x180 y270 w70 h30 gBatchDelete, 批量删除
Gui, Main:Add, Button, x260 y270 w70 h30 gShowHotkeyMenu, 快捷键设置
Gui, Main:Add, Button, x20 y310 w70 h30 gSimulateSend, 模拟发送
Gui, Main:Add, Button, x100 y310 w100 h30 gSetMainSeed, 设置主任务种子
Gui, Main:Add, Button, x210 y310 w100 h30 gSetSupplementSeed, 设置补充任务种子
Gui, Main:Add, CheckBox, x320 y310 w150 h20 vIncludeFileName gToggleFileNameOptions Checked%IncludeFileName%, 发送时带文件名
Gui, Main:Add, Radio, x480 y310 w80 h20 vWithExt gSaveSettings Checked%WithExt% Disabled, 有后缀
Gui, Main:Add, Radio, x560 y310 w80 h20 vWithoutExt gSaveSettings Checked%WithoutExt% Disabled, 无后缀
Gui, Main:Add, CheckBox, x20 y340 w150 h20 vIncludeFullPath gSaveSettings Checked%IncludeFullPath%, 发送时带绝对路径
Gui, Main:Add, CheckBox, x180 y340 w200 h20 vTriggerCustomKeyAfterSend gSaveSettings Checked%TriggerCustomKeyAfterSend%, 发送后触发自定义快捷键
Gui, Main:Add, Text, x20 y370 w150 h20, 触发延迟(毫秒):
Gui, Main:Add, Edit, x180 y370 w100 h20 vTriggerDelay, %TriggerDelay%
Gui, Main:Add, Button, x290 y370 w70 h30 gSaveTriggerDelay, 保存
Gui, Main:Add, Text, x20 y400 w150 h20, 被触发方式:
Gui, Main:Add, Radio, x20 y420 w150 h20 vStartTriggerModeKey gSaveStartTriggerMode Checked%StartTriggerModeKey%, 快捷键触发
Gui, Main:Add, Radio, x180 y420 w150 h20 vStartTriggerModeSignal gSaveStartTriggerMode Checked%StartTriggerModeSignal%, 信号量触发
Gui, Main:Add, Text, x20 y450 w150 h20, 触发下一脚本方式:
Gui, Main:Add, Radio, x20 y470 w150 h20 vNextTriggerModeKey gSaveNextTriggerMode Checked%NextTriggerModeKey%, 快捷键触发
Gui, Main:Add, Radio, x180 y470 w150 h20 vNextTriggerModeSignal gSaveNextTriggerMode Checked%NextTriggerModeSignal%, 信号量触发
Gui, Main:Add, GroupBox, x20 y500 w400 h150, 状态监控
Gui, Main:Add, Text, xp+10 yp+20 w380 vDetectionStatusDisplay, 检测状态: %DetectionStatus%
Gui, Main:Add, Text, xp yp+30 w380 vCountdownDisplay, 信号检测倒计时: %Countdown% 秒
Gui, Main:Add, Text, xp yp+30 w380 vSignalStatusDisplay, 信号量 TriggerSender: %SignalValue%
Gui, Main:Add, Button, xp yp+30 w180 gToggleFloatWindow, 显示/隐藏悬浮窗
Gui, Main:Add, Text, x430 y500 w150 h20 vMoveUpKeyDisplay, 上移快捷键: %MoveUpKey%
Gui, Main:Add, Text, x430 y530 w150 h20 vMoveDownKeyDisplay, 下移快捷键: %MoveDownKey%
Gui, Main:Add, Text, x430 y560 w150 h20 vDeleteFileKeyDisplay, 删除快捷键: %DeleteFileKey%
Gui, Main:Add, Text, x590 y500 w150 h20 vStartSendKeyDisplay, 发送主任务: %StartSendKey%
Gui, Main:Add, Text, x590 y530 w150 h20 vSendSupplementKeyDisplay, 发送补充文件: %SendSupplementKey%
Gui, Main:Add, Text, x590 y560 w150 h20 vSkipFileKeyDisplay, 跳过快捷键: %SkipFileKey%
Gui, Main:Add, Text, x750 y500 w150 h20 vPauseSendKeyDisplay, 暂停快捷键: %PauseSendKey%
Gui, Main:Add, Text, x750 y530 w150 h20 vCustomKeyDisplay, 自定义快捷键: %CustomKey%
Gui, Main:Add, Text, x750 y560 w150 h20 vStartTriggerKeyDisplay, 被触发快捷键: %StartTriggerKey%
Gui, Main:Add, Text, x910 y500 w150 h20 vNextTriggerKeyDisplay, 下一触发快捷键: %NextTriggerKey%
Gui, Main:Add, Text, x410 y10 w280 h20, 已处理任务
Gui, Main:Add, ListView, x410 y30 w360 h150 vProcessedList gListViewClick AltSubmit, 序号|任务名|补充文件
Gui, Main:Add, Button, x410 y190 w70 h30 gViewFile, 查看文件
Gui, Main:Add, Button, x490 y190 w70 h30 gClearProcessed, 清空已处理
Gui, Main:Add, Button, x570 y190 w70 h30 gDeleteProcessed, 删除选中
Gui, Main:Add, Button, x650 y190 w70 h30 gReAddMainToOrigin, 重加主任务
Gui, Main:Add, Button, x730 y190 w70 h30 gReAddSupplementToOrigin, 重加补充文件
Gui, Main:Add, StatusBar, vStatusBar, 状态: 就绪
if (GuiVisible = 1) {
Gui, Main:Show, w1000 h660, 文件发送器
LogMessage("GUI 创建并显示")
} else {
Gui, Main:Hide
LogMessage("GUI 创建并隐藏")
}
if (IncludeFileName) {
GuiControl, Main:Enable, WithExt
GuiControl, Main:Enable, WithoutExt
} else {
GuiControl, Main:Disable, WithExt
GuiControl, Main:Disable, WithoutExt
GuiControl, Main:, WithExt, 0
GuiControl, Main:, WithoutExt, 0
}
Gosub, CreateFloatWindow
BindHotkeys()
Gosub, LoadTaskList
if (StartTriggerMode = 1) {
SetTimer, MonitorSignal, 100
DetectionStatus := "监控中(信号量模式)"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
}
return
LogMessage(message) {
FormatTime, CurrentTime,, yyyy-MM-dd HH:mm:ss
FileAppend, [%CurrentTime%] %message%`n, %LogFile%
}
LogDebug(message) {
FormatTime, CurrentTime,, yyyy-MM-dd HH:mm:ss
FileAppend, [DEBUG %CurrentTime%] %message%`n, %LogFile%
}
CreateFloatWindow:
Gui, Float:+LastFound +AlwaysOnTop +Border
FloatGuiHwnd := WinExist()
if (!FloatGuiHwnd) {
LogMessage("悬浮窗创建失败:无法获取窗口句柄")
MsgBox, 悬浮窗创建失败,请检查脚本!
return
}
Gui, Float:Add, Text, w300 vFloatSignalDisplay, 信号量 TriggerSender: %SignalValue% (倒计时: %Countdown% 秒)
Gui, Float:Show, x10 y50 w320 h30
FloatVisible := 1
LogMessage("悬浮窗创建成功,句柄: " FloatGuiHwnd ",坐标: (10, 50),大小: (320, 30)")
return
UpdateFloatWindow:
IniRead, SignalValue, %SignalFile%, Signals, %SignalMonitorName%, 0
GuiControl, Float:, FloatSignalDisplay, 信号量 TriggerSender: %SignalValue% (倒计时: %Countdown% 秒)
GuiControl, Main:, SignalStatusDisplay, 信号量 TriggerSender: %SignalValue%
GuiControl, Main:, CountdownDisplay, 信号检测倒计时: %Countdown% 秒
if (WinExist("ahk_id " FloatGuiHwnd)) {
LogMessage("悬浮窗更新: SignalValue=" SignalValue ", Countdown=" Countdown)
} else {
LogMessage("悬浮窗更新失败: 窗口不存在")
}
return
UpdateCountdown:
if (StartTriggerMode != 1) {
return
}
Countdown -= 1
if (Countdown <= 0) {
Countdown := 5
Gosub, MonitorSignal
}
Gosub, UpdateFloatWindow
return
ToggleFloatWindow:
FloatVisible := !FloatVisible
if (FloatVisible = 1) {
Gui, Float:Show
LogMessage("悬浮窗显示,句柄: " FloatGuiHwnd)
} else {
Gui, Float:Hide
LogMessage("悬浮窗隐藏,句柄: " FloatGuiHwnd)
}
return
BindHotkeys() {
try {
Hotkey, %MoveUpKey%, MoveUp
LogMessage("绑定 MoveUpKey: " MoveUpKey " 成功")
} catch e {
LogMessage("绑定 MoveUpKey: " MoveUpKey " 失败: " e)
}
try {
Hotkey, %MoveDownKey%, MoveDown
LogMessage("绑定 MoveDownKey: " MoveDownKey " 成功")
} catch e {
LogMessage("绑定 MoveDownKey: " MoveDownKey " 失败: " e)
}
try {
Hotkey, %DeleteFileKey%, DeleteFile
LogMessage("绑定 DeleteFileKey: " DeleteFileKey " 成功")
} catch e {
LogMessage("绑定 DeleteFileKey: " DeleteFileKey " 失败: " e)
}
try {
Hotkey, %StartSendKey%, SimulateStartSendClick
LogMessage("绑定 StartSendKey: " StartSendKey " 成功")
} catch e {
LogMessage("绑定 StartSendKey: " StartSendKey " 失败: " e)
}
try {
Hotkey, %SendSupplementKey%, SimulateSendSupplementClick
LogMessage("绑定 SendSupplementKey: " SendSupplementKey " 成功")
} catch e {
LogMessage("绑定 SendSupplementKey: " SendSupplementKey " 失败: " e)
}
try {
Hotkey, %SkipFileKey%, SkipFile
LogMessage("绑定 SkipFileKey: " SkipFileKey " 成功")
} catch e {
LogMessage("绑定 SkipFileKey: " SkipFileKey " 失败: " e)
}
try {
Hotkey, %PauseSendKey%, PauseSend
LogMessage("绑定 PauseSendKey: " PauseSendKey " 成功")
} catch e {
LogMessage("绑定 PauseSendKey: " PauseSendKey " 失败: " e)
}
try {
Hotkey, %CustomKey%, TriggerCustomKey
LogMessage("绑定 CustomKey: " CustomKey " 成功")
} catch e {
LogMessage("绑定 CustomKey: " CustomKey " 失败: " e)
}
try {
Hotkey, %AutoTriggerKey%, SimulateStartSendClick
LogMessage("绑定 AutoTriggerKey: " AutoTriggerKey " 成功")
} catch e {
LogMessage("绑定 AutoTriggerKey: " AutoTriggerKey " 失败: " e)
}
if (StartTriggerMode = 0) {
try {
Hotkey, %StartTriggerKey%, SimulateStartSendClick
LogMessage("绑定 StartTriggerKey: " StartTriggerKey " 成功")
} catch e {
LogMessage("绑定 StartTriggerKey: " StartTriggerKey " 失败: " e)
}
}
}
MonitorSignal:
if (StartTriggerMode = 1) {
IniRead, SignalValue, %SignalFile%, Signals, %SignalMonitorName%, 0
IniRead, ReadyForNote, %SignalFile%, Signals, ReadyForNote, 0
if (ReadyForNote = 1) {
LogDebug("检测到 ReadyForNote=1,开始暂停并倒计时")
Gui, WaitGui:New, +AlwaysOnTop
Gui, WaitGui:Add, Text, vWaitText, 等待新建笔记完成: 20 秒
Gui, WaitGui:Show,, 等待中
Loop, 20 {
Sleep, 1000
remaining := 20 - A_Index
GuiControl, WaitGui:, WaitText, 等待新建笔记完成: %remaining% 秒
}
Gui, WaitGui:Destroy
IniRead, ReadyForNote, %SignalFile%, Signals, ReadyForNote, 0
if (ReadyForNote = 1) {
LogDebug("20秒后 ReadyForNote 仍为1,跳过发送")
ToolTip, 新建笔记未完成,暂停发送, , , , 16
SetTimer, RemoveTooltip, -2000
return
}
}
if (SignalValue = 1) {
LogDebug("检测到信号量 " SignalMonitorName "=1,模拟点击发送主任务按钮")
SendingSupplement := false
Gosub, SimulateStartSendClick
IniWrite, 0, %SignalFile%, Signals, %SignalMonitorName%
LogDebug("重置信号量 " SignalMonitorName "=0")
Gosub, RefreshTaskLists
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
}
IniRead, NextSendValue, %SignalFile%, Signals, %SignalTriggerNextSend%, 0
if (NextSendValue = 1) {
LogDebug("检测到信号量 " SignalTriggerNextSend "=1,检查是否发送补充文件")
IniRead, HasSupplement, %SignalFile%, Signals, %SignalHasSupplement%, 0
if (HasSupplement = 1 && CurrentTaskIndex > 0) {
LogDebug("有补充文件,模拟点击发送补充文件按钮,任务编号: " CurrentTaskIndex)
SendingSupplement := true
Gosub, SimulateSendSupplementClick
IniWrite, 0, %SignalFile%, Signals, %SignalTriggerNextSend%
LogDebug("重置信号量 " SignalTriggerNextSend "=0")
Gosub, RefreshTaskLists
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
} else {
LogDebug("无补充文件或任务已完成,任务编号: " CurrentTaskIndex)
if (CurrentTaskIndex > 0) {
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
}
CurrentTaskIndex := 0
if (NextTriggerMode = 0) {
SendInput, %NextTriggerKey%
LogDebug("使用快捷键 " NextTriggerKey " 触发 " SignalNextName)
} else {
IniWrite, 1, %SignalFile%, Signals, %SignalNextName%
LogDebug("写入信号量 " SignalNextName "=1")
}
IniWrite, 0, %SignalFile%, Signals, %SignalTriggerNextSend%
LogDebug("重置信号量 " SignalTriggerNextSend "=0")
Gosub, RefreshTaskLists
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
}
}
}
return
SimulateStartSendClick:
Gui, Main:Default
WinActivate, ahk_id %MainGuiHwnd% ; 激活窗口
Sleep, 200 ; 增加延迟,确保窗口准备好
ControlClick, Button8, ahk_id %MainGuiHwnd%, , Left, 1, NA ; 发送点击
Sleep, 200 ; 点击后等待,确保动作完成
if (ErrorLevel = 0) {
LogMessage("模拟点击发送主任务按钮成功")
} else {
LogMessage("模拟点击发送主任务按钮失败,ErrorLevel: " ErrorLevel)
}
return
SimulateSendSupplementClick:
Gui, Main:Default
WinActivate, ahk_id %MainGuiHwnd% ; 激活窗口
Sleep, 200 ; 增加延迟,确保窗口准备好
ControlClick, Button9, ahk_id %MainGuiHwnd%, , Left, 1, NA ; 发送点击
Sleep, 200 ; 点击后等待,确保动作完成
if (ErrorLevel = 0) {
LogMessage("模拟点击发送补充文件按钮成功")
} else {
LogMessage("模拟点击发送补充文件按钮失败,ErrorLevel: " ErrorLevel)
}
return
SetMainSeed:
Gui, Main:Default
Gui, +Disabled ; 禁用主 GUI
Gui, SeedMain:New, +Owner%MainGuiHwnd% +ToolWindow, 设置主任务种子
Gui, SeedMain:Add, Edit, w400 h200 vMainSeedText,
Gui, SeedMain:Add, Button, gSaveMainSeed, 保存
Gui, SeedMain:Add, Button, gCancelSeedMain, 取消
; 加载当前种子文本
if FileExist(MainSeedFile)
{
FileRead, currentText, %MainSeedFile%
GuiControl, SeedMain:, MainSeedText, %currentText%
}
Gui, SeedMain:Show
return
SaveMainSeed:
Gui, SeedMain:Submit
if (StrLen(MainSeedText) > 3000)
{
MsgBox, 种子文本超过3000字符,已截断!
MainSeedText := SubStr(MainSeedText, 1, 3000)
}
FileDelete, %MainSeedFile%
FileAppend, %MainSeedText%, %MainSeedFile%
Gui, SeedMain:Destroy
Gui, Main:Default
Gui, -Disabled
WinActivate, ahk_id %MainGuiHwnd%
LogMessage("设置主任务种子: " MainSeedText)
return
CancelSeedMain:
Gui, SeedMain:Destroy
Gui, Main:Default
Gui, -Disabled
WinActivate, ahk_id %MainGuiHwnd%
return
SetSupplementSeed:
Gui, Main:Default
Gui, +Disabled ; 禁用主 GUI
Gui, SeedSupplement:New, +Owner%MainGuiHwnd% +ToolWindow, 设置补充任务种子
Gui, SeedSupplement:Add, Edit, w400 h200 vSupplementSeedText,
Gui, SeedSupplement:Add, Button, gSaveSupplementSeed, 保存
Gui, SeedSupplement:Add, Button, gCancelSeedSupplement, 取消
; 加载当前种子文本
if FileExist(SupplementSeedFile)
{
FileRead, currentText, %SupplementSeedFile%
GuiControl, SeedSupplement:, SupplementSeedText, %currentText%
}
Gui, SeedSupplement:Show
return
SaveSupplementSeed:
Gui, SeedSupplement:Submit
if (StrLen(SupplementSeedText) > 3000)
{
MsgBox, 种子文本超过3000字符,已截断!
SupplementSeedText := SubStr(SupplementSeedText, 1, 3000)
}
FileDelete, %SupplementSeedFile%
FileAppend, %SupplementSeedText%, %SupplementSeedFile%
Gui, SeedSupplement:Destroy
Gui, Main:Default
Gui, -Disabled
WinActivate, ahk_id %MainGuiHwnd%
LogMessage("设置补充任务种子: " SupplementSeedText)
return
CancelSeedSupplement:
Gui, SeedSupplement:Destroy
Gui, Main:Default
Gui, -Disabled
WinActivate, ahk_id %MainGuiHwnd%
return
LoadTaskList:
TaskList := []
IniRead, TaskData, %FileListConfig%, Tasks
if (TaskData != "ERROR") {
Loop, Parse, TaskData, `n
{
if (A_LoopField = "")
continue
SplitPath, A_LoopField, , , , Key
IniRead, Value, %FileListConfig%, Tasks, %Key%
if (Value != "ERROR") {
StringSplit, Parts, Value, |
TaskList[A_Index] := {Name: Parts1, MainPath: Parts2, MainName: Parts3, SupplementPath: Parts4, SupplementName: Parts5, MainSent: Parts6 = "1" ? true : false, SupplementSent: Parts7 = "1" ? false : false}
LogMessage("加载任务: 编号=" A_Index " 名称=" Parts1 " 主文件=" Parts2 " 主文件名=" Parts3 " 补充文件=" Parts4 " 补充文件名=" Parts5 " MainSent=" Parts6 " SupplementSent=" Parts7)
}
}
}
Gosub, RefreshTaskLists
return
SaveTaskList:
IniDelete, %FileListConfig%, Tasks
Loop, % TaskList.Length() {
if (TaskList[A_Index].MainPath != "" || TaskList[A_Index].SupplementPath != "") {
Value := TaskList[A_Index].Name "|" TaskList[A_Index].MainPath "|" TaskList[A_Index].MainName "|" TaskList[A_Index].SupplementPath "|" TaskList[A_Index].SupplementName "|" (TaskList[A_Index].MainSent ? "1" : "0") "|" (TaskList[A_Index].SupplementSent ? "1" : "0")
IniWrite, %Value%, %FileListConfig%, Tasks, %A_Index%
LogMessage("保存任务: 编号=" A_Index " 名称=" TaskList[A_Index].Name " 主文件=" TaskList[A_Index].MainPath " 主文件名=" TaskList[A_Index].MainName " 补充文件=" TaskList[A_Index].SupplementPath " 补充文件名=" TaskList[A_Index].SupplementName " MainSent=" TaskList[A_Index].MainSent " SupplementSent=" TaskList[A_Index].SupplementSent)
}
}
return
UpdateRemainingTasks:
tempCount := 0
Loop, % TaskList.Length() {
if (!TaskList[A_Index].MainSent || (TaskList[A_Index].SupplementPath != "" && !TaskList[A_Index].SupplementSent))
tempCount++
}
IniWrite, %tempCount%, %RemainingFilesConfig%, Settings, RemainingFiles
LogMessage("更新 RemainingTasks: " tempCount)
return
ImportFiles:
FileSelectFile, SelectedFiles, M3, , 选择主文件和补充文件 (*.txt; *.srt), Text Files (*.txt; *.srt)
if (SelectedFiles = "") {
ToolTip, 文件选择被取消!
SetTimer, RemoveTooltip, -2000
LogMessage("文件选择被取消")
return
}
TempList := []
LogMessage("开始解析 SelectedFiles: " SelectedFiles)
Loop, Parse, SelectedFiles, `n
{
if (A_Index = 1) {
BaseDir := Trim(A_LoopField, "`r`n")
LogMessage("基目录: " BaseDir)
continue
}
FileName := Trim(A_LoopField, "`r`n")
if (FileName = "") {
LogMessage("文件名为空,跳过: " A_LoopField)
continue
}
CleanPath := BaseDir "\" FileName
LogMessage("尝试导入路径: " CleanPath)
if (!FileExist(CleanPath)) {
LogMessage("路径无效,跳过: " CleanPath)
continue
}
SplitPath, FileName, , , Ext, OutNameNoExt
if (Ext != "txt" && Ext != "srt") {
LogMessage("不支持的文件格式,跳过: " FileName)
continue
}
if (InStr(OutNameNoExt, "_supplement") || Ext = "srt") {
MainName := StrReplace(OutNameNoExt, "_supplement", "")
Found := false
for Index, Task in TempList {
if (Task.Name = MainName) {
Task.SupplementPath := CleanPath
Task.SupplementName := FileName
Found := true
LogMessage("关联补充文件: 任务=" MainName " 名称=" FileName " 路径=" CleanPath)
break
}
}
if (!Found) {
TempList.Push({Name: MainName, MainPath: "", MainName: "", SupplementPath: CleanPath, SupplementName: FileName, MainSent: false, SupplementSent: false})
LogMessage("添加孤立补充文件: 名称=" MainName " 文件名=" FileName " 路径=" CleanPath)
}
} else {
TempList.Push({Name: OutNameNoExt, MainPath: CleanPath, MainName: FileName, SupplementPath: "", SupplementName: "", MainSent: false, SupplementSent: false})
LogMessage("添加主文件: 名称=" OutNameNoExt " 文件名=" FileName " 路径=" CleanPath)
}
}
if (TempList.Length() = 0) {
ToolTip, 未导入任何有效任务!
SetTimer, RemoveTooltip, -2000
LogMessage("未导入任何有效任务")
return
}
SortTempList(TempList)
for Index, TaskObj in TempList
TaskList.Push(TaskObj)
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
temp_number := TempList.Length()
ToolTip, 成功导入 %temp_number% 个任务
SetTimer, RemoveTooltip, -2000
LogMessage("成功导入 " TempList.Length() " 个任务")
return
ImportSupplementFiles:
FileSelectFile, SelectedFiles, M3, , 选择补充文件 (*.txt; *.srt), Text Files (*.txt; *.srt)
if (SelectedFiles = "") {
ToolTip, 文件选择被取消!
SetTimer, RemoveTooltip, -2000
LogMessage("补充文件选择被取消")
return
}
ImportedCount := 0
Loop, Parse, SelectedFiles, `n
{
if (A_Index = 1) {
BaseDir := Trim(A_LoopField, "`r`n")
LogMessage("基目录: " BaseDir)
continue
}
FileName := Trim(A_LoopField, "`r`n")
if (FileName = "") {
LogMessage("文件名为空,跳过: " A_LoopField)
continue
}
CleanPath := BaseDir "\" FileName
LogMessage("尝试导入补充文件路径: " CleanPath)
if (!FileExist(CleanPath)) {
LogMessage("路径无效,跳过: " CleanPath)
continue
}
SplitPath, FileName, , , Ext, OutNameNoExt
if (Ext != "txt" && Ext != "srt") {
LogMessage("不支持的文件格式,跳过: " FileName)
continue
}
MainName := StrReplace(OutNameNoExt, "_supplement", "")
for Index, Task in TaskList {
if (Task.Name = MainName && Task.MainPath != "" && Task.SupplementPath = "") {
Task.SupplementPath := CleanPath
Task.SupplementName := FileName
ImportedCount++
LogMessage("匹配补充文件: 任务=" MainName " 名称=" FileName " 路径=" CleanPath)
break
}
}
}
if (ImportedCount = 0) {
ToolTip, 未匹配任何补充文件!
SetTimer, RemoveTooltip, -2000
LogMessage("未匹配任何补充文件")
return
}
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
ToolTip, 成功导入 %ImportedCount% 个补充文件
SetTimer, RemoveTooltip, -2000
LogMessage("成功导入 " ImportedCount " 个补充文件")
return
SmartRecognizeSort:
Folder := FileSelectFolder, , , 选择包含任务文件的文件夹
if (Folder = "") {
ToolTip, 文件夹选择被取消!
SetTimer, RemoveTooltip, -2000
LogMessage("文件夹选择被取消")
return
}
TempList := []
Loop, Files, %Folder%\*.txt
{
SplitPath, A_LoopFileName, , , , OutNameNoExt
TempList.Push({Name: OutNameNoExt, MainPath: A_LoopFileFullPath, MainName: A_LoopFileName, SupplementPath: "", SupplementName: "", MainSent: false, SupplementSent: false})
LogMessage("扫描主文件: 名称=" OutNameNoExt " 文件名=" A_LoopFileName " 路径=" A_LoopFileFullPath)
}
Loop, Files, %Folder%\*.srt
{
SplitPath, A_LoopFileName, , , , OutNameNoExt
MainName := OutNameNoExt
Found := false
for Index, Task in TempList {
if (Task.Name = MainName) {
Task.SupplementPath := A_LoopFileFullPath
Task.SupplementName := A_LoopFileName
Found := true
LogMessage("匹配补充文件 (.srt): 任务=" MainName " 名称=" A_LoopFileName " 路径=" A_LoopFileFullPath)
break
}
}
if (!Found) {
TempList.Push({Name: MainName, MainPath: "", MainName: "", SupplementPath: A_LoopFileFullPath, SupplementName: A_LoopFileName, MainSent: false, SupplementSent: false})
LogMessage("添加孤立补充文件 (.srt): 名称=" MainName " 文件名=" A_LoopFileName " 路径=" A_LoopFileFullPath)
}
}
Loop, Files, %Folder%\*_supplement.txt
{
SplitPath, A_LoopFileName, , , , OutNameNoExt
MainName := StrReplace(OutNameNoExt, "_supplement", "")
Found := false
for Index, Task in TempList {
if (Task.Name = MainName && Task.SupplementPath = "") {
Task.SupplementPath := A_LoopFileFullPath
Task.SupplementName := A_LoopFileName
Found := true
LogMessage("匹配补充文件 (_supplement.txt): 任务=" MainName " 名称=" A_LoopFileName " 路径=" A_LoopFileFullPath)
break
}
}
if (!Found) {
TempList.Push({Name: MainName, MainPath: "", MainName: "", SupplementPath: A_LoopFileFullPath, SupplementName: A_LoopFileName, MainSent: false, SupplementSent: false})
LogMessage("添加孤立补充文件 (_supplement.txt): 名称=" MainName " 文件名=" A_LoopFileName " 路径=" A_LoopFileFullPath)
}
}
if (TempList.Length() = 0) {
ToolTip, 未找到任何有效任务文件!
SetTimer, RemoveTooltip, -2000
LogMessage("未找到任何有效任务文件")
return
}
SortTempList(TempList)
TaskList := TempList
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
temp_task := TempList.Length()
ToolTip, 智能识别并排列 %temp_task% 个任务
SetTimer, RemoveTooltip, -2000
LogMessage("智能识别并排列 " TempList.Length() " 个任务")
return
SetSendPos:
ToolTip, 请将鼠标移动到目标发送区域(支持双屏幕),然后点击左键!
KeyWait, LButton, D
MouseGetPos, SendPosX, SendPosY
IniWrite, %SendPosX%, %ConfigFile%, Settings, SendPosX
IniWrite, %SendPosY%, %ConfigFile%, Settings, SendPosY
ToolTip, 位置已记录:X=%SendPosX%, Y=%SendPosY%
SetTimer, RemoveTooltip, -2000
LogMessage("发送位置设置: X=" SendPosX " Y=" SendPosY)
return
MoveUp:
GuiControl, Main:-Redraw, ToProcessList
Gui, Main:ListView, ToProcessList
SelectedRow := LV_GetNext()
if (SelectedRow > 1 && (!TaskList[SelectedRow].MainSent || (TaskList[SelectedRow].SupplementPath != "" && !TaskList[SelectedRow].SupplementSent)) && TaskList[SelectedRow - 1].MainPath != "") {
Temp := TaskList[SelectedRow - 1]
TaskList[SelectedRow - 1] := TaskList[SelectedRow]
TaskList[SelectedRow] := Temp
Gosub, SaveTaskList
Gosub, RefreshTaskLists
LV_Modify(SelectedRow - 1, "Select Focus")
LogMessage("上移任务: 从 " SelectedRow " 到 " (SelectedRow - 1))
} else {
ToolTip, 无法上移!
SetTimer, RemoveTooltip, -2000
}
GuiControl, Main:+Redraw, ToProcessList
return
MoveDown:
GuiControl, Main:-Redraw, ToProcessList
Gui, Main:ListView, ToProcessList
SelectedRow := LV_GetNext()
if (SelectedRow < TaskList.Length() && (!TaskList[SelectedRow].MainSent || (TaskList[SelectedRow].SupplementPath != "" && !TaskList[SelectedRow].SupplementSent)) && TaskList[SelectedRow + 1].MainPath != "") {
Temp := TaskList[SelectedRow + 1]
TaskList[SelectedRow + 1] := TaskList[SelectedRow]
TaskList[SelectedRow] := Temp
Gosub, SaveTaskList
Gosub, RefreshTaskLists
LV_Modify(SelectedRow + 1, "Select Focus")
LogMessage("下移任务: 从 " SelectedRow " 到 " (SelectedRow + 1))
} else {
ToolTip, 无法下移!
SetTimer, RemoveTooltip, -2000
}
GuiControl, Main:+Redraw, ToProcessList
return
DeleteFile:
GuiControl, Main:-Redraw, ToProcessList
Gui, Main:ListView, ToProcessList
SelectedRow := LV_GetNext()
if (SelectedRow > 0 && (!TaskList[SelectedRow].MainSent || (TaskList[SelectedRow].SupplementPath != "" && !TaskList[SelectedRow].SupplementSent))) {
TaskList[SelectedRow] := {Name: "", MainPath: "", MainName: "", SupplementPath: "", SupplementName: "", MainSent: true, SupplementSent: true}
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
ToolTip, 已删除
SetTimer, RemoveTooltip, -2000
LogMessage("删除任务: 编号=" SelectedRow)
} else {
ToolTip, 无法删除!
SetTimer, RemoveTooltip, -2000
}
GuiControl, Main:+Redraw, ToProcessList
return
BatchDelete:
Gui, Main:ListView, ToProcessList
SelectedRows := []
Row := 0
Loop {
Row := LV_GetNext(Row)
if (Row = 0)
break
SelectedRows.Push(Row)
}
if (SelectedRows.Length() = 0) {
ToolTip, 请先选中至少一个待处理任务!
SetTimer, RemoveTooltip, -2000
return
}
Loop, % SelectedRows.Length() {
Row := SelectedRows[A_Index]
if (Row > 0 && (!TaskList[Row].MainSent || (TaskList[Row].SupplementPath != "" && !TaskList[Row].SupplementSent)))
TaskList[Row] := {Name: "", MainPath: "", MainName: "", SupplementPath: "", SupplementName: "", MainSent: true, SupplementSent: true}
}
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
ToolTip, 已批量删除
SetTimer, RemoveTooltip, -2000
LogMessage("批量删除任务: 共 " SelectedRows.Length() " 个")
return
StartSend:
if (IsSending) {
return
}
IsSending := true
Critical
if (IsPaused) {
ToolTip, 发送已暂停,请先恢复!, , , , 16
SetTimer, RemoveTooltip, -2000
IsSending := false
return
}
DetectionStatus := "发送中"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
Gui, Main:Hide
Gui, Main:ListView, ToProcessList
SelectedRow := LV_GetNext(0, "Focused")
if (SelectedRow > 0 && SelectedRow <= TaskList.Length() && IsObject(TaskList[SelectedRow]) && !TaskList[SelectedRow].MainSent && TaskList[SelectedRow].MainPath != "") {
CurrentTaskIndex := SelectedRow
} else {
CurrentTaskIndex := 0
Loop, % TaskList.Length() {
if (!TaskList[A_Index].MainSent && TaskList[A_Index].MainPath != "") {
CurrentTaskIndex := A_Index
break
}
}
if (CurrentTaskIndex = 0) {
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, 所有主任务已发送完成, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "已完成"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
GuiControl, Main:, StatusBar, 状态: 所有主任务已发送完成
LogMessage("所有主任务已发送完成")
IsSending := false
return
}
}
SendingSupplement := false
Gosub, SendTask
IsSending := false
return
SendSupplement:
if (IsSending) {
return
}
IsSending := true
Critical
if (IsPaused) {
ToolTip, 发送已暂停,请先恢复!, , , , 16
SetTimer, RemoveTooltip, -2000
IsSending := false
return
}
DetectionStatus := "发送中"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
Gui, Main:Hide
Gui, Main:ListView, ToProcessList
SelectedRow := LV_GetNext(0, "Focused")
if (SelectedRow > 0 && SelectedRow <= TaskList.Length() && IsObject(TaskList[SelectedRow]) && TaskList[SelectedRow].MainSent && !TaskList[SelectedRow].SupplementSent && TaskList[SelectedRow].SupplementPath != "") {
CurrentTaskIndex := SelectedRow
} else {
CurrentTaskIndex := 0
Loop, % TaskList.Length() {
if (TaskList[A_Index].MainSent && !TaskList[A_Index].SupplementSent && TaskList[A_Index].SupplementPath != "") {
CurrentTaskIndex := A_Index
break
}
}
if (CurrentTaskIndex = 0) {
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, 无可发送的补充文件或主任务未发送, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "就绪"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("无可发送的补充文件或主任务未发送")
IsSending := false
return
}
}
if (!TaskList[CurrentTaskIndex].MainSent) {
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, 请先发送主任务!, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "就绪"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("尝试发送补充文件失败: 主任务尚未发送,任务编号=" CurrentTaskIndex)
IsSending := false
return
}
SendingSupplement := true
Gosub, SendTask
IsSending := false
return
SendTask:
IniRead, ReadyForNote, %SignalFile%, Signals, ReadyForNote, 0
if (ReadyForNote = 1) {
LogDebug("检测到 ReadyForNote=1,开始暂停并倒计时")
Gui, WaitGui:New, +AlwaysOnTop
Gui, WaitGui:Add, Text, vWaitText, 等待新建笔记完成: 20 秒
Gui, WaitGui:Show,, 等待中
Loop, 10 {
Sleep, 1000
remaining := 10 - A_Index
GuiControl, WaitGui:, WaitText, 等待新建笔记完成: %remaining% 秒
}
Gui, WaitGui:Destroy
IniRead, ReadyForNote, %SignalFile%, Signals, ReadyForNote, 0
if (ReadyForNote = 1) {
LogDebug("10秒后 ReadyForNote 仍为1,跳过发送")
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, 新建笔记未完成,跳过发送, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "等待"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
return
}
}
TaskObj := TaskList[CurrentTaskIndex]
MainPath := TaskObj.MainPath
SupplementPath := TaskObj.SupplementPath
TaskName := TaskObj.MainName
SplitPath, TaskName,,,, OutNameNoExt
LogMessage("尝试发送任务: 编号=" CurrentTaskIndex " 名称=" TaskName " 主文件=" MainPath " 补充文件=" SupplementPath " 是否发送补充文件=" (SendingSupplement ? "是" : "否"))
FilePath := SendingSupplement ? SupplementPath : MainPath
FileType := SendingSupplement ? "补充文件" : "主文件"
if (!FileExist(FilePath)) {
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, %FileType% 路径不存在:%FilePath%, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "错误"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("发送失败: " FileType " 路径不存在 - " FilePath)
return
}
Content := ReadFileContent(FilePath)
if (Content = "") {
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, 无法读取 %FileType% 内容!, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "错误"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("发送失败: 无法读取 " FileType " 内容 - " FilePath)
return
}
if (!SendingSupplement && SupplementPath != "" && !TaskObj.SupplementSent) {
IniWrite, 1, %SignalFile%, Signals, %SignalHasSupplement%
LogDebug("设置信号量 " SignalHasSupplement "=1")
} else if (SendingSupplement) {
IniWrite, 0, %SignalFile%, Signals, %SignalHasSupplement%
LogDebug("设置信号量 " SignalHasSupplement "=0")
}
IniRead, IncludeFileName, %ConfigFile%, Settings, IncludeFileName, 0
IniRead, WithExt, %ConfigFile%, Settings, WithExt, 0
IniRead, WithoutExt, %ConfigFile%, Settings, WithoutExt, 0
IniRead, IncludeFullPath, %ConfigFile%, Settings, IncludeFullPath, 0
SendText := ""
if (IncludeFileName && !SendingSupplement) {
if (WithExt)
SendText .= "任务名: " . TaskName . "`n"
else if (WithoutExt)
SendText .= "文件名: " . OutNameNoExt . "`n"
}
if (IncludeFullPath)
SendText .= FileType "路径: " . FilePath . "`n"
if (SendingSupplement) {
SeedFile := SupplementSeedFile
DefaultSeed := "aa"
} else {
SeedFile := MainSeedFile
DefaultSeed := "ww"
}
if FileExist(SeedFile) {
FileRead, SeedText, %SeedFile%
if ErrorLevel {
SeedText := DefaultSeed
LogMessage("读取种子文件失败,使用默认值 '" DefaultSeed "'")
}
} else {
SeedText := DefaultSeed
LogMessage("种子文件不存在,使用默认值 '" DefaultSeed "'")
}
; Combine seed statement and file content into staging area
StagingArea := SeedText . "`n" . SendText . Content
IniRead, SendPosX, %ConfigFile%, Settings, SendPosX, 300
IniRead, SendPosY, %ConfigFile%, Settings, SendPosY, 500
MouseMove, %SendPosX%, %SendPosY%, 0
Sleep, 200
Click
Sleep, 1000
Clipboard := StagingArea
ClipWait, 2
if (ErrorLevel) {
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
ToolTip, 剪贴板更新失败!, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "错误"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("发送失败: 剪贴板更新失败")
return
}
Send, ^v
Sleep, 200
Send, {Enter}
Sleep, 200
; 保存当前文件名到 current_file.ini
SplitPath, FilePath, , , , OutNameNoExt
IniWrite, %OutNameNoExt%, %CurrentFileConfig%, CurrentFile, Name
LogMessage("保存当前文件名: " OutNameNoExt " 到 " CurrentFileConfig)
if (!SendingSupplement) {
TaskObj.MainSent := true
LogMessage("标记主文件为已发送: 编号=" CurrentTaskIndex " 名称=" TaskName)
} else {
TaskObj.SupplementSent := true
LogMessage("标记补充文件为已发送: 编号=" CurrentTaskIndex " 名称=" TaskObj.SupplementName)
}
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
; 触发 TriggerMonitor
if (NextTriggerMode = 0) {
SendInput, %NextTriggerKey%
LogDebug("使用快捷键 " NextTriggerKey " 触发 " SignalNextName)
} else {
IniWrite, 1, %SignalFile%, Signals, %SignalNextName%
LogDebug("写入信号量 " SignalNextName "=1")
}
Sleep, %TriggerDelay%
if (TriggerCustomKeyAfterSend) {
LogMessage("触发 CustomKey: " CustomKey)
Gosub, TriggerCustomKey
}
ToolTip, 已发送 %FileType%:%CurrentTaskIndex% - %TaskName%, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "就绪"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("成功发送 " FileType ": 编号=" CurrentTaskIndex " 名称=" TaskName)
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
return
ReadFileContent(FilePath) {
FileRead, Content, *P65001 %FilePath%
if (ErrorLevel) {
LogMessage("读取失败: 无法读取文件 - " FilePath)
return ""
}
return Content
}
SimulateSend:
Gui, Main:Hide
LogMessage("开始模拟发送")
Sleep, 200
if (NextTriggerMode = 0) {
SendInput, %NextTriggerKey%
LogDebug("模拟发送 - 使用快捷键 " NextTriggerKey " 触发 " SignalNextName)
} else {
IniWrite, 1, %SignalFile%, Signals, %SignalNextName%
LogDebug("模拟发送 - 写入信号量 " SignalNextName "=1")
}
if (TriggerCustomKeyAfterSend) {
LogMessage("模拟发送 - 触发 CustomKey: " CustomKey)
Gosub, TriggerCustomKey
}
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
Gosub, RefreshTaskLists
ToolTip, 模拟发送完成, , , , 16
SetTimer, RemoveTooltip, -2000
DetectionStatus := "就绪"
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogMessage("模拟发送完成")
return
TriggerCustomKey:
SendInput, %CustomKey%
LogMessage("已发送 CustomKey: " CustomKey)
return
SkipFile:
Gui, Main:ListView, ToProcessList
SelectedRow := LV_GetNext(0, "Focused")
if (SelectedRow > 0 && SelectedRow <= TaskList.Length() && IsObject(TaskList[SelectedRow]) && (!TaskList[SelectedRow].MainSent || (TaskList[SelectedRow].SupplementPath != "" && !TaskList[SelectedRow].SupplementSent))) {
TaskList[SelectedRow].MainSent := true
TaskList[SelectedRow].SupplementSent := true
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
ToolTip, 已跳过任务:%SelectedRow%
SetTimer, RemoveTooltip, -2000
LogMessage("跳过任务: 编号=" SelectedRow)
} else {
ToolTip, 无法跳过!
SetTimer, RemoveTooltip, -2000
}
return
ViewFile:
Gui, Main:ListView, ProcessedList
SelectedRow := LV_GetNext()
if (SelectedRow > 0 && (TaskList[SelectedRow].MainSent || TaskList[SelectedRow].SupplementSent)) {
Gui, FileChoice:New, +AlwaysOnTop
Gui, FileChoice:Add, Button, w100 gViewMainFile, 查看主文件
Gui, FileChoice:Add, Button, w100 gViewSupplementFile, 查看补充文件
Gui, FileChoice:Show
global ViewFileIndex := SelectedRow
} else {
ToolTip, 无法查看!
SetTimer, RemoveTooltip, -2000
}
return
ViewMainFile:
Gui, FileChoice:Destroy
if (FileExist(TaskList[ViewFileIndex].MainPath)) {
Run, % TaskList[ViewFileIndex].MainPath
ToolTip, 已打开主文件:%ViewFileIndex%
SetTimer, RemoveTooltip, -2000
LogMessage("查看主文件: 编号=" ViewFileIndex " 路径=" TaskList[ViewFileIndex].MainPath)
} else {
tempPath := TaskList[ViewFileIndex].MainPath
ToolTip, 主文件路径不存在:%tempPath%
SetTimer, RemoveTooltip, -2000
LogMessage("查看失败: 主文件路径不存在 - " tempPath)
}
return
ViewSupplementFile:
Gui, FileChoice:Destroy
if (TaskList[ViewFileIndex].SupplementPath != "" && FileExist(TaskList[ViewFileIndex].SupplementPath)) {
Run, % TaskList[ViewFileIndex].SupplementPath
ToolTip, 已打开补充文件:%ViewFileIndex%
SetTimer, RemoveTooltip, -2000
LogMessage("查看补充文件: 编号=" ViewFileIndex " 路径=" TaskList[ViewFileIndex].SupplementPath)
} else {
tempPath := TaskList[ViewFileIndex].SupplementPath
ToolTip, 补充文件不存在:%tempPath%
SetTimer, RemoveTooltip, -2000
LogMessage("查看失败: 补充文件路径不存在 - " tempPath)
}
return
ClearProcessed:
MsgBox, 清除已处理任务功能已禁用,以保留任务记录!
return
DeleteProcessed:
Gui, Main:ListView, ProcessedList
SelectedRow := LV_GetNext()
if (SelectedRow > 0 && (TaskList[SelectedRow].MainSent || TaskList[SelectedRow].SupplementSent)) {
TaskList[SelectedRow] := {Name: "", MainPath: "", MainName: "", SupplementPath: "", SupplementName: "", MainSent: true, SupplementSent: true}
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
ToolTip, 已删除已处理任务:%SelectedRow%
SetTimer, RemoveTooltip, -2000
LogMessage("删除已处理任务: 编号=" SelectedRow)
} else {
ToolTip, 无法删除!
SetTimer, RemoveTooltip, -2000
}
return
PauseSend:
IsPaused := !IsPaused
if (IsPaused) {
try {
Hotkey, %MoveUpKey%, Off
Hotkey, %MoveDownKey%, Off
Hotkey, %DeleteFileKey%, Off
Hotkey, %StartSendKey%, Off
Hotkey, %SendSupplementKey%, Off
Hotkey, %SkipFileKey%, Off
LogMessage("暂停时禁用快捷键成功")
} catch e {
LogMessage("暂停时禁用快捷键失败: " e)
}
Gui, Main:Hide
Click
DetectionStatus := "已暂停"
} else {
try {
Hotkey, %MoveUpKey%, On
Hotkey, %MoveDownKey%, On
Hotkey, %DeleteFileKey%, On
Hotkey, %StartSendKey%, On
Hotkey, %SendSupplementKey%, On
Hotkey, %SkipFileKey%, On
LogMessage("恢复时启用快捷键成功")
} catch e {
LogMessage("恢复时启用快捷键失败: " e)
}
Gui, Main:Show
WinActivate, ahk_id %MainGuiHwnd%
DetectionStatus := "就绪"
}
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
GuiControl, Main:, StatusBar, % (IsPaused ? "状态: 已暂停" : "状态: 就绪")
ToolTip, % (IsPaused ? "已暂停" : "已恢复")
SetTimer, RemoveTooltip, -2000
LogMessage("发送状态: " (IsPaused ? "暂停" : "恢复"))
return
SortTempList(TempList) {
TempArray := []
for Index, TaskObj in TempList {
TaskName := TaskObj.Name
RegExMatch(TaskName, "^\D*(\d+)", Match)
Num := Match1 ? Match1 : 999999
TempArray.Push({Num: Num, Obj: TaskObj})
}
SortArray(TempArray, 1, TempArray.Length())
TempList := []
for Index, Item in TempArray
TempList.Push(Item.Obj)
}
SortArray(arr, left, right) {
if (left < right) {
pivot := Partition(arr, left, right)
SortArray(arr, left, pivot - 1)
SortArray(arr, pivot + 1, right)
}
}
Partition(arr, left, right) {
pivotValue := arr[right].Num
i := left - 1
Loop, % right - left + 1 {
j := left + A_Index - 1
if (arr[j].Num <= pivotValue) {
i++
Temp := arr[i]
arr[i] := arr[j]
arr[j] := Temp
}
}
Temp := arr[i + 1]
arr[i + 1] := arr[right]
arr[right] := Temp
return i + 1
}
RefreshTaskLists:
GuiControl, Main:-Redraw, ToProcessList
GuiControl, Main:-Redraw, ProcessedList
Gui, Main:ListView, ToProcessList
LV_Delete()
Loop, % TaskList.Length() {
TaskObj := TaskList[A_Index]
MainDisplay := !TaskObj.MainSent ? TaskObj.MainName : ""
SupplementDisplay := (TaskObj.SupplementPath != "" && !TaskObj.SupplementSent) ? TaskObj.SupplementName : ""
LV_Add("", A_Index, MainDisplay, SupplementDisplay)
}
LV_ModifyCol()
LV_ModifyCol(1, 60)
LV_ModifyCol(2, 150)
LV_ModifyCol(3, 150)
Gui, Main:ListView, ProcessedList
LV_Delete()
Loop, % TaskList.Length() {
TaskObj := TaskList[A_Index]
MainDisplay := TaskObj.MainSent ? TaskObj.MainName . " (已发送)" : ""
SupplementDisplay := TaskObj.SupplementSent ? TaskObj.SupplementName . " (已发送)" : ""
LV_Add("", A_Index, MainDisplay, SupplementDisplay)
}
LV_ModifyCol()
LV_ModifyCol(1, 60)
LV_ModifyCol(2, 150)
LV_ModifyCol(3, 150)
GuiControl, Main:+Redraw, ToProcessList
GuiControl, Main:+Redraw, ProcessedList
Gosub, UpdateStatusBar
LogMessage("任务列表刷新完成: 总任务数=" TaskList.Length())
return
UpdateStatusBar:
if (IsPaused)
GuiControl, Main:, StatusBar, 状态: 已暂停
else {
NextIndex := 0
Loop, % TaskList.Length() {
if (!TaskList[A_Index].MainSent || (TaskList[A_Index].SupplementPath != "" && !TaskList[A_Index].SupplementSent)) {
NextIndex := A_Index
break
}
}
if (NextIndex > 0) {
TaskObj := TaskList[NextIndex]
NextFile := !TaskObj.MainSent ? TaskObj.MainName : TaskObj.SupplementName
GuiControl, Main:, StatusBar, % "状态: 下次发送 " NextIndex " - " NextFile ",请按 " StartSendKey " 发送"
} else
GuiControl, Main:, StatusBar, 状态: 所有任务已发送完成
}
return
ListViewClick:
if (A_GuiEvent = "DoubleClick") {
Gui, Main:ListView, %A_GuiControl%
SelectedRow := LV_GetNext()
if (SelectedRow > 0) {
Gui, FileChoice:New, +AlwaysOnTop
Gui, FileChoice:Add, Button, w100 gViewMainFile, 查看主文件
Gui, FileChoice:Add, Button, w100 gViewSupplementFile, 查看补充文件
Gui, FileChoice:Show
global ViewFileIndex := SelectedRow
}
}
return
ToggleFileNameOptions:
Gui, Main:Submit, NoHide
if (IncludeFileName) {
GuiControl, Main:Enable, WithExt
GuiControl, Main:Enable, WithoutExt
if (!WithExt && !WithoutExt)
GuiControl, Main:, WithExt, 1
} else {
GuiControl, Main:Disable, WithExt
GuiControl, Main:Disable, WithoutExt
GuiControl, Main:, WithExt, 0
GuiControl, Main:, WithoutExt, 0
}
Gosub, SaveSettings
return
SaveSettings:
Gui, Main:Submit, NoHide
IniWrite, %IncludeFileName%, %ConfigFile%, Settings, IncludeFileName
IniWrite, %WithExt%, %ConfigFile%, Settings, WithExt
IniWrite, %WithoutExt%, %ConfigFile%, Settings, WithoutExt
IniWrite, %IncludeFullPath%, %ConfigFile%, Settings, IncludeFullPath
IniWrite, %TriggerCustomKeyAfterSend%, %ConfigFile%, Settings, TriggerCustomKeyAfterSend
LogMessage("保存设置: IncludeFileName=" IncludeFileName " WithExt=" WithExt " WithoutExt=" WithoutExt " IncludeFullPath=" IncludeFullPath " TriggerCustomKeyAfterSend=" TriggerCustomKeyAfterSend)
return
SaveStartTriggerMode:
Gui, Main:Submit, NoHide
StartTriggerMode := (StartTriggerModeKey = 1) ? 0 : 1
IniWrite, %StartTriggerMode%, %ConfigFile%, Settings, StartTriggerMode
if (StartTriggerMode = 0) {
try {
Hotkey, %StartTriggerKey%, SimulateStartSendClick
LogMessage("绑定 StartTriggerKey: " StartTriggerKey " 成功")
} catch e {
LogMessage("绑定 StartTriggerKey: " StartTriggerKey " 失败: " e)
}
SetTimer, MonitorSignal, Off
DetectionStatus := "就绪(快捷键模式)"
} else {
try {
Hotkey, %StartTriggerKey%, Off
LogMessage("解除 StartTriggerKey 绑定: " StartTriggerKey)
} catch e {
}
SetTimer, MonitorSignal, 100
DetectionStatus := "监控中(信号量模式)"
}
GuiControl,, DetectionStatusDisplay, 检测状态: %DetectionStatus%
LogDebug("保存被触发模式: " (StartTriggerMode = 0 ? "快捷键" : "信号量"))
return
SaveNextTriggerMode:
Gui, Main:Submit, NoHide
NextTriggerMode := (NextTriggerModeKey = 1) ? 0 : 1
IniWrite, %NextTriggerMode%, %ConfigFile%, Settings, NextTriggerMode
LogDebug("保存触发下一脚本模式: " (NextTriggerMode = 0 ? "快捷键" : "信号量"))
return
RemoveTooltip:
ToolTip
return
GuiClose:
Gui, Main:Hide
GuiVisible := 0
IniWrite, %GuiVisible%, %ConfigFile%, Settings, GuiVisible
SetTimer, MonitorSignal, Off
Gui, Float:Destroy
LogMessage("GUI 关闭")
return
SaveTriggerDelay:
Gui, Main:Submit, NoHide
TriggerDelay := TriggerDelay
IniWrite, %TriggerDelay%, %ConfigFile%, Settings, TriggerDelay
ToolTip, 触发延迟已设置为:%TriggerDelay%ms
SetTimer, RemoveTooltip, -2000
LogMessage("设置触发延迟: " TriggerDelay "ms")
return
ShowHotkeyMenu:
Menu, HotkeyMenu, Add
Menu, HotkeyMenu, DeleteAll
Menu, HotkeyMenu, Add, 上移 (%MoveUpKey%), SetMoveUpKey
Menu, HotkeyMenu, Add, 下移 (%MoveDownKey%), SetMoveDownKey
Menu, HotkeyMenu, Add, 删除 (%DeleteFileKey%), SetDeleteFileKey
Menu, HotkeyMenu, Add, 发送 (%StartSendKey%), SetStartSendKey
Menu, HotkeyMenu, Add, 发送补充 (%SendSupplementKey%), SetSendSupplementKey
Menu, HotkeyMenu, Add, 跳过 (%SkipFileKey%), SetSkipFileKey
Menu, HotkeyMenu, Add, 暂停 (%PauseSendKey%), SetPauseSendKey
Menu, HotkeyMenu, Add, 自定义快捷键 (%CustomKey%), SetCustomKey
Menu, HotkeyMenu, Add, 被触发快捷键 (%StartTriggerKey%), SetStartTriggerKey
Menu, HotkeyMenu, Add, 下一触发快捷键 (%NextTriggerKey%), SetNextTriggerKey
Menu, HotkeyMenu, Show
return
SetMoveUpKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "MoveUpKey"
global CurrentLabel := "MoveUp"
return
SetMoveDownKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "MoveDownKey"
global CurrentLabel := "MoveDown"
return
SetDeleteFileKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "DeleteFileKey"
global CurrentLabel := "DeleteFile"
return
SetStartSendKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "StartSendKey"
global CurrentLabel := "SimulateStartSendClick"
return
SetSendSupplementKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "SendSupplementKey"
global CurrentLabel := "SimulateSendSupplementClick"
return
SetSkipFileKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "SkipFileKey"
global CurrentLabel := "SkipFile"
return
SetPauseSendKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "PauseSendKey"
global CurrentLabel := "PauseSend"
return
SetCustomKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "CustomKey"
global CurrentLabel := "TriggerCustomKey"
return
SetStartTriggerKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "StartTriggerKey"
global CurrentLabel := "SimulateStartSendClick"
return
SetNextTriggerKey:
Gosub, ShowHotkeyInput
global CurrentHotkeyField := "NextTriggerKey"
global CurrentLabel := ""
return
ShowHotkeyInput:
Gui, KeyInput:New, +AlwaysOnTop
Gui, KeyInput:Add, CheckBox, vUseCtrl gUpdateHotkeyPreview, 使用 Ctrl
Gui, KeyInput:Add, CheckBox, vUseAlt gUpdateHotkeyPreview xm, 使用 Alt
Gui, KeyInput:Add, CheckBox, vUseWin gUpdateHotkeyPreview xm, 使用 Win
Gui, KeyInput:Add, Text, xm, 选择按键:
Gui, KeyInput:Add, DropDownList, vHotkeyChoice gUpdateHotkeyPreview, A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|Del
Gui, KeyInput:Add, Text, xm vHotkeyPreview, 快捷键预览:
Gui, KeyInput:Add, Button, default w80 gSaveHotkey, 确定
Gui, KeyInput:Show
return
UpdateHotkeyPreview:
Gui, KeyInput:Submit, NoHide
newKey := ""
if (UseCtrl)
newKey .= "^"
if (UseAlt)
newKey .= "!"
if (UseWin)
newKey .= "#"
if (HotkeyChoice != "")
newKey .= HotkeyChoice
GuiControl, KeyInput:, HotkeyPreview, 快捷键预览: %newKey%
return
SaveHotkey:
Gui, KeyInput:Submit
newKey := ""
if (UseCtrl)
newKey .= "^"
if (UseAlt)
newKey .= "!"
if (UseWin)
newKey .= "#"
if (HotkeyChoice != "")
newKey .= HotkeyChoice
else {
MsgBox, 请选择一个按键!
Gui, KeyInput:Show
return
}
if (newKey = "") {
MsgBox, 请至少选择一个修饰键或按键!
Gui, KeyInput:Show
return
}
if (newKey = MoveUpKey || newKey = MoveDownKey || newKey = DeleteFileKey || newKey = StartSendKey || newKey = SendSupplementKey || newKey = SkipFileKey || newKey = PauseSendKey || newKey = CustomKey || newKey = StartTriggerKey || newKey = NextTriggerKey) && (newKey != %CurrentHotkeyField%) {
MsgBox, 快捷键 %newKey% 已与其他功能冲突,请选择其他组合!
Gui, KeyInput:Show
return
}
if (%CurrentHotkeyField% != "") {
try {
Hotkey, % %CurrentHotkeyField%, Off
LogMessage("释放旧快捷键 " CurrentHotkeyField ": " %CurrentHotkeyField% " 成功")
} catch e {
LogMessage("释放旧快捷键 " CurrentHotkeyField ": " %CurrentHotkeyField% " 失败: " e)
}
}
%CurrentHotkeyField% := newKey
IniWrite, %newKey%, %ConfigFile%, Hotkeys, %CurrentHotkeyField%
if (CurrentLabel != "") {
try {
Hotkey, %newKey%, %CurrentLabel%
LogMessage("绑定新快捷键 " CurrentHotkeyField ": " newKey " 成功")
} catch e {
LogMessage("绑定新快捷键 " CurrentHotkeyField ": " newKey " 失败: " e)
defaultKey := (CurrentHotkeyField = "MoveUpKey" ? "^Up" : CurrentHotkeyField = "MoveDownKey" ? "^Down" : CurrentHotkeyField = "DeleteFileKey" ? "^Delete" : CurrentHotkeyField = "StartSendKey" ? "^!s" : CurrentHotkeyField = "SendSupplementKey" ? "^!u" : CurrentHotkeyField = "SkipFileKey" ? "^!k" : CurrentHotkeyField = "PauseSendKey" ? "^!p" : CurrentHotkeyField = "CustomKey" ? "^!t" : CurrentHotkeyField = "StartTriggerKey" ? "^!s" : CurrentHotkeyField = "NextTriggerKey" ? "^!m" : "^!n")
%CurrentHotkeyField% := defaultKey
IniWrite, %defaultKey%, %ConfigFile%, Hotkeys, %CurrentHotkeyField%
try {
Hotkey, %defaultKey%, %CurrentLabel%
LogMessage("恢复默认快捷键 " CurrentHotkeyField ": " defaultKey " 成功")
} catch e {
LogMessage("恢复默认快捷键 " CurrentHotkeyField ": " defaultKey " 失败: " e)
}
}
}
GuiControl, Main:, %CurrentHotkeyField%Display, % (CurrentHotkeyField = "MoveUpKey" ? "上移" : CurrentHotkeyField = "MoveDownKey" ? "下移" : CurrentHotkeyField = "DeleteFileKey" ? "删除" : CurrentHotkeyField = "StartSendKey" ? "发送" : CurrentHotkeyField = "SendSupplementKey" ? "发送补充" : CurrentHotkeyField = "SkipFileKey" ? "跳过" : CurrentHotkeyField = "PauseSendKey" ? "暂停" : CurrentHotkeyField = "CustomKey" ? "自定义" : CurrentHotkeyField = "StartTriggerKey" ? "被触发" : "下一触发") "快捷键: " newKey
Gui, KeyInput:Destroy
ToolTip, %CurrentHotkeyField% 已设置为:%newKey%, , , , 16
SetTimer, RemoveTooltip, -2000
LogMessage(CurrentHotkeyField " 设置为: " newKey)
return
ReAddMainToOrigin:
Gui, Main:ListView, ProcessedList
SelectedRow := LV_GetNext()
if (SelectedRow > 0 && TaskList[SelectedRow].MainSent && TaskList[SelectedRow].MainPath != "") {
TaskList[SelectedRow].MainSent := false
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
temp_task := TaskList[SelectedRow].MainName
ToolTip, 已将主任务 %SelectedRow% - %temp_task% 重新加入原位
SetTimer, RemoveTooltip, -2000
LogMessage("重新加入主任务原位: 编号=" SelectedRow " 名称=" TaskList[SelectedRow].MainName)
} else {
ToolTip, 无法重新加入主任务!请确认已选择已发送的主任务
SetTimer, RemoveTooltip, -2000
LogMessage("重加主任务失败: 编号=" SelectedRow " 未选择有效任务或主任务未发送")
}
return
ReAddSupplementToOrigin:
Gui, Main:ListView, ProcessedList
SelectedRow := LV_GetNext()
if (SelectedRow > 0 && TaskList[SelectedRow].SupplementSent && TaskList[SelectedRow].SupplementPath != "") {
TaskList[SelectedRow].SupplementSent := false
Gosub, SaveTaskList
Gosub, UpdateRemainingTasks
Gosub, RefreshTaskLists
temp_task := TaskList[SelectedRow].SupplementName
ToolTip, 已将补充文件 %SelectedRow% - %temp_task% 重新加入原位
SetTimer, RemoveTooltip, -2000
LogMessage("重新加入补充文件原位: 编号=" SelectedRow " 名称=" TaskList[SelectedRow].SupplementName)
} else {
ToolTip, 无法重新加入补充文件!请确认已选择已发送的补充文件
SetTimer, RemoveTooltip, -2000
LogMessage("重加补充文件失败: 编号=" SelectedRow " 未选择有效任务或补充文件未发送")
}
return