找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 28985|回复: 12

[注册表类] [初步解决]win7系统,如何实现在任务栏右键菜单工具栏中全自动化新建Quick Launch项?

[复制链接]
发表于 2016-7-30 08:26:19 | 显示全部楼层 |阅读模式
[初步解决]win7系统,如何实现在任务栏右键菜单工具栏中全自动化新建Quick Launch项?

请直接看13楼的ahk代码。初步搞定。
求帮忙测试下。谢谢。。。


添加Win7快速启动栏
http://blog.sina.com.cn/s/blog_5d2ced280100j99o.html


上面一系列的鼠标点击操作过程,有没有全自动化/傻瓜化/1次性的实现方法?
具体操作过程:
1、鼠标右键单击任务栏空白处-工具栏-新建工具栏,
注意:在任务栏下方的中间空白处模拟鼠标单击右键就行。
(别在任务栏右下角托盘的时间/年代日期上单击右键)
2、在弹出的窗口中输入:
%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
然后单击:选择文件夹。
3、右键单击任务栏空白处-解锁任务栏。
4、
4.1、在显示Quick Launch 的位置单击右键,选择查看—大图标。
4.2、在显示Quick Launch 的位置单击右键,把显示文本的勾去掉。
4.3、在显示Quick Launch 的位置单击右键,把显示标题的勾去掉。
4.1 4.2 4.3最好按照顺序依次执行。谢谢









遇到的问题主要是:
win7系统下正常使用,手动设置1次,以后使用,
遇到过几次都会莫名其妙消失,然后又要重新手动点击多次/才能设置完毕。

别人的win7系统也遇到过几次这问题。
不知道啥原因引起的。
 楼主| 发表于 2016-7-30 09:10:08 | 显示全部楼层
本帖最后由 ygqiang 于 2016-7-30 13:46 编辑

添加Win7快速启动栏
http://blog.sina.com.cn/s/blog_5d2ced280100j99o.html

上面的操作过程,有没有傻瓜化的方法?

bat或者vbs或者注册表等等,鼠标双击运行1次,就全程设置完毕。
别用鼠标一直点击好多次才能设置好。
 楼主| 发表于 2016-7-30 11:03:10 | 显示全部楼层
本帖最后由 ygqiang 于 2016-8-8 02:42 编辑

1楼的问题。

百度搜索。找到很多方法。不知道是否好用。。。。没有头绪。
发表于 2016-7-30 18:14:36 | 显示全部楼层
这种要求来来去去就那么几种方法
1、注册表法
2、模拟操作法
3、系统接口、API法
发表于 2016-8-2 17:25:00 | 显示全部楼层
本帖最后由 pcl_test 于 2016-8-11 15:47 编辑

ahk
  1. HKL:=DllCall("LoadKeyboardLayout", Str, 0x08040804, UInt, 1)
  2. ControlGetFocus, ctl, A
  3. SendMessage, 0x50, 0, HKL, %ctl%, A
  4. ;假设任务栏在屏幕底部
  5. SysGet, VWidth, 78
  6. SysGet, VHeight, 79
  7. VWidth := Round(VWidth/2)
  8. VHeight := VHeight-10
  9. BlockInput on
  10. ControlClick,X%VWidth% Y%VHeight%, ahk_class Shell_TrayWnd,, R
  11. Sleep, 300
  12. Send, {t}
  13. Sleep, 300
  14. Send, {n}
  15. Sleep, 500
  16. ControlClick, Edit1, 新工具栏 - 选择文件夹,, L
  17. Sleep, 300
  18. Send, %APPDATA%\Microsoft\Internet Explorer\Quick Launch
  19. Sleep, 500
  20. ControlClick, Button1, 新工具栏 - 选择文件夹,, L
  21. Sleep, 500
  22. IfWinExist, 新工具栏 - 选择文件夹
  23. {
  24.     WinActivate
  25.     ControlClick, Button1, 新工具栏 - 选择文件夹,, L
  26.     return
  27. }
复制代码
 楼主| 发表于 2016-8-8 01:44:50 | 显示全部楼层
