Hallo Community,
Long Long ist's her, dennoch teile ich gerne ein Skript mit euch:
WindowButler (den Namen hat es erst seit kurzem) soll die alltägliche Arbeit vor allem von Notebooks erleichtern (ich hasse Touchpads, etc.)
Alle Hotkeys basieren auf dem Prinzip Steuerung+Windows+Taste, z.B. Strg+Win+E zum Auswerfen des CD-Laufwerks.
Im Anhang ein Archiv mit Executable, Bildern und Hilfedatei (auf englisch).
Source gibt's auch, und zusätzlich auch hier:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Icon small.ico
#AutoIt3Wrapper_outfile=WindowButler.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Global $WS_POPUP=0x80000000,$WS_EX_TOPMOST=0x00000008
Opt("TrayAutoPause", 0)
Opt("WinTitleMatchMode", 2)
$dll = DllOpen("user32.dll")
$drives = DriveGetDrive("cdrom")
$speakpossible = False
$itunespossible = False
$oVoice = ObjCreate("SAPI.SpVoice")
If Not @error Then $speakpossible = True
$iTunesApp = ObjCreate("iTunes.Application")
If Not @error Then $itunespossible = True
$iniSections = IniReadSection("config.ini", "hotkeys")
If Not @error Then
For $i = 1 To $iniSections[0][0]
HotKeySet("#^" & $iniSections[$i][1], "_" & $iniSections[$i][0])
Next
Else
HotKeySet("#^m", "_minimize")
HotKeySet("#^o", "_maximize")
HotKeySet("#^+o", "_restore")
HotKeySet("#^x", "_kill")
HotKeySet("#^t", "_setTop")
HotKeySet("#^+t", "_unsetTop")
HotKeySet("#^z", "_setTrans")
HotKeySet("#^+z", "_unsetTrans")
HotKeySet("#^e", "_eject")
HotKeySet("#^+e", "_uneject")
HotKeySet("#^l", "_lock")
HotKeySet("#^i", "_flash")
HotKeySet("#^h", "_hide")
HotKeySet("#^s", "_unhide")
HotKeySet("#^r", "_renameintelligent")
HotKeySet("#^q", "_speak")
HotKeySet("#^{RIGHT}", "_iNext")
HotKeySet("#^{LEFT}", "_iPrev")
HotKeySet("#^{SPACE}", "_iPlayPause")
HotKeySet("#^{ENTER}", "_click")
For $i = 1 To 12
HotKeySet("#^{F" & $i & "}", "_play" & $i)
Next
HotKeySet("#^{ESC}", "_stop")
$inicontent = "#config.ini for WindowButler 1.0.x" & @CRLF
$inicontent &= "[hotkeys]" & @CRLF
$inicontent &= "#the following list contains the hotkey-characters for the functions." & @CRLF
$inicontent &= "# + means shift. deleting a line (or renaming the key) will make the function stop working)" & @CRLF
$inicontent &= "minimize=m" & @CRLF
$inicontent &= "maximize=o" & @CRLF
$inicontent &= "restore=+o" & @CRLF
$inicontent &= "kill=x" & @CRLF
$inicontent &= "setTop=t" & @CRLF
$inicontent &= "unsetTop=+t" & @CRLF
$inicontent &= "setTrans=z" & @CRLF
$inicontent &= "unsetTrans=+z" & @CRLF
$inicontent &= "eject=e" & @CRLF
$inicontent &= "uneject=+e" & @CRLF
$inicontent &= "lock=l" & @CRLF
$inicontent &= "flash=i" & @CRLF
$inicontent &= "hide=h" & @CRLF
$inicontent &= "unhide=s" & @CRLF
$inicontent &= "renameintelligent=r" & @CRLF
$inicontent &= "speak=q" & @CRLF
$inicontent &= "click={ENTER}" & @CRLF
$inicontent &= "iNext={RIGHT}" & @CRLF
$inicontent &= "iPrev={LEFT}" & @CRLF
$inicontent &= "iPlayPause={SPACE}" & @CRLF
$inicontent &= "click={ENTER}" & @CRLF
$inicontent &= "stop={stop}" & @CRLF
$inicontent &= "play1={F1}" & @CRLF
$inicontent &= "play2={F2}" & @CRLF
$inicontent &= "play3={F3}" & @CRLF
$inicontent &= "play4={F4}" & @CRLF
$inicontent &= "play5={F5}" & @CRLF
$inicontent &= "play6={F6}" & @CRLF
$inicontent &= "play7={F7}" & @CRLF
$inicontent &= "play8={F8}" & @CRLF
$inicontent &= "play9={F9}" & @CRLF
$inicontent &= "play10={F10}" & @CRLF
$inicontent &= "play11={F11}" & @CRLF
$inicontent &= "play12={F12}" & @CRLF
$inicontent &= @CRLF
$inicontent &= "#if you fuck things up, just delete this file. It will be automatically recreated when starting WindowsButler the next time"
FileWrite("config.ini", $inicontent)
If MsgBox(36,"WindowButler","Do you want to create a shortcut to WindowButler in the Startup directory?") = 6 Then FileCreateShortcut(@ScriptFullPath,@StartupDir & "\WindowButler.lnk",@ScriptDir)
EndIf
Func _renameintelligent()
$old = ClipGet()
Send("{F2}")
Send("^c")
$name = ClipGet()
While StringInStr($name, ".", Default, -1) > 4
$name = StringReplace($name, ".", " ", 1)
WEnd
ClipPut($name)
Send("^v")
Send("{ENTER}")
ClipPut($old)
Send("{CTRLUP}")
EndFunc ;==>_renameintelligent
Func _minimize()
WinSetState("", "", @SW_MINIMIZE)
EndFunc ;==>_minimize
Func _maximize()
WinSetState("", "", @SW_MAXIMIZE)
EndFunc ;==>_maximize
Func _restore()
WinSetState("", "", @SW_RESTORE)
EndFunc ;==>_restore
Func _kill()
WinKill("")
EndFunc ;==>_kill
Func _setTop()
WinSetOnTop("", "", 1)
EndFunc ;==>_setTop
Func _unsetTop()
WinSetOnTop("", "", 0)
EndFunc ;==>_unsetTop
Func _setTrans()
WinSetTrans("", "", 200)
EndFunc ;==>_setTrans
Func _unsetTrans()
WinSetTrans("", "", 255)
EndFunc ;==>_unsetTrans
Func _eject()
For $i = 1 To $drives[0]
CDTray($drives[$i], "open")
Next
EndFunc ;==>_eject
Func _uneject()
For $i = 1 To $drives[0]
CDTray($drives[$i], "close")
Next
EndFunc ;==>_uneject
Func _flash()
$hFlash = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0xffffff)
GUISetState()
Do
Sleep(200)
Until _IsPressed("1B", $dll)
GUIDelete($hFlash)
EndFunc ;==>_flash
Func _hide()
WinSetState("[ACTIVE]", "", @SW_HIDE)
EndFunc ;==>_hide
Func _unhide()
WinSetState(InputBox("WindowButler", "Unhide: Enter title!"), "", @SW_SHOW)
EndFunc ;==>_unhide
Func _lock()
GUICreate("greeen", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0xff0000)
GUISetState()
SplashImageOn("asdasd", @ScriptDir & "\locked.jpg", @DesktopWidth, @DesktopHeight, 0, 0, 3)
For $i = 255 To 0 Step -15
Sleep(50)
WinSetTrans("greeen", "", $i)
Next
GUISetState(@SW_HIDE)
WinActivate("asdasd")
WinSetOnTop("asdasd", "", 1)
Do
Sleep(200)
Until _IsPressed("25", $dll) And _IsPressed("27", $dll)
GUISetBkColor(0x00ff00)
GUISetState()
WinSetOnTop("asdasd", "", 0)
For $i = 0 To 255 Step 15
Sleep(50)
WinSetTrans("greeen", "", $i)
Next
SplashOff()
For $i = 255 To 0 Step -15
Sleep(50)
WinSetTrans("greeen", "", $i)
Next
GUIDelete()
EndFunc ;==>_lock
Func _play1()
SoundPlay(@ScriptDir & "/sounds/1.mp3")
EndFunc ;==>_play1
Func _play2()
SoundPlay(@ScriptDir & "/sounds/2.mp3")
EndFunc ;==>_play2
Func _play3()
SoundPlay(@ScriptDir & "/sounds/3.mp3")
EndFunc ;==>_play3
Func _play4()
SoundPlay(@ScriptDir & "/sounds/4.mp3")
EndFunc ;==>_play4
Func _play5()
SoundPlay(@ScriptDir & "/sounds/5.mp3")
EndFunc ;==>_play5
Func _play6()
SoundPlay(@ScriptDir & "/sounds/6.mp3")
EndFunc ;==>_play6
Func _play7()
SoundPlay(@ScriptDir & "/sounds/7.mp3")
EndFunc ;==>_play7
Func _play8()
SoundPlay(@ScriptDir & "/sounds/8.mp3")
EndFunc ;==>_play8
Func _play9()
SoundPlay(@ScriptDir & "/sounds/9.mp3")
EndFunc ;==>_play9
Func _play10()
SoundPlay(@ScriptDir & "/sounds/10.mp3")
EndFunc ;==>_play10
Func _play11()
SoundPlay(@ScriptDir & "/sounds/11.mp3")
EndFunc ;==>_play11
Func _play12()
SoundPlay(@ScriptDir & "/sounds/12.mp3")
EndFunc ;==>_play12
Func _stop()
SoundPlay("")
EndFunc ;==>_stop
Func _click()
Do
MouseClick("primary")
Until _IsPressed("1B", $dll)
EndFunc ;==>_click
Func _speak()
If $speakpossible Then $oVoice.Speak(InputBox("WindowButler", "What should I speak?"))
EndFunc ;==>_speak
Func _iNext()
If $itunespossible Then $iTunesApp.NextTrack
EndFunc
Func _iPrev()
If $itunespossible Then $iTunesApp.PreviousTrack
EndFunc
Func _iPlayPause()
If $itunespossible Then $iTunesApp.PlayPause
EndFunc
While 1
Sleep(500)
WEnd
Func _IsPressed($sHexKey, $vDLL = 'user32.dll')
; $hexKey must be the value of one of the keys.
; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is.
Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x' & $sHexKey)
If @error Then Return SetError(@error, @extended, False)
Return BitAND($a_R[0], 0x8000) <> 0
EndFunc ;==>_IsPressed
Einige Funktionen sind sinnvoller (zum Beispiel das OnTop-pinnen von Fenstern), andere verspielter (zum Beispiel die Soundbuttons).
Feedback? Mehr Funktionen gewünscht? Welche?
Edit:Neue Version (1.1): Kleiner Bugfix und jetzt mit iTunes-Steuerung: Strg+Win+Links oder Rechts bzw. Leertaste für Play/Pause (ist alles noch nicht in der Helpfile)
Zum Update die config.ini löschen.
Ich weiß, es ist nicht mein komplexestes oder bestes Skript, aber ich benutze es ausnahmsweise mal wirklich und oft. Am häufigsten wohl das Flashlight^^