'Quelle fr die Lib: http://www.freebasic.net/forum/viewtopic.php?t=7382 #include "AutoIT3.bi" '+------------------------------------------------------------------------------------------+ '| Header: Evalute the parameters | '| DisplayCheck:|Il1 are Alt-0124, big i, small L, One ᎙=ܱ | Const Author="FBShutDown.Bas v1.017 2007 by ytwinky, MD"' | '| (Shortcut: none) | '| tested with FB0.16b, FB0.17f, FBCVS | '| Purpose: Shutdown system on several ways, including log off.. | '+------------------------------------------------------------------------------------------+ Const Esc=!"\27", forceVal="4", red=4, light=8, normal=7 Var Par1=lcase(Command(1)), Par2=lcase(Command(2)), Cmd="" Var Force=0-4*(Par2="force" Or Par2=forceVal), Okay=0, Zeile=0, Spalte=0, i=0 Declare Function MenuChar(s As String, First As Integer=1, nFG As Integer=light+red) As String Dim Cmds(1 To 5, 1) As String={{"LogOff", "0"}, {"ShutDown", "1"}, _ {"Restart", "2"}, {"Standby", "32"}, {"Hibernate", "64"}} AU3_Init() For i=LBound(Cmds) To UBound(Cmds) Okay=Par1=lcase(Cmds(i, 0)) Or Par1=Cmds(i, 1) If Okay Then Cmd=Cmds(i, 1) Exit For End If Next If Not Okay Then Cls Print Author Print "Syntax: FBShutDown [Command|Alias] [Force|" &forceVal &"]" Print "Command Alias" For i=LBound(Cmds) To UBound(Cmds) Print MenuChar(Cmds(i, 0) &Space(11-Len(Cmds(i, 0))) &Cmds(i, 1), 12) Next Print "Only 0, 1, 2 support force mode:" Print MenuChar("Simply add force or " &forceVal &" as 2nd parameter..", 21) Print "(btw: in this menu you should at first press " &forceVal &" if you want to force..)" Print "Press "; Color light+red Print "Esc"; Color normal Print " to end.."; Do Cmd=UCase(Input(1)) If Cmd=forceVal Then 'toggle Force Zeile=CsrLin Spalte=Pos() Force Xor=Val(Cmd) 'toggle it.. Locate 10, 21 Print MenuChar(Cmd, 1, IIF(Force, red, light+red)) Locate Zeile, Spalte End If If Cmd=Esc Then End Okay=Instr("01236", Cmd) 'only allowed chars received, so okay is okay ;-)) Loop Until Okay 'only allowed chars finish loop If Cmd="3" Then Cmd=Cmds(4, 1) If Cmd="6" Then Cmd=Cmds(5, 1) End If 'Okay=0 If Okay Then AU3_Shutdown(Val(Cmd)+Force) 'do it, baby.. yeahhh :D Else Print :Print "Cmd=" &Cmd &" Force=" &Force GetKey End If End Function MenuChar(s As String, First As Integer=1, nFG As Integer=light+red) As String Dim As Integer cFG=LoWord(Color) 'remember current foreground colour If First<>1 Then Print Left(s, First-1); 'print the string before selected char, Left() !Mid() Color nFG 'change colour to new foreground colour Print Chr(s[First-1]); 'print selected char Color cFG 'change colour to previous one Return Mid(s, First+1) 'return the remaining string.. End Function 'guess what.. :D