Guy_ Posted October 30, 2005 Share Posted October 30, 2005 Hi all and thanks for this *amazingly* helpful app & support I'm starting an IrfanView slideshow with a script. However, if people too near to the keyboard inadvertently touch a key, the show is stopped, which in this case can be a "disaster". I'd like a way to have plain keyboard keys locked while it's playing, but still have a way out. My preferred way out is Alt+F9, an already defined call to an established script, which I could just as well integrate in this new script that someone might kindly provide me with, hopefully This is kind of how far of an idea I get after some reading... HotKeySet("!{F9}", "ExitIrfanView") ; [this same combo should unlock the keyboard, quit the slideshow and start a video player, a script I've already made (except for the locking/looping problem)] Run("C:\program files\IrfanView 3.97\i_view32.exe /slideshow=c:\pics") ; starts slideshow [some kind of loop around this here?] BlockInput(1) [loop] Func ExitIrfanView() BlockInput(0) [my code to quit slideshow and start up a video player instead]] Exit EndFunc But I understand BlockInput may only be escaped from with ctrl+alt+del? So maybe there's some other nifty loop solution that doesn't eat my CPU during the slideshow? This is where it's getting over my head a bit... If someone knows a simple keyboard locker app that I could start and quit from within AI, then that's almost just as great. But I might still need the looping help. Many thanks in advance! Link to comment Share on other sites More sharing options...
Guy_ Posted October 30, 2005 Author Share Posted October 30, 2005 By the way: it's a W2K SP4 machine Link to comment Share on other sites More sharing options...
markusss Posted October 30, 2005 Share Posted October 30, 2005 As far as i understand you right you don't need help with the "close slideshow/open video" part, so i just left that blank If you look in your helpfile, under AutoIt->Language Reference->Loop Statements you can find help for the 3 (5 with newest beta) loop functions! The one we're gonna use is: While 1 ... WEnd so your code would look like this: HotKeySet("!{F9}", "ExitIrfanView"); [this same combo should unlock the keyboard, quit the slideshow and start a video player, a script I've already made (except for the locking/looping problem)] Run("C:\program files\IrfanView 3.97\i_view32.exe /slideshow=c:\pics"); starts slideshow While 1 BlockInput(1) WEnd Func ExitIrfanView() BlockInput(0) ;[my code to quit slideshow and start up a video player instead]] Exit EndFunc Hope thats what you needed HF Felix N. (tdlrali) Link to comment Share on other sites More sharing options...
markusss Posted October 30, 2005 Share Posted October 30, 2005 (edited) Oh yeah, for this script archrival has wrote a vb program that blocks all input except for ctrl-alt-del!You might wanna ask him if he can modify is so it blocks ctrl-alt-del too but allows alt-f9... i bet he is happy to help you! Felix Edited October 30, 2005 by Felix N. Link to comment Share on other sites More sharing options...
Guy_ Posted October 30, 2005 Author Share Posted October 30, 2005 "Gee, thanks". I hope you mean well, but this was "the worst advice I've ever gotten" I thought of such a simple looping scheme myself, but as I feared, the CPU is constantly maxing out. The BlockInput "of course" seems to block my escape as well. And on top of that: even the ctrl-alt-del just showed me the window, but I couldn't get out and had to reset. BTW: I repeat that I just need protection against accidental keystrokes, not against bad-mannered geeks trying every combo Link to comment Share on other sites More sharing options...
Guy_ Posted October 30, 2005 Author Share Posted October 30, 2005 "Gee, thanks". I hope you mean well, but this was "the worst advice I've ever gotten" I tested it on XP instead of W2K though. So if that was the reason, I apologize (but I doubt it) Link to comment Share on other sites More sharing options...
LxP Posted October 31, 2005 Share Posted October 31, 2005 "Gee, thanks". I hope you mean well, but this was "the worst advice I've ever gotten" I'm sure you've been given worse advice in your life. Anyway, welcome to the forums -- hopefully my attempt to help you won't provoke such a cold retaliation. Calls to BlockInput() do not need to be looped. Once you activate input blocking, it's active until you deactivate it.Your current approach will not work because hotkeys become inactive while BlockInput() is active. Currently there is no way around this so your best option is to research a slideshow player that doesn't respond so daintily to keyboard activity. You might find one here or here; otherwise a Google search might be more fruitful.When you find one that you can tolerate, it may offer only a few different keys (instead of the myriad that IrfanView appears to offer), but you may not want all of those keys to be available -- at that point you can use HotkeySet() to map those unwanted keys to an empty function which will effectively disable those keys.Of course, you could take this approach for IrfanView if you really wanted to but HotkeySet() is limited to 64 mappings, so you wouldn't be able to disable most of the keys. Link to comment Share on other sites More sharing options...
Guy_ Posted November 1, 2005 Author Share Posted November 1, 2005 (edited) I'm sure you've been given worse advice in your life. Anyway, welcome to the forums -- hopefully my attempt to help you won't provoke such a cold retaliation. Sorry, it was in good humour. It just seemed to me that Felix hadn't really thought it through or tried it himself. I had thought of that kind of loop, but had predicted the CPU maxing out before trying it; also it seemed a bit obvious that the key to get out of it wouldn't work anymore That's all It was ages ago that I had to use my PC's reset button twice, you see I had tried the plain command without the loop as well, but it didn't do anything at that time...Anyway, they say they're sure they're not touching the keyboard and I believe them, so it must be something else and I'm not going to pursue this further at the moment.Still, your advice is very helpful for future cases, so Thank You for that & the links And to Felix for the link. I'll forget the other part Edited November 1, 2005 by Guy_ Link to comment Share on other sites More sharing options...
markusss Posted November 1, 2005 Share Posted November 1, 2005 Hey! I'm really sorry I gave you such a crappy piece of code! I hope I didn't do any harm ?!? I didn't really think about what I posted, I just saw that you needed a loop so i gave you one...^^ Again, I apologise that I didn't think about what I posted, I hope we can both learn from this: Never believe what a Newbie posts, always double check! Felix N. Link to comment Share on other sites More sharing options...
Guy_ Posted November 1, 2005 Author Share Posted November 1, 2005 Hey! I'm really sorry I gave you such a crappy piece of code! I hope I didn't do any harm ?!? "I forgive you"... I still tried it because I was desperate Harm? Now that you mention it... For some reason my XP won't shut off anymore. I've never had this before. But please don't offer me your solution Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2005 Moderators Share Posted November 1, 2005 Well, you could always jerk the power cord Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Guy_ Posted November 2, 2005 Author Share Posted November 2, 2005 Well, you could always jerk the power cord Luckily I can restart and shut down in two more Windows installations. I should now use AutoIt to do just that Link to comment Share on other sites More sharing options...
markusss Posted November 2, 2005 Share Posted November 2, 2005 Lol, I don't see why you can't shut down anymore.... kinda strange, autoit doesn't do anything to files or anything... Maybe you should run a BlockInput(0) command, i don't know whether the blockinput changes anything that didn't get changed back due to the restart? But you're right, you're better off not doing it^^ Felix N. Link to comment Share on other sites More sharing options...
Guy_ Posted November 2, 2005 Author Share Posted November 2, 2005 Lol, I don't see why you can't shut down anymore....It was probably the last drop in a crowded system situation, not *only* caused by you... I figure it might well happen if you freeze a PC when a lot of other programs are running and you have to reset. You never know what can happen there when you're out of luck... 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