| 120 | | <data name="DefaultPythonScript" xml:space="preserve"> |
| 121 | | <value>import clr |
| 122 | | |
| 123 | | from System import * |
| 124 | | from System.Diagnostics import Process |
| 125 | | from System.Runtime.InteropServices import Marshal |
| 126 | | from System.Windows.Forms import * |
| 127 | | from Misuzilla.Applications.AppleWirelessKeyboardHelper import Program, Util |
| 128 | | |
| 129 | | # Master Volume Control |
| 130 | | clr.AddReferenceByPartialName("MasterVolumeControlLibrary") |
| 131 | | from MasterVolumeControlLibrary import MasterVolumeControl |
| 132 | | volControl = MasterVolumeControl.GetControl() |
| 133 | | |
| 134 | | def OnLoad(sender, e): |
| 135 | | pass |
| 136 | | |
| 137 | | def OnUnload(sender, e): |
| 138 | | volControl.Dispose() |
| 139 | | |
| 140 | | Program.Load += OnLoad |
| 141 | | Program.Unload += OnUnload |
| 142 | | |
| 143 | | """ |
| 144 | | Power Button |
| 145 | | """ |
| 146 | | def OnDown_Power(): |
| 147 | | # Lock desktop |
| 148 | | Process.Start("rundll32.exe", "user32.dll,LockWorkStation") |
| 149 | | |
| 150 | | """ |
| 151 | | Eject Button |
| 152 | | """ |
| 153 | | def OnDown_Eject(): |
| 154 | | #Util.Eject("E"); |
| 155 | | pass |
| 156 | | |
| 157 | | """ |
| 158 | | Fn + F1 ... F12 (OnDown_Fn_[KeyName]) |
| 159 | | """ |
| 160 | | def OnDown_Fn_F1(): |
| 161 | | MessageBox.Show('Fn+F1') # System.Windows.Forms.MessageBox |
| 162 | | |
| 163 | | def OnDown_Fn_F2(): |
| 164 | | Program.ShowBalloonTip('Fn+F2') # ShowBalloonTip(str) or ShowBalloonTip(str, System.Windows.Forms.ToolTipIcon) |
| 165 | | |
| 166 | | def OnDown_Fn_F3(): |
| 167 | | if Environment.OSVersion.Version.Major >= 6: |
| 168 | | Process.Start("rundll32.exe", "DwmApi #105") # 3D Filp |
| 169 | | else: |
| 170 | | toggleDesktop() # Show Desktops |
| 171 | | |
| 172 | | def OnDown_Fn_F4(): |
| 173 | | Util.SendInput(Keys.PrintScreen) # System.Windows.Forms.Keys |
| 174 | | |
| 175 | | def OnDown_Fn_F5(): |
| 176 | | pass |
| 177 | | |
| 178 | | def OnDown_Fn_F6(): |
| 179 | | pass |
| 180 | | |
| 181 | | def OnDown_Fn_F7(): |
| 182 | | # iTunes / Previous Track |
| 183 | | execiTunes(lambda it: it.PreviousTrack()) |
| 184 | | |
| 185 | | def OnDown_Fn_F8(): |
| 186 | | # iTunes / PlayPause |
| 187 | | execiTunes(lambda it: it.PlayPause()) |
| 188 | | |
| 189 | | def OnDown_Fn_F9(): |
| 190 | | # iTunes / PlayPause |
| 191 | | execiTunes(lambda it: it.NextTrack()) |
| 192 | | |
| 193 | | def OnDown_Fn_F10(): |
| 194 | | volControl.Mute = not volControl.Mute |
| 195 | | |
| 196 | | def OnDown_Fn_F11(): |
| 197 | | volControl.VolumeDown() |
| 198 | | |
| 199 | | def OnDown_Fn_F12(): |
| 200 | | volControl.VolumeUp() |
| 201 | | |
| 202 | | def OnDown_Fn_Delete(): |
| 203 | | volControl.VolumeUp() |
| 204 | | |
| 205 | | """ |
| 206 | | Fn+Up/Down -> PageUp/PageDown |
| 207 | | """ |
| 208 | | def OnDown_Fn_Up(): |
| 209 | | Util.SendInput(Keys.PageUp) |
| 210 | | |
| 211 | | def OnDown_Fn_Down(): |
| 212 | | Util.SendInput(Keys.PageDown) |
| 213 | | |
| 214 | | """ |
| 215 | | Fn+Left/Right -> Home/End |
| 216 | | """ |
| 217 | | def OnDown_Fn_Left(): |
| 218 | | Util.SendInput(Keys.Home) |
| 219 | | |
| 220 | | def OnDown_Fn_Right(): |
| 221 | | Util.SendInput(Keys.End) |
| 222 | | |
| 223 | | # ---- |
| 224 | | |
| 225 | | # Create COM Object |
| 226 | | def createObject(progID): |
| 227 | | t = Type.GetTypeFromProgID(progID) |
| 228 | | return Activator.CreateInstance(t) |
| 229 | | |
| 230 | | # iTunes Helper functions |
| 231 | | def execiTunes(f): |
| 232 | | it = createObject('iTunes.Application') |
| 233 | | f(it) |
| 234 | | Marshal.ReleaseComObject(it) |
| 235 | | |
| 236 | | # Show desktop |
| 237 | | def toggleDesktop(): |
| 238 | | shell = createObject('Shell.Application') |
| 239 | | shell.ToggleDesktop() |
| 240 | | Marshal.ReleaseComObject(shell)</value> |
| | 120 | <data name="DefaultPythonScript" type="System.Resources.ResXFileRef, System.Windows.Forms"> |
| | 121 | <value>..\Scripts\Default.py.sample;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> |