+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, Spark Switch in Coding and Web Development; Our IT teacher wanted to let the students use Spark [ IM ] for some lessons - not sure what ...
  1. #1

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Spark Switch

    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 - mmarsh@st-johns.org.uk
    ; Script Function: Spark Switch For Staff - SERVER VER
    ; Version: 1.0
    ; Date: May 2007

    #include <GUIConstants.au3>

    #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 & "mmarsh@st-johns.org.uk")
    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 - mmarsh@st-johns.org.uk
    ; 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')

  2. #2

    Domino's Avatar
    Join Date
    Oct 2006
    Location
    Bromley
    Posts
    4,126
    Thank Post
    215
    Thanked 1,255 Times in 786 Posts
    Blog Entries
    4
    Rep Power
    505

    Re: Spark Switch

    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?

  3. #3

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: Spark Switch

    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....

SHARE:
+ Post New Thread

Similar Threads

  1. Need a new switch
    By cooper in forum Recommended Suppliers
    Replies: 10
    Last Post: 4th August 2008, 12:02 AM
  2. Need a new switch, recommendations?
    By Geoff in forum Hardware
    Replies: 15
    Last Post: 22nd November 2007, 09:54 AM
  3. Switch it off
    By Phreadlock in forum Windows
    Replies: 2
    Last Post: 16th September 2007, 08:52 AM
  4. Switch Recommendation
    By Ste_Harve in forum Wireless Networks
    Replies: 19
    Last Post: 8th July 2007, 08:06 PM
  5. HP switch reboot, Help!
    By phil_thebeans in forum Wireless Networks
    Replies: 1
    Last Post: 6th March 2007, 08:51 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •