#include-once #include ;=============================================================================== ; Name: .........: _FF_FoxBox.au3 ; Discription ...: Functions to control the FireFox-Addon Fox!Box ; Requirement(s).: FF.au3 > V0.5.3.x / MozRepl / Fox!Box ; Author(s) .....: Thorsten Willert ; Link(s) .......: https://addons.mozilla.org/de/firefox/addon/5681 ; http://wiki.github.com/bard/mozrepl ; Date ..........: Tue Apr 28 22:19:41 CEST 2009 @888 /Internet Time/ ;=============================================================================== ; #CURRENT# ==================================================================== ; _FF_FoxBox_GetIP ; _FF_FoxBox_GetStatus ; _FF_FoxBox_Reconnect ; _FF_FoxBox_ToggleStatus ; ============================================================================== ; #FUNCTION# =================================================================== ; Name ..........: _FF_FoxBox_GetIP ; Description ...: Get the external IP ; AutoIt Version : V3.3.0.0 ; Requirement(s).: FF.au3 / MozRepl / Fox!Box ; Syntax ........: ; Parameter(s): .: $Socket - TCP Socket ; Return Value ..: Success - IP ; Failure - 0.0.0.0 and sets ; @ERROR - 1 ; Author(s) .....: Thorsten Willert ; Date ..........: Wed Mar 25 17:32:18 CET 2009 @730 /Internet Time/ ; ============================================================================== Func _FF_FoxBox_GetIP() Local $sIP = _FFCmd("foxBoxExternalIpAddress") If Not @error Then Return $sIP SetError(1) Return "0.0.0.0" EndFunc ;==>_FF_FoxBox_GetIP ; #FUNCTION# =================================================================== ; Name ..........: _FF_FoxBox_GetStatus ; Description ...: Get the status of FoxBox ; AutoIt Version : V3.3.0.0 ; Requirement(s).: FF.au3 / MozRepl / Fox!Box ; Syntax ........: _FF_FoxBox_GetStatus() ; Parameter(s): .: ; Return Value ..: Success - 1 = enabled / 0 = disabled ; Failure - 0 and sets ; @ERROR - 1 ; Author(s) .....: Thorsten Willert ; Date ..........: Sun Mar 22 15:14:22 CET 2009 @634 /Internet Time/ ; ============================================================================== Func _FF_FoxBox_GetStatus() Local $bStatus = _FFCmd('foxBoxPrefs.getBoolPref("enabled")') If Not @error Then Return $bStatus SetError(1) Return 0 EndFunc ;==>_FF_FoxBox_GetStatus ; #FUNCTION# =================================================================== ; Name ..........: _FF_FoxBox_Reconnect ; Description ...: Reconnects the Fritz!Box ; AutoIt Version : V3.3.0.0 ; Requirement(s).: FF.au3 / MozRepl / Fox!Box ; Syntax ........: _FF_FoxBox_Reconnect([$iTimeOut = 30000]) ; Parameter(s): .: ; Return Value ..: Success - IP ; Failure - 0.0.0.0 and sets ; @ERROR - 1 ; - 2 = TimeOut ; Author(s) .....: Thorsten Willert ; Date ..........: Wed Mar 25 17:33:16 CET 2009 @731 /Internet Time/ ; ============================================================================== Func _FF_FoxBox_Reconnect($iTimeOut = 30000) _FFCmd("reconnectFritzBox()") If Not @error Then Sleep(1000) Local $iTimeOutTimer = TimerInit() While _FFCmd("foxBoxInternetConnectionStatus") = "reconnect" Sleep(2500) If TimerDiff($iTimeOutTimer) > $iTimeOut Then SetError(2) Return "0.0.0.0" EndIf Wend Return _FF_FoxBox_GetIP() Else SetError(1) Return "0.0.0.0" EndIf EndFunc ;==>_FF_FoxBox_Reconnect ; #FUNCTION# =================================================================== ; Name ..........: _FF_FoxBox_ToggleStatus ; Description ...: Toggles the status of FoxBox ; AutoIt Version : V3.3.0.0 ; Requirement(s).: FF.au3 / MozRepl / Fox!Box ; Syntax ........: _FF_FoxBox_ToggleStatus(ByRef $Socket) ; Parameter(s): .: ; Return Value ..: Success - 1 = enabled / 0 = disabled ; Failure - 0 and sets ; @ERROR - 1 ; Author(s) .....: Thorsten Willert ; Date ..........: Wed Mar 25 17:33:45 CET 2009 @731 /Internet Time/ ; ============================================================================== Func _FF_FoxBox_ToggleStatus() _FFCmd("toogleFoxBoxStatus();") If Not @error Then Return _FF_FoxBox_GetStatus() SetError(1) Return 0 EndFunc ;==>_FF_FoxBox_ToggleStatus