本帖最后由 ygqiang 于 2016-8-15 08:36 编辑

回复 5# pcl_test

多谢。。
你的ahk代码,第一次的版本,基本好用。
第一次的版本,发现有2个问题:
1、很多时候在输入地址完了以后,会停留不动了,并不会点击“选择文件夹”
2、模拟鼠标点击右键的时候,能否别在任务栏右下角托盘的时间/年代日期上点击?
在任务栏下方的中间空白处模拟鼠标点击右键就行。

建立完快捷启动项以后,最好还可以加上下面的功能:
1、在显示Quick Launch 的位置右键,选择查看—大图标。
2、在显示Quick Launch 的位置右键,把显示文本的勾去掉。
3、在显示Quick Launch 的位置右键,把显示标题的勾去掉。
1 2 3最好按照顺序依次执行。谢谢



5楼,这个最新的修改版本,运行没效果。并不能建立快捷启动项。
 楼主| 发表于 2016-8-11 11:47:14 | 显示全部楼层
回复 5# pcl_test


帮忙解决下吧,    多谢了。
 楼主| 发表于 2016-8-12 13:38:46 | 显示全部楼层
顶下。。。
 楼主| 发表于 2016-8-14 17:34:29 | 显示全部楼层
回复 5# pcl_test


    1楼的具体操作过程。能否实现全自动化/傻瓜化/一次性实现?谢谢
 楼主| 发表于 2016-8-15 08:17:17 | 显示全部楼层
本帖最后由 ygqiang 于 2016-8-15 08:28 编辑

回复 5# pcl_test


    最新的ahk代码测试了。
右键点击任务栏,就一直停在工具栏那里。
并不能弹出工具栏里面的选项。进行下一步操作。


Send, {t}
这里应该send发送一个“右箭头”命令。
Send ^#{right}  
Send, {n}

ok这个问题解决了。
 楼主| 发表于 2016-8-15 08:34:13 | 显示全部楼层
本帖最后由 ygqiang 于 2016-8-15 08:37 编辑

3、右键单击任务栏空白处-解锁任务栏。
4、
4.1、在显示Quick Launch 的位置单击右键,选择查看—大图标。
4.2、在显示Quick Launch 的位置单击右键,把显示文本的勾去掉。
4.3、在显示Quick Launch 的位置单击右键,把显示标题的勾去掉。
4.1 4.2 4.3最好按照顺序依次执行。谢谢
  1. BlockInput on
  2. ControlClick,X%VWidth% Y%VHeight%, ahk_class Shell_TrayWnd,, R
  3. Sleep, 300
  4. Send, {L}
复制代码
上面是3的代码
下面4的代码,如何进行?谢谢
 楼主| 发表于 2016-8-19 12:52:03 | 显示全部楼层
楼上更新了。。。
 楼主| 发表于 2016-8-20 19:13:15 | 显示全部楼层
本帖最后由 ygqiang 于 2016-8-20 21:39 编辑

