mattx Posted May 8, 2007 Posted May 8, 2007 Our IT teacher wanted to let the students use Spark [ IM ] for some lessons - not sure what about - he also wanted a way so he could control it - [ turn it off if need be on the students PCs in one click ] - bit of a tall order but I came up with this. Yes I know its messy as I have not had to code anything like this before but at least it works. All I did was have a simple switch for the teacher which basically copied over / deleted a dat file with the relevant on / off setting. The student fires off Spark with a launcher which loops every 5 seconds checking the status of the control file. If it goes to the off file then Spark is closed on the client. I very much doubt you will have this type of request on your networks etc but it may give other members ideas and pointers for future control of certain applications. Its all written in AutoIT. I won't supply the exe as its really network specific so its the source I have supplied: Switch code. ; AutoIt Version: 3.2.0.1 ; Language: English ; Platform: WinXP ; Author: Matt Marsh - [email protected] ; Script Function: Spark Switch For Staff - SERVER VER ; Version: 1.0 ; Date: May 2007 #include #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Spark Switch", 220, 110, 348, 309) $helpmenu = GUICtrlCreateMenu("Help") $infoitem = GUICtrlCreateMenuitem("About", $helpmenu) GUISetBkColor(0x0066FF) $Button1 = GUICtrlCreateButton("Spark On", 10, 20, 89, 49, $BS_DEFPUSHBUTTON) $Button2 = GUICtrlCreateButton("Spark Off", 120, 20, 89, 49, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $Button1 FileDelete('\\SERVER\apps\misc\spark switch\rule\*.dat') FileCopy('\\SERVER\apps\misc\spark switch\spark on.dat', '\\SERVER\apps\misc\spark switch\rule') Case $nMsg = $Button2 FileDelete('\\SERVER\apps\misc\spark switch\rule\*.dat') FileCopy('\\SERVER\apps\misc\spark switch\spark off.dat', '\\SERVER\apps\misc\spark switch\rule') Case $nMsg = $infoitem MsgBox(0, "Spark Switch Controller 1.0", "Written By Matt Marsh." & @CRLF & "Comments & Suggestions to:" & @CRLF & "[email protected]") EndSelect Switch $nMsg Case $GUI_EVENT_CLOSE FileDelete('\\SERVER\apps\misc\spark switch\rule\*.dat') FileCopy('\\SERVER\apps\misc\spark switch\spark off.dat', '\\SERVER\apps\misc\spark switch\rule') Exit EndSwitch WEnd Source for launcher: ; AutoIt Version: 3.2.0.1 ; Language: English ; Platform: WinXP ; Author: Matt Marsh - [email protected] ; Script Function: Spark Launcher which checks for a condition ; Version: 1.0 ; Date: May 2007 Opt("TrayIconHide", 1) Run ('c:\program files\spark\spark.exe') Do FileExists ('\\SERVER\apps\misc\spark switch\rule\spark on.dat') Sleep(5000) Until FileExists ('\\SERVER\apps\misc\spark switch\rule\spark off.dat') SplashTextOn("Teacher Spark Controller","Spark is now closing." & @CRLF & "Goodbye !!","200","100","-1","-1",34,"","","") Sleep(4000) SplashOff() ProcessClose('spark.exe')
Domino Posted May 8, 2007 Posted May 8, 2007 hmmm, personally i would have had a different wildfire server running for each IT room, then let the teachers machine have a batch file that starts or stops it. But if your way is working then why change anything?
mattx Posted May 8, 2007 Author Posted May 8, 2007 hmmm, personally i would have had a different wildfire server running for each IT room This way though, teachers still get to run their session of Spark without it being forced off & they can control the students spark session from any PC on the network. We only have a few servers so installing it on one did the job for us....
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now