TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Wed May 17, 2006 8:49 pm Post subject: Scalable Issue |
|
|
I have written a "Boss Key" type program so I can do some Eve-Online mining at work. This is in no way a cheating macro app, just allows you to hide the eve windows.
Right Now it's setup to work with two windows and only two windows. I'd like to modify the script so that it can handle any number of windows and still function the same way it does currently for the two windows.
I feel an array coming on, but i'm just not sure how to tackle this one.
here's the code
| Code: | #Persistent ; Causes the script to stay running when nothing is going on.
OnExit, ExitSub ;Tells The Program to Run the sub 'ExitSub' before closing
Menu, TRAY, Icon, C:\Program Files\CCP\EVE\eve.exe ;Use the Eve icon
SetTitleMatchMode, 3 ;Only Work with windows if they match the title exactly
;Variables
hiden = 0 ;Toggles between 0 and 1, O=No, 1=Yes
renamenum = 1 ;Counts up, When renaming the EVE windows
EVE1PID = 0 ;PID of the first EVE Window
EVE2PID = 0 ;PID of the second EVE Window
return
; This hotkey, CTRL+` will Rename the active or last selected
; EVE Window to EVE1.
; Hitting CTRL+` a second time will rename the Remainging
; window to EVE2
; Hitting CTRL+` any additional times will run Nothing.
; The user should have both the Eve Windows Open
; and be logged in on both.
^`::
{
If renamenum = 1
{
;First Execution of CTRL+`
WinSetTitle, EVE,, EVE1 ;Renames window EVE1
WinGet, EVE1PID, PID, EVE1 ;Stores it's PID in the variable
renamenum = 2 ;Sets the Counter to Two.
}
Else If renamenum = 2
{
;Second Execution of CTRL+`
WinSetTitle, EVE,, EVE2 ;Renames window EVE2
WinGet, EVE2PID, PID, EVE2 ;Stores it's PID in the variable
renamenum = 3 ;Sets the Counter to Three
}
; When the Counter is set to Three nothing happens.
return
}
`::
{
If hiden = 0
{
; This Runs when the windows are NOT hidden
WinMinimize, ahk_pid %EVE1PID% ; Minimize EVE1 window
WinMinimize, ahk_pid %EVE2PID% ; Minimize EVE2 window
WinHide, ahk_pid %EVE1PID% ; Hides EVE1 window from the Taskbar
WinHide, ahk_pid %EVE2PID% ; Hides EVE2 window from the Taskbar
Process, Priority, %EVE1PID%, Low ; Sets EVE1 to low priority while hidden
Process, Priority, %EVE2PID%, Low ; Sets EVE2 to low priority while hidden
hiden = 1 ; Toggles the variable to 1 to signify the windows are hidden
SetTimer, fivemin, 300000 ; Set the Reminder timer to every 5 Minutes
}
Else
{
; This Runs when the windows ARE hidden
Process, Priority, %EVE1PID%, Normal ; Sets EVE1 back to normal priority
Process, Priority, %EVE2PID%, Normal ; Sets EVE2 back to normal priority
WinShow, ahk_pid %EVE1PID% ; Unhides EVE1 window
WinShow, ahk_pid %EVE2PID% ; Unhides EVE2 window
hiden = 0 ; Toggles the variable to 0 to signify the windows are not hidden
SetTimer, fivemin, off ; Turns off the reminder timer
}
return
}
fivemin:
{
sysget, Mon, MonitorWorkArea ; Finds the Desktop dimensions
; MonRight is the Width of the desktop in pixels
; MonBottom is the Height of the desktop in pixels
; xVar will hold the X coordinate for the reminder window
; yVar will hold the Y coordinate for the reminder window
xVar = %MonRight% ; Sets xVar to equal MonRight
yVar = %MonBottom% ; Sets yVar to equal MonBottom
xVar -= 380 ; Subtracts 380 pixels from xVar
yVar -= 38 ; Subtracts 38 pixels from yVar
; 380 pixels are subtracted from xVar to make the reminder window
; line up with the right side of the screen
; 38 pixels are subtracted from yVar to make the reminder window
; line up right above the Taskbar on the bottom of the screen
loop 5 ; Blink the reminder window 5 times
{
;SoundPlay, *-1 ; Beeps every time the window blinks
Progress, w380 h38 x%xVar% y%yVar% zh0 zy0 b c11 ct00FFFF FM24 cw000000,,5 Minutes have Elapsed,togeve, Arial ; Creates the reminder window
sleep, 500 ; Leaves it up for 500ms
Progress, off ; Clears the reminder window
sleep, 200 ; leaves a gap of 200ms between blinks
}
return
}
ExitSub:
{
; Runs before the Script exits
Process, Priority, %EVE1PID%, Normal ; Sets EVE1 back to normal priority
Process, Priority, %EVE2PID%, Normal ; Sets EVE2 back to normal priority
WinShow, ahk_pid %EVE1PID% ; Unhides EVE1 window
WinShow, ahk_pid %EVE2PID% ; Unhides EVE2 window
WinSetTitle, ahk_pid %EVE1PID%,, EVE ; Sets the title back to EVE
WinSetTitle, ahk_pid %EVE2PID%,, EVE ; Sets the title back to EVE
ExitApp ; Exits the Script
return
} |
_________________
"Make it idiot-proof, and someone will make a better idiot." |
|