自动热键脚本可书签到特定文件夹 [英] Autohotkey script to bookmark to a specific folder

查看:82
本文介绍了自动热键脚本可书签到特定文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Firefox,当时我正在寻找一个自动热键脚本,当我在特定文件夹中为页面添加书签并将其替换为单个键盘快捷键时,该脚本将使我跳过全部单击.

I'm using Firefox and I was looking for an autohotkey script which would enable me to skip the whole series of clicks when I bookmark a page in a specific folder and replace it with a single keyboard shortcut.

尽管我已经阅读了Autohotkey论坛上的论坛主题,但在这里我仍然不知道如何制作一个有效的脚本,该脚本可以减少将页面添加为书签的频率,而只需点击键盘快捷键和要存储的文件夹的首字母即可.该页面.使用KeyWait命令,我已经使其适用于单个文件夹,并且不知道如何使其适用于可能用作书签文件夹名称的任何字母或数字.假设我有一个名为XXXX的文件夹,在命中分配的快捷方式和字母x后,此脚本确实会将网页发送到XXXX文件夹(需要使用MouseClick命令使书签对话框"窗格中包含文件夹的窗口聚焦):

Although I've read forum threads on Autohotkey forum and here I still don't know how to make a working script that would reduce bookmarking a page to hitting a keyboard shortcut and the initial letter of the folder where I want to store that page. Using KeyWait command I've made it work for a single folder and don't know how to make it work for any letter or a number that I could possibly use as a name for a bookmark folder. Say I have a folder named XXXX, this script does send the webpage to the XXXX folder after hitting the assigned shortcut and the letter x (MouseClick command is needed to focus the window with folder in the Bookmark Dialog pane):

!+^w::
Send,^d
Sleep,400
MouseClick,Left,864,304
Sleep,400
KeyWait, x ,D    
Sleep, 400
Send,^{Enter}
return

我不知道如何使此脚本适用于任何字母或数字,而不仅适用于单个字母或数字.这个脚本的另一个大问题是它会阻塞键盘,直到我按X键为止.如果我已将该页面添加为书签,则单击转义以删除书签窗格将阻止键盘,并且只有重新运行自动热键脚本后,才能取消阻止该键盘.

I don't know how to make this script work for any letter or number, not only for a single one. Also a big problem with this script is that it blocks the keyboard until I hit X key. If I have that page bookmarked already, hitting escape to remove the bookmark pane will block the keyboard and I can unblock it only if I rerun the autohotkey script.

我也尝试过使用Input命令作为Autohotkey论坛页面建议的贡献者,但是它也不起作用,因为我不了解Input命令的工作原理.我确实使用KeyWait使它像上面的脚本那样可以处理单个字母,但这是我所能做的最好的事情.此脚本还会阻塞键盘,直到按字母为止:

I've also tried using Input command as the contributors the Autohotkey forum pages suggested, but it didn't work either, because I don't understand how the Input command works. I did make it work for a single letter as the above script with KeyWait, but that's the best I could do. This script also blocks the keyboard until the letter is hit:

!+^w::
Send,^d
MouseClick,Left,864,304
Sleep,400
Input, Character, L1
If Character = t
Send, t
Sleep,400
Send,^{Enter}
return

希望有人可以帮助我,这样可以简化Firefox中的书签过程.

Hope someone can help me with this, it would be convenient simplifying the bookmarking process in Firefox this way.

推荐答案

我有个好主意.这将打开添加书签"对话框,并导航到文件夹选择部分并展开所有文件夹. 您需要做的就是输入文件夹名称(或文件夹名称的一部分),它将自动被选择.完成后,只需按Enter键即可.

I have a nice idea. This will open the add bookmark dialog and navigate you into the folder selection part and expand all folders. All you need to do is enter the folders name (or a part of it) and it will get selected automatically. When you're done, just hit enter.

!+^w::                      ;Hotkey: Ctrl+Alt+Shift+w
    Send, ^d                ;send Ctrl+d to open the add-bookmark dialog
    Sleep, 500              ;wait for the dialog to open
    Send, {Tab}{Tab}{Enter} ;navigate into the folder selection
    Sleep, 300              ;wait to make sure we are there
    Send,{Home}             ;select the first item in the list
                            ;The following line should expand all the folders so that you can just type the folders name to search for it
    Loop, 100 {             ;Increase the number if it doesn't expand all folders
        SendInput, {Right}{Down} ;expand folders
    }
    Send, {Home}            ;navigate to the first item in the list again
    Input, L, V L1 T2       ;wait until you start typing a folder name (if you just wait 2 seconds, the bookmark won't be created)
    If (ErrorLevel =  "Timeout") {
        Send, {Tab 5}       ;press tab 5 times to navigate to the cancel button
        Send, {Enter}       ;cancel the bookmark
        Return              ;end of the hotkey
    }
    Loop {                  ;wait until you haven't typed a new letter for 0.4 seconds
        Input, L, V L1 T0.4
        If (ErrorLevel =  "Timeout")
            Break
    }
    Send, {Tab 4}           ;press tab 4 times to navigate to the enter button
    Send, {Enter}           ;save the bookmark
Return

这篇关于自动热键脚本可书签到特定文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