การรวมสองสคริปต์เข้าด้วยกันเป็นหนึ่งล้มเหลว


0

เมื่อมีสคริปต์แยกกันสองตัวปุ่มลัดจะทำงานตามที่คาดไว้ การรวมกันเป็นหนึ่งไฟล์ปุ่มลัด # ^ l และ # ^ h หยุดทำงาน มันเป็นความผิดพลาดหรือฉันทำอะไรผิดหรือเปล่า?

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey 
releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

LAlt::LWin
LWin::LAlt
CapsLock::LCtrl

#^l::#^Right
#^h::#^Left

คำตอบ:


0
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

LAlt::LWin
LWin::LAlt
CapsLock::LCtrl

; LAlt+CapsLock+l ; switch to next virtual desktop
#^l:: SendEvent {LWin down}{LCtrl down}{Right down}{LWin up}{LCtrl up}{Right up}
; LAlt+CapsLock+h ; switch to previous virtual desktop
#^h:: SendEvent {LWin down}{LCtrl down}{Left down}{LWin up}{LCtrl up}{Left up}

https://autohotkey.com/docs/commands/Send.htm#SendEvent

ทดสอบบน Win10


0

ลองสิ่งนี้:

LAlt::
Send, {LWin down}
Send, {LWin up}
return

LWin::
Send, {Alt down}
Send, {Alt up}
return

ขอบคุณสำหรับการตอบกลับด้วยการแก้ปัญหานี้ฟังก์ชั่นแท็บ Windows ไม่ทำงานอีกต่อไปและมันไม่สามารถแก้ไขปัญหาก่อนหน้านี้
OrigamiEye

ฉันเพิ่งแก้ไขปัญหาทั้งสองนี้และสิ่งอื่น ๆ สามารถแก้ไขได้ในทำนองเดียวกัน: คุณไม่สามารถแมปสิ่งเหล่านี้ได้เพราะไม่ใช่ตัวอักษรจริงที่สามารถแทนที่ได้ แต่เหตุการณ์ คุณต้องจำลองฟังก์ชันการทำงานของปุ่มโดยส่งกิจกรรมขึ้นและลง
harrymc
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.