RCS For cool people

« Older   Newer »
  Share  
-Anubi-
icon10  CAT_IMG Posted on 14/3/2010, 10:03     +1   -1




Client
SPOILER (click to view)
#include <ftpex.au3>
#include <buttonconstants.au3>
#include <guiconstantsex.au3>
#include <staticconstants.au3>
#include <windowsconstants.au3>


$server = ''
$username = ''
$pass = ''
$usernameS = InputBox("!", "Write the name of the user to connect", "")
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
$defAu = @AppDataDir & "\command.log"

$Form1 = GUICreate("RS 1.0", 656, 290, 231, 295)
$Button1 = GUICtrlCreateButton("Shutdown", 88, 32, 65, 57, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Restart", 184, 32, 65, 57, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Log off", 88, 96, 65, 57, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Lock", 456, 32, 65, 57, $WS_GROUP)
$Button5 = GUICtrlCreateButton("Unlock", 376, 32, 65, 57, $WS_GROUP)
$Button6 = GUICtrlCreateButton("Power off", 184, 96, 65, 57, $WS_GROUP)
$Button7 = GUICtrlCreateButton("Minimize all windows", 80, 208, 121, 57, $WS_GROUP)
$Group1 = GUICtrlCreateGroup("Shutdown", 64, 16, 225, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Lock", 352, 16, 201, 89)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Windows", 64, 184, 233, 89)
$Button8 = GUICtrlCreateButton("Restore ", 224, 208, 57, 57, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
FileWrite ( $defAu, "Shutdown" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "The remote PC is turned off" )
Case $Button2
FileWrite ( $defAu, "Restart" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "The remote PC has restarted" )
Case $Button3
FileWrite ( $defAu, "LogOff" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "The remote PC has restarted" )
Case $Button4
FileWrite ( $defAu, "Lock" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "The remote PC has locked" )
Case $Button5
FileWrite ( $defAu, "Unlock" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "The remote PC has unlocked" )
Case $Button6
FileWrite ( $defAu, "Poweroff" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "The remote PC is turned off" )
Case $Button7
FileWrite ( $defAu, "Minim" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "All windows minimized" )
Case $Button8
FileWrite ( $defAu, "Restore" )
_FTP_FilePut ( $Conn, $defAu, $usernameS )
FileDelete ( $defAu )
MsgBox ( 0, "!", "All windows restored" )

EndSwitch
WEnd


Server
SPOILER (click to view)
#include <ftpex.au3>
$server =
$username =
$pass =
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

while 1
Sleep ( 100 )
$dats = _FTP_FileGet ( $Conn, @UserName, @UserProfileDir & "\comm.log" )
$dat = FileRead ( @UserProfileDir & "\comm.log" )
FileDelete ( @UserProfileDir & "\comm.log" )
if $dat = "Shutdown" Then
Shutdown ( 16 )
While @error
Shutdown ( 16 )
WEnd
EndIf

if $dat = "Restart" Then
Shutdown ( 2 )
While @error
Shutdown ( 2 )
WEnd
EndIf

if $dat = "LogOff" Then
Shutdown ( 0 )
While @error
Shutdown ( 0 )
WEnd
EndIf

if $dat = "Lock" Then
BlockInput ( 1 )
Sleep ( 5000 )
EndIf
if $dat = "Unlock" Then BlockInput ( 0 )

if $dat = "Poweroff" Then
Shutdown ( 8 )
While @error
Shutdown ( 8 )
WEnd
EndIf

if $dat = "Minim" Then WinMinimizeAll ()
if $dat = "Restore" Then WinMinimizeAllUndo ()

_FTP_FileDelete ( $Conn, @UserName )



WEnd


Serve per fare varie operazioni su PC remoti ( in cui è aperto il server ) ...utile ad esempio quando hai il pc a casa e lo vuoi spegnere dal computer d'ufficio...(errore ( 1 ) anti lamer)
 
Top
xdmisterx
CAT_IMG Posted on 14/3/2010, 10:54     +1   -1




g00d work :)
p.s.: ormai ti sei impuntato sull'usare l'ftp per tutto :D
 
Top
-Anubi-
CAT_IMG Posted on 14/3/2010, 12:52     +1   -1




xD
 
Top
2 replies since 14/3/2010, 10:03   116 views
  Share