Sign in to follow this  
Followers 0
BigDod

Remote Control Script

5 posts in this topic

I have decided to rewrite my Remote Control script so that it works with the latest release. If anyone wishes to see it here it is.

;===============================================================================
;
; Description:      Remote Control Utility that creates a reverse connection
;                   to allow remote control of your computer.
;
; Requirement(s):   The person wishing to take control must be running
;                   VNCViewer in listen mode.
;
; Author:           George Burr (aka BigDod)
; 
; Credits:          Valik for _RefreshSystemTray function
;
;===============================================================================
#include <GuiConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("TrayIconHide", 1)
FileInstall("logo.bmp", @TempDir & "\logo.bmp")
FileInstall("WinVNC.exe", @TempDir & "\WinVNC.exe")
FileInstall("VNCHooks.dll", @TempDir & "\VNCHooks.dll")
; GUI
GUICreate("Remote Control", 200, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
; PIC
GUICtrlCreatePic(@TempDir & "\logo.bmp", 10, 10, 180, 181, $SS_SUNKEN)
; BUTTON
$Button1 = GUICtrlCreateButton("Connect", 10, 250, 80, 30)
$Button2 = GUICtrlCreateButton("Close", 110, 250, 80, 30)
GUICtrlSetOnEvent($Button1, "ConnectButton")
GUICtrlSetOnEvent($Button2, "CloseButton")
; TEXT
GUICtrlCreateLabel("", 5, 207, 190, 25, $SS_ETCHEDFRAME)
GUICtrlCreateLabel("Tel:- ????? ?????? before Connect", 10, 210, 180, 20)
GUICtrlSetColor(-1, 0xff0000)    ; Red
GUISetState(@SW_SHOW)
; Open Windows XP SP2 Firewall
$os = @OSVersion
$ver = @OSServicePack
If $os = "WIN_XP" And $ver >= "Service Pack 2" Then
    Run("netsh firewall set allowedprogram winvnc.exe WinVNC ENABLE", "", @SW_HIDE)
EndIf
; Idle around
While 1
    Sleep(100)
WEnd
Func CLOSEClicked()
    Run(@TempDir & "\winvnc.exe -kill")
    $PID = ProcessExists("winvnc.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)
    _RefreshSystemTray()
    FileDelete(@TempDir & "\logo.bmp")
    FileDelete(@TempDir & "\winvnc.exe")
    FileDelete(@TempDir & "\vnchooks.dll")
    Exit
EndFunc   ;==>CLOSEClicked
Func ConnectButton()
    $remote_Station = InputBox("Remote Control", "Remote Control Address", "", "", -1, 120)
    Run(@TempDir & "\winvnc.exe -connect " & $remote_Station)
EndFunc   ;==>ConnectButton
Func CloseButton()
    Run(@TempDir & "\winvnc.exe -kill")
    $PID = ProcessExists("winvnc.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)
    _RefreshSystemTray()
    Exit
EndFunc   ;==>CloseButton
; ===================================================================
; Function written by Valik
;
; _RefreshSystemTray($nDealy = 1000)
;
; Removes any dead icons from the notification area.
; Parameters:
;    $nDelay - IN/OPTIONAL - The delay to wait for the notification area to expand with Windows XP's
;        "Hide Inactive Icons" feature (In milliseconds).
; Returns:
;    Sets @error on failure:
;        1 - Tray couldn't be found.
;        2 - DllCall error.
; ===================================================================
Func _RefreshSystemTray($nDelay = 1000)
    ; Save Opt settings
    Local $oldMatchMode = Opt("WinTitleMatchMode", 4)
    Local $oldChildMode = Opt("WinSearchChildren", 1)
    Local $error = 0
    Do; Pseudo loop
        Local $hWnd = WinGetHandle("classname=TrayNotifyWnd")
        If @error Then
            $error = 1
            ExitLoop
        EndIf
        Local $hControl = ControlGetHandle($hWnd, "", "Button1")
        ; We're on XP and the Hide Inactive Icons button is there, so expand it
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
            Sleep($nDelay)
        EndIf
        Local $posStart = MouseGetPos()
        Local $posWin = WinGetPos($hWnd)
        Local $y = $posWin[1]
        While $y < $posWin[3] + $posWin[1]
            Local $x = $posWin[0]
            While $x < $posWin[2] + $posWin[0]
                DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)
                If @error Then
                    $error = 2
                    ExitLoop 3; Jump out of While/While/Do
                EndIf
                $x = $x + 8
            WEnd
            $y = $y + 8
        WEnd
        DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1])
        ; We're on XP so we need to hide the inactive icons again.
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
        EndIf
    Until 1
    ; Restore Opt settings
    Opt("WinTitleMatchMode", $oldMatchMode)
    Opt("WinSearchChildren", $oldChildMode)
    SetError($error)
EndFunc   ;==>_RefreshSystemTray

I have also attached the external files that are required.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites



I want to control the server - by just dropping a file to it using FTP connection?? Can I do it ?? will your script do it?

-Sanjiv

