ZiggyStardust Posted June 2, 2012 Share Posted June 2, 2012 I have been working on a program for several months and think it is about time to start over. I have a commercial package that runs in the forground and this program I am writing runs in the background. My program is designed to severy limit the keystrokes the user can make in the commercial package and disables the use of the mouse. It also uses HotKeySet for the F1 and F2 keys and they act as macros.I am generally not please with the way things are working. The HotKeySet is neat but has some issues. It stops execution of the script no matter where it is and jumps to the HotKeySet. That can cause problems. Then if the user just holds down the HotKey you get a wicked "recursion" thing going. I use BlockInputEx to block all but 6 keys and disable the mouse. The problem I have found with it is that when you block the mouse you also block the MouseClick() and unforutnately this commercial package does not respond to ControlClicks very well. On occasion I am forced to use MouseClick. Lo and behold the users have found that in the brief moment that I enable the mouse, do the mouse click and disable the mouse that they have a working mouse. I need better and more complete control of both the keyboard and mouse. Something like: While 1 CheckForKeypress If KepPressed and Key = F1 then .... CheckForMouseclick and ignore Wend I know that is pretty generic but more or less what I need. I only want to check for a keypress once per loop and need to completely disable the mouse yet still have the MouseClick and ControlClick work. Any ideas? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 2, 2012 Share Posted June 2, 2012 See if this function works out for you. _IsPressed - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
water Posted June 2, 2012 Share Posted June 2, 2012 So the user is allowed to interact with the commercial package but at the same time you want to limit the allowed keys plus do MouseClicks and ControlClicks? Why do you want to do that? Why shouldn't the user be in full control what he enters? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ZiggyStardust Posted June 2, 2012 Author Share Posted June 2, 2012 The user shouldn't be in full control when he enters because he can navigate (via a sequence of keystrokes and mouse clicks) to a place where he can launch every nuclear weapon in the U.S. arsnel. I don't want him to be able to do that Link to comment Share on other sites More sharing options...
water Posted June 2, 2012 Share Posted June 2, 2012 But if it's a commercial package (ERP like SAP or whatever) it should be possible to revoke permission to "launch every nuclear weapon". What do you do if a user is smart enougth to kill your background script? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ZiggyStardust Posted June 2, 2012 Author Share Posted June 2, 2012 Killing the background script is yet another step in making the script "bulletproof" I played a little with _IsPressed() and it does tell you if the key you were looking for was pressed but it does not block the input. It allows anything pressed to pass through to whatever is running. Not good....... Link to comment Share on other sites More sharing options...
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