; Script SpaceShrimp v1.2b ; Also known as All your memory are belong to SpaceShrimp ; ; AutoIt Version 3.0 ; Platform Win10 ; Author Kerstin/Judas ; Input & help Tomas Engin ; ; Space Shrimp explanation: ; ------------------------- ; In C*Base the WAIT.SEQ is turned of after approx 5 minutes to save the ; good old CRT's. Since we are not using that in Nackgreppet we need a way ; to remove the sceensaver. This script works in the background and presses ; "space" based on the timer (milliseconds) and the state of the telnet port. ; ; It checks if LISTENING or ESTABLISHED is reported from the port and is only ; pressing "space" when the port reports LISTENING to activate when C*Base is ; waiting for a call. ; ; https://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm ; https://www.autoitscript.com/autoit3/docs/functions/OnAutoItExitRegister.htm ; https://www.autoitscript.com/autoit3/docs/functions/FileReadLine.htm ; https://www.autoitscript.com/autoit3/docs/functions/StringCompare.htm ; https://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm ; https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm ; ; https://www.autoitscript.com/forum/topic/180341-envget-dont-get-a-user-defined-variable/ ; ---------------------------------------------------------------------------------------------------------------------------- ; Initialization ; ---------------------------------------------------------------------------------------------------------------------------- #include <..\includes\MsgBoxConstants.au3> #include <..\includes\TrayConstants.au3> ; Alters the length of time a key is held down before being released during a keystroke AutoItSetOption ("SendKeyDownDelay", 50) ; Function to be called when AutoIt exits. OnAutoItExitRegister("ShrimpCloseLogFile") Global $SpaceShrimpLogFile = "C:\FriaBadBBS\data\logs\SpaceShrimp.log" ; ---------------------------------------------------------------------------------------------------------------------------- ; Main ; ---------------------------------------------------------------------------------------------------------------------------- ShrimpTray() ShrimpOpenLogFile() While true ShrimpLogCompare(ShrimpLogRead(), "LISTENING") ; Timer for how often "space" is sent to the selected WinVice window ; Sleep(240000) Sleep(30000) WEnd ; ---------------------------------------------------------------------------------------------------------------------------- ; Functions ; ---------------------------------------------------------------------------------------------------------------------------- ; Open log file Func ShrimpOpenLogFile() FileOpen ($SpaceShrimpLogFile) EndFunc ; Close log file Func ShrimpCloseLogFile() FileClose($SpaceShrimpLogFile) EndFunc ; Read log Func ShrimpLogRead() ; Read first line from log file Local $tcpser_LocalPort = FileReadLine ($SpaceShrimpLogFile, 1) ; Debug ; MsgBox($MB_SYSTEMMODAL, "Port: 64128", "String from log: " & $tcpser_LocalPort, 3) ; Return line from log file (string) return String($tcpser_LocalPort) EndFunc ; Compare current telnet port status with trigger string (LISTENING) Func ShrimpLogCompare($tcpser_LocalPort, $tcpser_trigger) ; Compare strings Local $tcpser_compare = StringInStr($tcpser_LocalPort, $tcpser_trigger) ; If status compares (1) if Number($tcpser_compare) = 1 Then ; Get handle of WinVice running C*Base in Nackgreppet $hWnd = WinGetHandle("[11/11] VICE (C64SC) (Admin)") ; Debug ; MsgBox($MB_SYSTEMMODAL, "Port: 64128", "String and trigger compares: " & $tcpser_LocalPort, 3) ; Send "space" to WinVice in the background ; ControlSend($hWnd, "", "", "{space}") ControlSend($hWnd, "", "", "C") Endif EndFunc Func ShrimpTray() TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. TraySetToolTip("SpaceShrimp v1.2b") ; The tray menu icon must be shown before we can set some text. EndFunc