I have decided to rewrite my Remote Control script so that it works with the latest release. If anyone wishes to see it here it is.

;===============================================================================
;
; Description:      Remote Control Utility that creates a reverse connection
;                   to allow remote control of your computer.
;
; Requirement(s):   The person wishing to take control must be running
;                   VNCViewer in listen mode.
;
; Author:           George Burr (aka BigDod)
; 
; Credits:          Valik for _RefreshSystemTray function
;
;===============================================================================
#include <GuiConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("TrayIconHide", 1)
FileInstall("logo.bmp", @TempDir & "\logo.bmp")
FileInstall("WinVNC.exe", @TempDir & "\WinVNC.exe")
FileInstall("VNCHooks.dll", @TempDir & "\VNCHooks.dll")
; GUI
GUICreate("Remote Control", 200, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
; PIC
GUICtrlCreatePic(@TempDir & "\logo.bmp", 10, 10, 180, 181, $SS_SUNKEN)
; BUTTON
$Button1 = GUICtrlCreateButton("Connect", 10, 250, 80, 30)
$Button2 = GUICtrlCreateButton("Close", 110, 250, 80, 30)
GUICtrlSetOnEvent($Button1, "ConnectButton")
GUICtrlSetOnEvent($Button2, "CloseButton")
; TEXT
GUICtrlCreateLabel("", 5, 207, 190, 25, $SS_ETCHEDFRAME)
GUICtrlCreateLabel("Tel:- ????? ?????? before Connect", 10, 210, 180, 20)
GUICtrlSetColor(-1, 0xff0000)    ; Red
GUISetState(@SW_SHOW)
; Open Windows XP SP2 Firewall
$os = @OSVersion
$ver = @OSServicePack
If $os = "WIN_XP" And $ver >= "Service Pack 2" Then
    Run("netsh firewall set allowedprogram winvnc.exe WinVNC ENABLE", "", @SW_HIDE)
EndIf
; Idle around
While 1
    Sleep(100)
WEnd
Func CLOSEClicked()
    Run(@TempDir & "\winvnc.exe -kill")
    $PID = ProcessExists("winvnc.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)
    _RefreshSystemTray()
    FileDelete(@TempDir & "\logo.bmp")
    FileDelete(@TempDir & "\winvnc.exe")
    FileDelete(@TempDir & "\vnchooks.dll")
    Exit
EndFunc   ;==>CLOSEClicked
Func ConnectButton()
    $remote_Station = InputBox("Remote Control", "Remote Control Address", "", "", -1, 120)
    Run(@TempDir & "\winvnc.exe -connect " & $remote_Station)
EndFunc   ;==>ConnectButton
Func CloseButton()
    Run(@TempDir & "\winvnc.exe -kill")
    $PID = ProcessExists("winvnc.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)
    _RefreshSystemTray()
    Exit
EndFunc   ;==>CloseButton
; ===================================================================
; Function written by Valik
;
; _RefreshSystemTray($nDealy = 1000)
;
; Removes any dead icons from the notification area.
; Parameters:
;    $nDelay - IN/OPTIONAL - The delay to wait for the notification area to expand with Windows XP's
;        "Hide Inactive Icons" feature (In milliseconds).
; Returns:
;    Sets @error on failure:
;        1 - Tray couldn't be found.
;        2 - DllCall error.
; ===================================================================
Func _RefreshSystemTray($nDelay = 1000)
    ; Save Opt settings
    Local $oldMatchMode = Opt("WinTitleMatchMode", 4)
    Local $oldChildMode = Opt("WinSearchChildren", 1)
    Local $error = 0
    Do; Pseudo loop
        Local $hWnd = WinGetHandle("classname=TrayNotifyWnd")
        If @error Then
            $error = 1
            ExitLoop
        EndIf
        Local $hControl = ControlGetHandle($hWnd, "", "Button1")
        ; We're on XP and the Hide Inactive Icons button is there, so expand it
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
            Sleep($nDelay)
        EndIf
        Local $posStart = MouseGetPos()
        Local $posWin = WinGetPos($hWnd)
        Local $y = $posWin[1]
        While $y < $posWin[3] + $posWin[1]
            Local $x = $posWin[0]
            While $x < $posWin[2] + $posWin[0]
                DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)
                If @error Then
                    $error = 2
                    ExitLoop 3; Jump out of While/While/Do
                EndIf
                $x = $x + 8
            WEnd
            $y = $y + 8
        WEnd
        DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1])
        ; We're on XP so we need to hide the inactive icons again.
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
        EndIf
    Until 1
    ; Restore Opt settings
    Opt("WinTitleMatchMode", $oldMatchMode)
    Opt("WinSearchChildren", $oldChildMode)
    SetError($error)
EndFunc   ;==>_RefreshSystemTray

I have also attached the external files that are required.

Share this post


Link to post
Share on other sites

Incase anyone is interested this has been modified to work with Vista

