模仿mac系统的回车重命名,遇到了一个问题

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: 模仿mac系统的回车重命名,遇到了一个问题

Re: 模仿mac系统的回车重命名,遇到了一个问题

by AAHKUser » 30 Dec 2021, 06:59

fwejifjjwk2 wrote:
30 Dec 2021, 05:02
@AAHKUser :thumbup:

感謝分享用文本插入點坐標(Typing Cursor Position)來判斷輸入模式的方法。

ahk v2 也可以用

Code: Select all

if CaretGetPos(&x, &y)
厉害!

Re: 模仿mac系统的回车重命名,遇到了一个问题

by fwejifjjwk2 » 30 Dec 2021, 05:02

@AAHKUser :thumbup:

感謝分享用文本插入點坐標(Typing Cursor Position)來判斷輸入模式的方法。

ahk v2 也可以用

Code: Select all

if CaretGetPos(&x, &y)
因為標題的問題,把這篇的代碼補過來。

Code: Select all

#HotIf (WinActive("ahk_exe Explorer.EXE")) and (not CaretGetPos(&x, &y))
; 新資料夾
:*:n::
{
	Send "^+n"
}

; 重新命名
$enter::
{
	Send "{F2}"
}
#HotIf

Re: 模仿mac系统的回车重命名,遇到了一个问题

by AAHKUser » 26 Dec 2021, 11:19

我现在找到最佳的方式了:

Code: Select all

#IfWinActive ahk_exe Explorer.EXE
$enter::
	If (A_CaretX  > 0)
		{
		SendInput, {Enter}
		}
	else
		{
		SendInput, {F2}
		}

	return

#IfWinActive

Re: 模仿mac系统的回车重命名,遇到了一个问题

by AAHKUser » 22 Jun 2020, 22:25

@fwejifjjwk2
非常感谢!,这个脚本很好用,另外还要感谢您提供的原始网址,以后再写新脚本,知道怎么搜索了。

关于打开文件的话,可能和个人习惯有关,因为我只习惯用双击打开,正好不会用到Enter :)

Re: 模仿mac系统的回车重命名,遇到了一个问题

by fwejifjjwk2 » 22 Jun 2020, 11:20

話說如果你這樣設定之後,你要怎麼打開文件或軟體呢?

Code: Select all

; from https://autohotkey.com/board/topic/109625-can-i-toggle-the-enter-key-when-renaming-files/
SetTitleMatchMode,RegEx
#IfWinActive ahk_class CabinetWClass
Enter::
if Rtoggle = 1
{
SendInput, {Enter}
Rtoggle := 0
}
else
{
SendInput, {F2}
Rtoggle := 1
}
return
#IfWinActive
上面的方式在某些輸入法需要使用 Enter 或者用 F2 編輯的時候要多按一次 Enter

模仿mac系统的回车重命名,遇到了一个问题

by AAHKUser » 19 Jun 2020, 04:45

大家好,意图如题,mac系他里对文件和文件夹回车能开始重命名这个文件或者文件夹,再改完名字之后,再次按回车确定。

我目前的思路是需要前后两次按enter所实现的功能不同,所以只能写到出来前一半功能,后一半不知道应该用什么办法实现了

以下是我目前写的,还请各位大佬指点。

Code: Select all

#IfWinActive ahk_exe Explorer.EXE
{
	Enter::
		Send, {F2 down}{F2 up}   ;f2是重命名的快捷键
	Return
	RShift::
		Send, {Blind} {Enter}   ;目前只能曲线救国,用右shift键代替。。。
	Return
}
#IfWinActive

Top