Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

invoking an icon by its name


  • Please log in to reply
3 replies to this topic
bohlinger
  • Members
  • 2 posts
  • Last active: Mar 09 2004 07:08 AM
  • Joined: 08 Mar 2004
Hello,

I want to click on the desktop icon (within the taskbar) in order to minimize or restore the all bunch of windows lying on the desktop.
I'm not satisfied by my programming style (if any).

^c:
MouseGetPos, xpos, ypos ;; save mouse position
MouseMove, 100, 600 ;; raises the taskbar (mine is hidden)
sleep, 150 ;; waiting a while does'nt hurt.
MouseClick, left, 100, 585 ;; the place where desktop icon resides
sleep, 150 ;; waiting is a good practice
MouseMove, %xpos%, %ypos% ;; restore mouse position
return

This ugly thing works back and forth as expected.
How this script should be coded in order to invoke the desktop icon by its name and not by its position ?

Thank you for your help.
Claude Bohlinger

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
What you're doing is probably the only way to do it unless you want to resort to using PixelGetColor or PixelSearch to figure out what color the icon is at various places along the length of the task bar.

However, AutoHotkey has a feature called "window groups" which may be useful to you. I make heavy use of this myself. Here's an example:

; This goes in the auto-execute section at the top of the script:
SetTitleMatchMode, 2 ; Needed for the below to work
GroupAdd, editors, - Notepad
GroupAdd, editors, - metapad
return

Numpad1::GroupActivate, editors

What the above example does is allow you to visit every Notepad or Metapad window, one at a time. A new editor window is activated each time you press the Numpad1 key until you've gone through them all, at which point it starts over at the beginning.

I find this very useful for grouping together windows that are related to each other by their type or by their common relationship to a particular task you may be working on.

If it seems interesting, there is more info here:
http://www.autohotke...ds/GroupAdd.htm

CyberSlug
  • Members
  • 3 posts
  • Last active: Feb 21 2005 05:16 AM
  • Joined: 08 Mar 2004
Can't you simply use the built-in WinMinimizeAll and WinMinimizeAllUndo functions?

Alternatively: Send, #d

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
That solution is far simpler and may well be what Claude wants. I thought he was after a more specific effect.