;===============================================================================
;
; Description:    Remote Control Utility that creates a reverse connection
;               to allow remote control of your computer.
;
; Requirement(s):   The person wishing to take control must be running
;               VNCViewer in listen mode.
;
; Author:         George Burr (aka BigDod)
; 
; Credits:      Valik for _RefreshSystemTray function
;
;===============================================================================
#requireadmin
#include <GuiConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("TrayIconHide", 1)
FileInstall("logo.bmp", @TempDir & "\logo.bmp")
FileInstall("WinVNC.exe", @TempDir & "\WinVNC.exe")
FileInstall("VNCHooks.dll", @TempDir & "\VNCHooks.dll")
; GUI
GUICreate("Remote Control", 200, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
; PIC
GUICtrlCreatePic(@TempDir & "\logo.bmp", 10, 10, 180, 181, $SS_SUNKEN)
; BUTTON
$Button1 = GUICtrlCreateButton("Connect", 10, 250, 80, 30)
$Button2 = GUICtrlCreateButton("Close", 110, 250, 80, 30)
GUICtrlSetOnEvent($Button1, "ConnectButton")
GUICtrlSetOnEvent($Button2, "CloseButton")
; TEXT
GUICtrlCreateLabel("", 5, 207, 190, 25, $SS_ETCHEDFRAME)
GUICtrlCreateLabel("Tel:- ***** ****** before Connect", 10, 210, 180, 20)
GUICtrlSetColor(-1, 0xff0000)    ; Red
GUISetState(@SW_SHOW)
; Open Windows XP SP2 Firewall
$os = @OSVersion
$ver = @OSServicePack
If $os = "WIN_XP" And $ver >= "Service Pack 2" Then
    Run("netsh firewall set allowedprogram winvnc.exe WinVNC ENABLE", "", @SW_HIDE)
EndIf
If $os = "WIN_VISTA" Then
    Run("netsh firewall set allowedprogram winvnc.exe WinVNC ENABLE", "", @SW_HIDE)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "REG_DWORD", "0")
EndIf
; Idle around
While 1
    Sleep(100)
WEnd
Func CLOSEClicked()
    Run(@TempDir & "\winvnc.exe -kill")
    $PID = ProcessExists("winvnc.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)
    _RefreshSystemTray()
    FileDelete(@TempDir & "\logo.bmp")
    FileDelete(@TempDir & "\winvnc.exe")
    FileDelete(@TempDir & "\vnchooks.dll")
    Exit
EndFunc   ;==>CLOSEClicked
Func ConnectButton()
    $remote_Station = InputBox("Remote Control", "Remote Control Address", "", "", -1, 120)
    Run(@TempDir & "\winvnc.exe -connect " & $remote_Station)
EndFunc   ;==>ConnectButton
Func CloseButton()
    Run(@TempDir & "\winvnc.exe -kill")
    $PID = ProcessExists("winvnc.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)
    _RefreshSystemTray()
    Exit
EndFunc   ;==>CloseButton
; ===================================================================
; Function written by Valik
;
; _RefreshSystemTray($nDealy = 1000)
;
; Removes any dead icons from the notification area.
; Parameters:
;    $nDelay - IN/OPTIONAL - The delay to wait for the notification area to expand with Windows XP's
;        "Hide Inactive Icons" feature (In milliseconds).
; Returns:
;    Sets @error on failure:
;        1 - Tray couldn't be found.
;        2 - DllCall error.
; ===================================================================
Func _RefreshSystemTray($nDelay = 1000)
    ; Save Opt settings
    Local $oldMatchMode = Opt("WinTitleMatchMode", 4)
    Local $oldChildMode = Opt("WinSearchChildren", 1)
    Local $error = 0
    Do; Pseudo loop
        Local $hWnd = WinGetHandle("classname=TrayNotifyWnd")
        If @error Then
            $error = 1
            ExitLoop
        EndIf
        Local $hControl = ControlGetHandle($hWnd, "", "Button1")
        ; We're on XP and the Hide Inactive Icons button is there, so expand it
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
            Sleep($nDelay)
        EndIf
        Local $posStart = MouseGetPos()
        Local $posWin = WinGetPos($hWnd)
        Local $y = $posWin[1]
        While $y < $posWin[3] + $posWin[1]
            Local $x = $posWin[0]
            While $x < $posWin[2] + $posWin[0]
                DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)
                If @error Then
                    $error = 2
                    ExitLoop 3; Jump out of While/While/Do
                EndIf
                $x = $x + 8
            WEnd
            $y = $y + 8
        WEnd
        DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1])
        ; We're on XP so we need to hide the inactive icons again.
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
        EndIf
    Until 1
    ; Restore Opt settings
    Opt("WinTitleMatchMode", $oldMatchMode)
    Opt("WinSearchChildren", $oldChildMode)
    SetError($error)
EndFunc   ;==>_RefreshSystemTray


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thanks for sharing it with us!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hello,

I've got a big problem since I tried to understand and test your script..

It just did nothing at all and after that my mouse started to "perma-load" something, event after rebooting my computer.

I can't do a right clic on anything and the left clic took me three time (I have to clic between two "loading icon").

Well if you could help me it will be nice :)

Edited by Oversid3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0