Tuncay
Anmeldedatum: 28.10.2006 Beiträge: 127 Wohnort: Berlin
|
Verfasst am: Di März 20, 2007 10:15 pm Titel: Sysget als Funktion |
|
|
Mir gefällt der Sysget command nicht und deshalb hab ich mal diese als Funktion umgesetzt.
| Code: | ; Fri, 16 February 2007 07:30:32 GMT
msgbox % SysGet("monitor")
; sb = Sub-command
SysGet(sb, Param3="")
{
StringCaseSenseBackup=%A_StringCaseSense%
StringCaseSense, Off
If sb Is Alpha
{
If sb Not In MonitorCount,MonitorPrimary,Monitor,MonitorWorkArea,MonitorName
{
StringReplace, sb, sb,SM_
If sb=Monitors
sb=80
Else If sb=MouseButtons
sb=43
Else If sb=XFullScreen
sb=16
Else If sb=YFullScreen
sb=17
Else If sb=XMaximized
sb=61
Else If sb=YMaximized
sb=62
Else If sb=XMaxTrack
sb=59
Else If sb=YMaxTrack
sb=60
Else If sb=XMin
sb=28
Else If sb=YMin
sb=29
Else If sb=XMinimized
sb=57
Else If sb=YMinimized
sb=58
Else If sb=XMinTrack
sb=34
Else If sb=YMinTrack
sb=35
Else If sb=XScreen
sb=0
Else If sb=YScreen
sb=1
Else If sb=XVirtualScreen
sb=78
Else If sb=YVirtualScreen
sb=79
Else If sb=MousePresent
sb=19
Else If sb=MouseWheelPresent
sb=75
Else If sb=Network
sb=63
Else If sb=RemoteControl
sb=8193
Else If sb=RemoteSession
sb=4096
Else If sb=ShowSounds
sb=70
Else If sb=ShuttingDown
sb=8192
Else If sb=SwapButton
sb=23
Else If sb=XVirtualScreen
sb=76
Else If sb=YVirtualScreen
sb=77
Else If sb=Arrange
sb=56
Else If sb=CleanBoot
sb=67
Else If sb=XBorder
sb=5
Else If sb=YBorder
sb=6
Else If sb=XCursor
sb=13
Else If sb=YCursor
sb=14
Else If (sb="XDoubleClk" OR sb="XDoubleClick")
sb=36
Else If (sb="YDoubleClk" OR sb="YDoubleClick")
sb=37
Else If sb=XDrag
sb=68
Else If sb=YDrag
sb=69
Else If sb=XEdge
sb=45
Else If sb=YEdge
sb=46
Else If sb=XFocusBorder
sb=83
Else If sb=YFocusBorder
sb=84
Else If sb=XHScroll
sb=21
Else If sb=YHScroll
sb=22
Else If sb=XHThumb
sb=10
Else If sb=XIcon
sb=11
Else If sb=YIcon
sb=12
Else If sb=XIconsPacing
sb=38
Else If sb=YIconsPacing
sb=39
Else If sb=XMenuCheck
sb=71
Else If sb=YMenuCheck
sb=72
Else If sb=XMenuSize
sb=54
Else If sb=YMenuSize
sb=55
Else If sb=XMinSpacing
sb=47
Else If sb=YMinSpacing
sb=48
Else If sb=XSize
sb=30
Else If sb=YSize
sb=31
Else If sb=XSizeFrame
sb=32
Else If sb=YSizeFrame
sb=33
Else If (sb="XSmIcon" OR sb="XSmallIcon")
sb=49
Else If (sb="YSmIcon" OR sb="YSmallIcon")
sb=50
Else If (sb="XSmSize" OR sb="XSmallSize")
sb=52
Else If (sb="YSmSize" OR sb="YSmallSize")
sb=53
Else If sb=XVScroll
sb=2
Else If sb=YVScroll
sb=20
Else If sb=YCaption
sb=4
Else If sb=YKanjiWindow
sb=18
Else If sb=YMenu
sb=15
Else If (sb="YSmCaption" OR sb="YSmallCaption")
sb=51
Else If sb=YVThumb
sb=9
Else If sb=DBCSEnabled
sb=42
Else If sb=Debug
sb=22
Else If sb=Immenabled
sb=82
Else If sb=MediaCenter
sb=87
Else If sb=MenuDropAlignment
sb=40
Else If sb=MidEastEnabled
sb=74
Else If sb=PenWindows
sb=41
Else If sb=Secure
sb=44
Else If sb=SameDisplayFormat
sb=81
Else If sb=SlowMachine
sb=73
Else If sb=TabletPC
sb=86
Else
sb=-1
}
}
If sb=-1
OutputVar=-1
Else
{
If Param3=
SysGet, OutputVar, %sb%
Else
SysGet, OutputVar, %sb%, %Param3%
If sb In Monitor,MonitorWorkArea
OutputVar=%OutputVarLeft% %OutputVarTop% %OutputVarRight% %OutputVarBottom%
}
StringCaseSense, %StringCaseSenseBackup%
Return OutputVar
}
|
- Da es sich um eine Funktion handelt, wird keine Variable dauerhaft erzeugt.
- Der sub-command kann so als Namen angesprochen werden. Das ist leichter zu merken als eine Zahl. Und außerdem kann das Prefix SM_ ebenfalls weggelassen werden.
Ich dachte ich gebs mal weiter. _________________ Manchmal ist es /falsch/ das "richtige" zu tun. |
|