| View previous topic :: View next topic |
| Author |
Message |
planetthoughtful
Joined: 22 Feb 2006 Posts: 28
|
Posted: Sat Jul 15, 2006 4:12 am Post subject: Simple script: remap IrfanView's space bar to select random |
|
|
A simple script to remap IrfanView's space bar (which normally selects the next image in the directory) to select a random image from the directory, while allowing normal operation of the space bar in other applications.
This is simply a preference of mine from the way other image applications work (e.g., ACDSee), since IrfanView's Ctrl-M key combination to select a random image seems a little counter-intuitive.
Works both in IrfanView's windowed and Full Screen views.
| Code: |
space::
{
myvar:=false
IfWinActive ahk_class IrfanView
{
myvar:=true
} else {
IfWinActive ahk_class FullViewClass
{
myvar:=true
} else {
myvar:=false
}
}
if (myvar = true){
#space::^m
} else {
space::space
}
}
return
|
Note: I'm by no means a skilled AutoHotkey script developer. The script above might have problems I haven't yet detected, or might (in fact, probably can) be put together much more efficiently.
If anyone has any ways in which this script can be improved, please let me know.
Much warmth,
planetthoughtful
---
"lost in thought"
http://www.planetthoughtful.org |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Sat Jul 15, 2006 3:25 pm Post subject: |
|
|
Works OK. If you like it shorter, try this | Code: | #IfWinActive ahk_class IrfanView
space::^m
#IfWinActive ahk_class FullViewClass
space::^m |
|
|
| Back to top |
|
 |
planetthoughtful
Joined: 22 Feb 2006 Posts: 28
|
Posted: Sun Jul 16, 2006 12:24 am Post subject: |
|
|
Hi Laszlo,
Much better! Thanks for posting this!
Much warmth,
planetthoughtful
---
"lost in thought"
http://www.planetthoughtful.org |
|
| Back to top |
|
 |
JSLover
Joined: 20 Dec 2004 Posts: 634 Location: LooseChange911.com The WTC bldgs shouldn't have fallen that fast. The official story is a lie!
|
Posted: Sun Jul 16, 2006 7:19 am Post subject: |
|
|
Hehe...
| Code: | GroupAdd, IrfanView, ahk_class IrfanView
GroupAdd, IrfanView, ahk_class FullViewClass
#IfWinActive ahk_group IrfanView
space::^m |
...Note: I don't have IrfanView or a new enough AHK to test this...but...it should work. Chris...since #IfWinActive is a directive & GroupAdd is a command...how does #IfWinActive see the group before it's created?...I wasn't sure it would work because of this, but the online (new) help (my help file is old) says it should...btw...
| Code: | if (myvar = true){
#space::^m
} else {
space::space
} |
...I don't know how your version even works, because you shouldn't put :: hotkey definitions as if they were a command...if's shouldn't affect them (unless I'm projecting directive rules onto :: hotkey definitions...just checked the help & it don't mention not to use them like this)...so how does it even work...? _________________
Home • Click image! • Blog |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun Jul 16, 2006 11:28 am Post subject: |
|
|
| JSLover wrote: | | since #IfWinActive is a directive & GroupAdd is a command...how does #IfWinActive see the group before it's created? | At the time the script is launched, #IfWinActive merely stores the specified WinTitle text; it doesn't attempt to interpret the text. Later, when the time comes for a hotkey or hotstring to check its associated #IfWin criteria, it interprets the WinTitle and discovers that the group now exists. |
|
| Back to top |
|
 |
|