代码重新更新了下。


  1. if had_added()
  2.         ExitApp

  3. ql_add()
  4. Sleep,200
  5. if (is_locked())
  6. {
  7.         lock_unlock()
  8. }
  9. Sleep,200
  10. clear()
  11. Sleep,200
  12. control_move()
  13. control_set()
  14. Sleep,200
  15. lock_unlock()
  16. blockinput,off


  17. ;=====================================================

  18. ql_add()
  19. {

  20.         winactivate,ahk_class Shell_TrayWnd
  21.         WinGetPos, x, y, w, h, ahk_class Shell_TrayWnd
  22.         ControlClick, % "x" 0 " y" h, ahk_class Shell_TrayWnd,, R
  23. blockinput,on
  24.         while(!menu1_hwnd := waitmenu(click_x, click_y))
  25.                 Sleep, 200
  26.         ControlSend, ahk_parent, t, ahk_id %menu1_hwnd%
  27.         ControlSend, ahk_parent, {Right}, ahk_id %menu1_hwnd%
  28.         WinGetPos, m1x, m1y, m1w, m1h, ahk_id %menu1_hwnd%
  29.         while(!menu2_hwnd := waitmenu(m1x+m1w, m1y, menu1_hwnd))
  30.                 Sleep, 200
  31.         ControlSend, ahk_parent,n, ahk_id %menu2_hwnd%
  32.         WinWait, 新工具栏 - 选择文件夹
  33.         ControlClick, Edit1, 新工具栏 - 选择文件夹,, L
  34.         ControlSetText, Edit1, %APPDATA%\Microsoft\Internet Explorer\Quick Launch, 新工具栏 - 选择文件夹
  35.         ControlSend, Edit1, {Enter}, 新工具栏 - 选择文件夹
  36.         ControlClick, Button1, 新工具栏 - 选择文件夹
  37.         ControlGetPos,xs,ys,,,Button1,新工具栏 - 选择文件夹

  38.         Loop
  39.         {

  40.                 IfWinExist, 新工具栏 - 选择文件夹
  41.                 {
  42.                         WinActivate,新工具栏 - 选择文件夹
  43.                         MouseMove,xs+5,ys+5,0
  44.                         Send {LButton}
  45.                 }
  46.                 else
  47.                 {
  48.                         break
  49.                 }
  50.                 Sleep, 200
  51.         }
  52. }



  53. is_locked()
  54. {
  55.         RegRead, Status, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, TaskbarSizeMove
  56.         return !Status
  57. }

  58. lock_unlock()
  59. {
  60.         WinGetPos, x, y, w, h, ahk_class Shell_TrayWnd
  61.         ControlClick,% "x" x " y" y+h, ahk_class Shell_TrayWnd,, R
  62.         while(!Menu_hwnd := waitmenu(Click_x, Click_y))
  63.         Sleep, 200
  64.         ControlSend, ahk_parent, l, ahk_id %Menu_hwnd%
  65. }
  66. clear()
  67. {
  68.         WinGet, ctr_list, ControlList, ahk_class Shell_TrayWnd
  69.         Loop, Parse, ctr_list, `n, `r
  70.         {
  71.                 if InStr(A_LoopField,"ToolbarWindow32")
  72.                 {
  73.                         ControlGetText, txt, % A_LoopField, ahk_class Shell_TrayWnd
  74.                         if (txt="Quick Launch")
  75.                         {
  76.                                 ql_ctr := A_LoopField
  77.                                 break
  78.                         }
  79.                 }
  80.         }
  81.         if ql_ctr
  82.         {
  83.                 ControlGet, ql_ctr_hwnd, Hwnd, , % ql_ctr, ahk_class Shell_TrayWnd
  84.                 WinGetPos, x, y, w, h, ahk_id %ql_ctr_hwnd%
  85.                 ControlClick, % "x" 0 " y" h, ahk_id %ql_ctr_hwnd%,, R
  86.                 while(!Menu1_hwnd := waitmenu(x, y+h))
  87.                 Sleep, 200
  88.                 ControlSend, ahk_parent, v, ahk_id %Menu1_hwnd%
  89.                 ControlSend, ahk_parent, {Right}, ahk_id %Menu1_hwnd%
  90.                 WinGetPos, m1x, m1y, m1w, m1h, ahk_id %Menu1_hwnd%
  91.                 while(!Menu2_hwnd := waitmenu(m1x+m1w, m1y, Menu1_hwnd))
  92.                 Sleep, 200
  93.                 ControlSend, ahk_parent, g, ahk_id %Menu2_hwnd%
  94.                 WinWaitClose, ahk_id %Menu2_hwnd%

  95.                 WinGetPos, x, y, w, h, ahk_id %ql_ctr_hwnd%
  96.                 ControlClick, % "x" 0 " y" h, ahk_id %ql_ctr_hwnd%,, R
  97.                 while(!Menu3_hwnd := waitmenu(x, y+h))
  98.                 Sleep, 200
  99.                 ControlSend, ahk_parent, x, ahk_id %Menu3_hwnd%
  100.                 WinWaitClose, ahk_id %Menu3_hwnd%

  101.                 WinGetPos, x, y, w, h, ahk_id %ql_ctr_hwnd%
  102.                 ControlClick, % "x" 0 " y" h, ahk_id %ql_ctr_hwnd%,, R
  103.                 while(!Menu4_hwnd := waitmenu(x, y+h))
  104.                 Sleep, 200
  105.                 ControlSend, ahk_parent, w, ahk_id %Menu4_hwnd%
  106.                 WinWaitClose, ahk_id %Menu4_hwnd%
  107.         }
  108. }

  109. control_move()
  110. {
  111.         Loop,5
  112.         {
  113.                 ControlGetPos,x2,y2,,,MSTaskListWClass1,ahk_class Shell_TrayWnd
  114.                 ControlGetPos,x,y,,,ToolbarWindow323,ahk_class Shell_TrayWnd
  115.                 if (x>x2)
  116. {
  117.                 WinActivate,ahk_class Shell_TrayWnd
  118.                 MouseMove,x-5,y+5,0
  119.                 Send {LButton down}
  120.                 Sleep,350
  121.                 MouseMove,0,y+5,8
  122.                 Send {LButton up}
  123. }
  124. else
  125. {
  126. break
  127. }
  128.         }
  129. }

  130. control_set()
  131. {
  132.         blockinput,on
  133.         WinActivate,ahk_class Shell_TrayWnd
  134.         ControlGetPos,x,y,w,h,ToolbarWindow323,ahk_class Shell_TrayWnd
  135.         ControlGetPos,x2,y2,,,MSTaskListWClass1,ahk_class Shell_TrayWnd
  136.         MouseMove,x+w+(x2-x-w)*2/3,h/2,0
  137.         Send {LButton down}
  138.         Sleep,200
  139.         ControlGetPos,,,w0,h,ToolbarWindow323,ahk_class Shell_TrayWnd
  140. wc:=w0/2
  141. mousemove,-wc,0,5,r
  142. con:=0
  143. loop
  144. {
  145.         if (wc<1)
  146.         {
  147.                 break
  148.         }
  149.         wc:=wc/2
  150.         ControlGetPos,,,w,h,ToolbarWindow323,ahk_class Shell_TrayWnd
  151.         if ((w0-wc*2>w)and(con=0))
  152. {
  153.         con:=1

  154. }
  155. else if ((w0-wc*2=w)and(con=0))
  156. {
  157.         con:=0
  158. }
  159. else if ((w0+wc*2<w)and(con=1))
  160. {
  161.         con:=0

  162. }
  163. else if ((w0-wc*2=w)and(con=1))
  164. {
  165. con:=1
  166. }

  167. if (con=0)
  168. {
  169. w0:=w
  170. mousemove,-wc,0,5,r
  171. }
  172. else
  173. {
  174.                 w0:=w
  175.                 mousemove,wc,0,5,r
  176. }


  177. }
  178.         Send {LButton up}
  179. blockinput,off
  180. }

  181. had_added(){
  182.         WinGet, ctr_list, ControlList, ahk_class Shell_TrayWnd
  183.         Loop, Parse, ctr_list, `n, `r
  184.         {
  185.                 if InStr(A_LoopField,"ToolbarWindow32")
  186.                 {
  187.                         ControlGetText, txt, % A_LoopField, ahk_class Shell_TrayWnd
  188.                         if (txt="Quick Launch")
  189.                         {
  190.                                 ql_ctr := A_LoopField
  191.                                 break
  192.                         }
  193.                 }
  194.         }
  195.         if ql_ctr
  196.                 return 1
  197. }


  198. waitmenu(click_x, click_y, ex_hwnd:="")
  199. {
  200.         WinGet, wins, List
  201.         a := ""
  202.         Loop % wins
  203.         {
  204.                 win := wins%A_index%
  205.                 WinGetPos, x, y, w, h, ahk_id %win%
  206.                 WinGetTitle, title, ahk_id %win%
  207.                 if (!title && (Abs(Click_y-y)<8 || Abs(Click_y-(y+h))<8) && w<300 && w>80 && h>20 && (ex_hwnd ? win<>ex_hwnd : 1))
  208. {
  209.                         return win
  210. }
  211.         }
  212. }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-18 15:37 , Processed in 0.019505 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表