部分script没办法运行

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: 部分script没办法运行

Re: 部分script没办法运行

Post by WKen » 07 May 2023, 04:44

切换到标题为Macrium Reflect的窗口,除了关闭屏幕不起作用,在Windows 11,文件操作和msgbox正常。

部分script没办法运行

Post by haomingchen1998 » 03 May 2023, 14:40

FileCopy之后的line都在 ActiveTitle = "Macrium Reflect"出现后停止工作了. 我想让我的屏幕在文件传输的时候关掉, 传输完成后再开启, 给我msgbox 确认关机. 但是ActiveTitle = "Macrium Reflect" 出现后, 不止5秒内不关闭屏幕, msgbox也不显示了. 完全找不到问题在哪里, 求助, 谢了!

Code: Select all

; Wait till Window Title found
	#Persistent
	SetTimer, WaitForText, 100
	return

WaitForText:
WinGetActiveTitle, ActiveTitle
TrayTip, active title, %ActiveTitle%, 3
If (ActiveTitle = "Macrium Reflect") ; change this to match the title of the confirmation message box
{
    SetTimer, WaitForText, Off
	
Loop, Files, D:\*.*, F
{
    FormatTime, CurrentDateTime,, MM-dd-yyyy
	;	Rename files in D drive with date as prefix
    FileMove, % A_LoopFileFullPath, % "D:\" CurrentDateTime "_" A_LoopFileName
	;	Copy those files to V drive
    FileCopy, % "D:\" CurrentDateTime "_" A_LoopFileName, % "V:\Backup\" CurrentDateTime "_" A_LoopFileName
}

;-----------------------------------------------------------------------------------------------------------
; EVERYTHING BELOW STOPPED WORKING after ActiveTitle = "Macrium Reflect"

; trying to turn on screen after file transfer is completed
SetTimer IdleChk, Off
Sleep, 5000
SendMessage, 0x112, 0xF170, -1, , Program Manager
Sleep, 2000
Send, {1}
Sleep, 2000

; trying to shutdown pc with msgbox
Secs := 10
SetTimer, CountDown, 1000
MsgBox, 4, System Shutdown, Shutdown in %Secs%?, %Secs%
SetTimer, CountDown, Off
IfMsgBox, No
	WinClose,Back up.ahk ahk_exe AutoHotkey.exe
IfMsgBox Timeout
	Shutdown, 1
IfMsgBox Yes
	Shutdown, 1
CountDown:
Secs -= 1
ControlSetText,Static1,Allow Auto Shutdown in %Secs%?,System Shutdown ahk_class #32770
return
}



; 3. Checks every 3 sec, if idle for more than 3 sec, turn off monitor
SetTimer IdleChk,3000

IdleChk:
 if (A_TimeIdlePhysical > 3000) 
    SendMessage 0x112, 0xF170, 2,,Program Manager
 RETURN

Top