Page 1 of 1 1
Topic Options
#149702 - 2005-10-12 12:37 AM disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi, i was wondering if anyone could help me. Is there a way in kixtart to disable/enable keyboard/mouse activity for a client machine? Please let me know, much appreciated. Thanks
Mandev
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149703 - 2005-10-12 12:43 AM Re: disable/enable keybaord/mouse activity
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Not a way in kixtart itself... but devcon might be an option...

The DevCon command-line utility functions as an alternative to Device Manager
_________________________
(... better days ahead)

Top
#149704 - 2005-10-12 12:49 AM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Thanks allen for the prompt reply. so i can use devcon to do this? i suppose i could build GUI around the command line utility? what would be the command line to disable the keyboard/mouse for a client pc??

Thanks
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149705 - 2005-10-12 12:54 AM Re: disable/enable keybaord/mouse activity
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
hmmm... I said "might"...

I've not actually used devcon for what you are asking. I have used it for removing a piece of hardware, and then redetecting it later... which sounds a lot like what you want. I found devcon pretty straight forward... look at the examples at the bottom of the page (of the link above). In the mean time, I'll see if I can find that old code I was using to remove and redetect.
_________________________
(... better days ahead)

Top
#149706 - 2005-10-12 12:57 AM Re: disable/enable keybaord/mouse activity
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
look for the AutoIt COM object at Hiddensoft.com
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#149707 - 2005-10-12 01:00 AM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
that would be great allen. i tried downloading the devcon package from the link you gave, but when i ran the application it didnt seem to work. does devcon require its own command line? or can i use the normal windows command line prompt? i just need to be able to enable/disable hardware basically as you stated.

Thanks a million!
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149708 - 2005-10-12 01:06 AM Re: disable/enable keybaord/mouse activity
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Rad's suggestion may work better... I was just playing with trying to disable the keyboard... but neither the Device Manager nor Devcon will let you do it...

Sorry... worth a shot I guess.
_________________________
(... better days ahead)

Top
#149709 - 2005-10-12 01:08 AM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
oh thats a shame, not working? so im left with AutoIt solution. Any ideas on that??

Thanks though
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149710 - 2005-10-12 01:09 AM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi, i have come across this last week. How do i use this feature? AutoIt.. Any ideas?
Much appreciated.

Mandev
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149711 - 2005-10-12 01:20 AM Re: disable/enable keybaord/mouse activity
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Here's a snippet from kholm (erik):

Code:

$oAutoIt = CreateObject("AutoItX.Control")
$oAutoIt.BlockInput("on")
Shell '%COMSPEC% Start /Wait Setup.exe -s'
$oAutoIt.BlockInput("off")


Top
#149712 - 2005-10-12 12:20 PM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi shaun thanks for the reply. Will that snippet of code you gave, allow me to disable the devices and enable them back? because i want to be able to create a classroom management console, and one of the features i want to do this disable the keyboard/mouse until the teacher has finished talking etc.

Thanks
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149713 - 2005-10-12 12:34 PM Re: disable/enable keybaord/mouse activity
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
In the example Shawn provided
  • input is blocked
  • a setup program is run then when it has completed...
  • input is unblocked again.


Your problem is that you will need to run the script on each PC in their user space.

Top
#149714 - 2005-10-12 01:26 PM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi richard. Thanks for that explaination. could you show me how to implement the code using two buttons? so when i click on one i disable the keyboard and click on another i enable the keyboard for a user?

Thanks so much
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149715 - 2005-10-12 01:40 PM Re: disable/enable keybaord/mouse activity
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Example using buttons. Did not test it but should work.
This runs locally and requires kixforms (http:www.kixforms.org) and autoit to be installed. Should be easy to adept so it can run remote (still requires autoit to be installed remote).

Code:

Break On
$System = CreateObject("Kixtart.System")
;
$Form = $System.Form()
$Form.Height = 119
$Form.Text = "Example buttons..."
$Form.Width = 133
;
$Button1 = $Form.Controls.Button()
$Button1.Height = 23
$Button1.Left = 15
$Button1.Text = "Disable input"
$Button1.Top = 15
$Button1.Width = 100
$Button1.OnClick = "Disable()"
;
$Button2 = $Form.Controls.Button()
$Button2.Height = 23
$Button2.Left = 15
$Button2.Text = "Enable input"
$Button2.Top = 45
$Button2.Width = 100
$Button2.OnClick = "Enable()"
;
$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1
;
Function Enable()
$oAutoIt = CreateObject("AutoItX.Control")
$oAutoIt.BlockInput("off")
$oAutoIt = ""
EndFunction
;
Function Disable()
$oAutoIt = CreateObject("AutoItX.Control")
$oAutoIt.BlockInput("on")
$oAutoIt = ""
EndFunction

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#149716 - 2005-10-12 04:05 PM Re: disable/enable keybaord/mouse activity
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The way I see it, if all is run locally, when you block input, you also block the option to unblock. What you need is a client/server approach where the server communicates with the client. There are several ways to do the communicating. You could use a registry location, a cookie file, KF sockets, or a RK util called WaitFor.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#149717 - 2005-10-12 04:40 PM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi mart, Thanks for that coding. I will test it in the next couple of days or so when im back at work using the network. where can i download Autoit? is there a way for the teacher to select a machine name and disable their keyboard/mouse? if possible, could you show me please?

Thanks mart
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149718 - 2005-10-12 05:00 PM Re: disable/enable keybaord/mouse activity
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
The simplest thing is to have a script permanently running hidden on the student PC which checks a centralised INI file.

When the teacher selects a PC to be disabled an entry in the INI file which is keyed by the PC name is set to request it to disable. When the PC next checks it's name in the file it will see the block request, run the block code and set a status field in another INI file to show that it has done it.

Unblocking works the same way.

Setting the status field means that the teacher can check the status of the PCs and ensure that they are blocked/unblocked as appropriate.

The purpose of having a seperate file for the status field is that you don't want the students to have permissions to be able to change the blocking request INI file!

Top
#149719 - 2005-10-12 06:50 PM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Thanks richard. alot of this is new to me.. could you show me how to do this?
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149720 - 2005-10-12 07:21 PM Re: disable/enable keybaord/mouse activity
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
i mart, i tried that script example with the buttons, but it is not working for my machine. i have got Autoit installed as well. ????

Any suggestions?

Thanks
Mandev
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#149721 - 2005-10-12 07:31 PM Re: disable/enable keybaord/mouse activity
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I guess you ignored where I said "when you block input, you also block the option to unblock".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.122 seconds in which 0.075 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org