Sign in to follow this  
Followers 0
Nomad

Another Keypress Question Topic

21 posts in this topic

#1 ·  Posted (edited)

Here's the situation:

Say that the user has the ALT key held down. _IsPressed is used to determine that the ALT key is down. Is there any way to interrupt the keypress in Windows 98?

{ALTUP} will not work after a BlockInput is done in Windows 98. If you do a {ALTUP} before doing a BlockInput, the user keypress is still detected before BlockInput enables. I've tried a few other things, but this way seemed the most logical way to try it. I'm out of ideas. Any other ideas would be greatly appreciated.

EDIT: I left out something. The ALT key must have funtionality for the program which this script is monitoring. I only need to disable the ALT key while it's being held down under special circumstances and only for about 1 second. Then I would like it to resume the way it was, being held down if that is the case.

Edited by Nomad

Share this post


Link to post
Share on other sites



To disable the alt key, if altup doesn't work, maybey try making a hotkeyset that doean't attach the key to a function, then attached the hotkey to something different to re-enable the alt key.

try that, i dunno if it will work

Share this post


Link to post
Share on other sites

No, doesn't work. So far the only way I've been able to disable the ALT key is if the user actually releases it, but this probably will not happen when I need it to when the script is running. Asking the user to release it would also be out of the question for many reasons.


Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

No, doesn't work. So far the only way I've been able to disable the ALT key is if the user actually releases it, but this probably will not happen when I need it to when the script is running. Asking the user to release it would also be out of the question for many reasons.

Just as a guess,

could this be you trying to stop a user from pressing ctrl+alt+delete? :D:oops:

If this is the case, i know not of a way other than altup, but my idea is punish the user for doing it by using

Opt("WinTitleMatchMode",4)

HotKeySet("{^!}", "Punish");might need is pressed here, this is untested

Func Punish()
WinMinimizeAll()
WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE)
WinSetState("Program Manager", "", @SW_HIDE)
Endfunc

This hides their desktop and taskbar when ctrl+alt is pressed, and when they close all the processes, they won't have a desktop :):(

Edited by Paulie

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

No, and I'm not even sure how to respond to that.

The ALT key is used in the program (game), to show hidden text on the screen (from items dropped on the ground), and only shows the text when ALT is pressed. However, sometimes the text will cover an area of the screen that I need visible for a PixelGetColor and the only way to remove the text is to release the ALT button. If I can't get the color under the text when needed, then the script is useless.

EDIT: The game is also run in full screen, so I don't need to do anything with the desktop. I'm also not trying to do anything malicious.

Edited by Nomad

Share this post


Link to post
Share on other sites

No, and I'm not even sure how to respond to that.

The ALT key is used in the program (game), to show hidden text on the screen (from items dropped on the ground), and only shows the text when ALT is pressed. However, sometimes the text will cover an area of the screen that I need visible for a PixelGetColor and the only way to remove the text is to release the ALT button. If I can't get the color under the text when needed, then the script is useless.

EDIT: The game is also run in full screen, so I don't need to do anything with the desktop.

:"> :">

LOL sry my bad :):(:D:oops::(

Ahhh... diablo? now i'm right, right?

ok, well if thats the case,

1-why are you blocking input?

2-did you add a shade variation in pixelsearch?

Share this post


Link to post
Share on other sites

The BlockInput was just an attempt at disabling the ALT key for a few milliseconds to remove the text and get the color underneath. Shade variation will be too unreliable since the variation of colors while under the text, which also varies in color, will be so much that it will cause the script to give false positives.

Yes, Diablo.. I still play somewhat but am enjoying writing scripts for it even more lately.


Share this post


Link to post
Share on other sites

The BlockInput was just an attempt at disabling the ALT key for a few milliseconds to remove the text and get the color underneath. Shade variation will be too unreliable since the variation of colors while under the text, which also varies in color, will be so much that it will cause the script to give false positives.

Yes, Diablo.. I still play somewhat but am enjoying writing scripts for it even more lately.

Well then, don't use BlockInput, and use altup, doesn't that work, also, i think that you can change which button make the item names come up,

maybe if you can, make it like "c" or something so you don't have to worry about windows key restrictions

Share this post


Link to post
Share on other sites

It's worth a shot, but I would need to write the script to do it automatically. I can change my own settings manually, but not those of other people who will be using this script. :)

I'll have to look into this to see the best way of doing it. If I did it this way I would prefer it to be done without the "animation" you would see by doing it manually. I would want to change it directly in whatever file holds the key assignments for the game; and as of yet, I don't know which file that is or how to change it. :(


Share this post


Link to post
Share on other sites

Nah, that isn't going to work either. Even if I change the key used to show the text to... say "D", the key will only be pressed and will not stay down while the user is holding the ALT key down unless you leave the script trapped in a function the entire time it is being held down. There isn't a {DDOWN} key like there is for ALT, CTRL, etc..

So I need to figure out a way to disable the ALT key while it is being held down (not before it is pressed), then re-enable it after I perform the PixelGetColor.


Share this post


Link to post
Share on other sites

I still haven't figured out a way of doing this, or a good way of working around it. I see that nobody else has had any suggestions as of yet, so I decided to give the topic the perverbial bump. I have a headache so I'm going to lay down for a while, hehe. Any other ideas are encouraged and appreciated.


Share this post


Link to post
Share on other sites

bump.


Share this post


Link to post
Share on other sites

Well, I've discovered one of the problems. It seems that the game will not allow me to assign a hotkey while it is in full screen, but it will when it is windowed. I had never noticed this before because all of the scripts I have done for this game prior to this has had the game running in windowed mode.

I have tried assigning the key before executing the game, and assigning it while the game is already executed. In both cases, the windowed game allows me to assign the hotkey, and the full screen doesn't assign either way.

Anyone know any possible ways around this?


Share this post


Link to post
Share on other sites

I've been messing around with this idea, trying different variations of things in an attempt to disable the ALT key while it is still depressed by the user:

#Include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep (100)

If _IsPressed("12", $dll) Then ; 12 = ALT

While _IsPressed("12", $dll)

Send("{ALTUP}")

WEnd

EndIf

If _IsPressed("11", $dll) Then ; 13 = CTRL (just a way to exit the script for now)

ExitLoop

EndIf

WEnd

DllClose($dll)

I've also tried ControlSend, but it's the same scenario... ALT refuses to deactivate while it is still depressed. Naturally, even if I get something like this to work, I'll still have to make alterations of sorts. This will probably be a second script which will run with my main script so that my main script may continue running while the ALT key is depressed. I'm still open to suggestions.


Share this post


Link to post
Share on other sites

If you google for this idea you have, you will see it is not as easy as calling a function like that.


[center]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.[/center]

Share this post


Link to post
Share on other sites

That's why I'm asking for help...

What do you mean by "Google this idea"? Do a search on the web for disabling the ALT key?


Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

That's why I'm asking for help...

What do you mean by "Google this idea"? Do a search on the web for disabling the ALT key?

I know why your asking for help, and I'm replying on what I found by googling around looking to see if "I" could help you...

Yes, I'm talking about Google.com / "How to disable the ALT key", and read those posts. You might actually find a DLL call that would work for you, but I stopped reading after about the 3rd page.

Edit:

Here is a program called "I hate this key" (Freeware)

Edit2:

Nevermind, that's for the Windows Key :)

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

No problem, I'm currently looking through pages myself. Disabling the ALT key totally would only be a last resort though. I simply want the key depression to be interrupted in the game for a few milliseconds to allow me to get the color of pixels under the text which is shown when the ALT key is depressed, and only if the text is covering the area of the screen in question.

Scripting the conditions to ALTUP is easy enough, it's just getting the ALTUP while the key is depressed that's the issue. :)

Edit: I've found out how to disable it for windows 2000+, just not for windows 98. It involves changing some registry keys, but this is a total disable anyway.. back to searching

Edited by Nomad

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Ok, I give up. I found a lot of other useful scripts, programs, etc.. but no .dll that would help and the only programs I seen boasting that their hotkeys worked while in a full screen game window, were for windows 2000+. That is the real issue now, in case it wasn't apparant. It's not just the ALT key, it's any hotkey. I can't set any hotkey while the game is in a full screen. I believe it's a windows thing, and has nothing to do with what game it is.

If anyone knows how to get past the full screen hotkey block (or whatever you want to call it) on windows 98, then great... otherwise I'm done and am going to start fresh and work around it somehow.

Edit: I just remembered that Mousepad's Maphack for Diablo II used hotkeys from the numberpad and a few other keys.. so there has to be a way around this..

Edited by Nomad

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Ok, I give up. I found a lot of other useful scripts, programs, etc.. but no .dll that would help and the only programs I seen boasting that their hotkeys worked while in a full screen game window, were for windows 2000+. That is the real issue now, in case it wasn't apparant. It's not just the ALT key, it's any hotkey. I can't set any hotkey while the game is in a full screen. I believe it's a windows thing, and has nothing to do with what game it is.

If anyone knows how to get past the full screen hotkey block (or whatever you want to call it) on windows 98, then great... otherwise I'm done and am going to start fresh and work around it somehow.

Edit: I just remembered that Mousepad's Maphack for Diablo II used hotkeys from the numberpad and a few other keys.. so there has to be a way around this..

It appears that 5 .dlls are imported into maphack, but I don't know much about .dll's. The five .dll's are: USER32.dll, KERNEL32.dll, GDI32.dll, D2GAME.dll (From the game directory), and D2Maphack.dll (Obviously something he wrote)

I'm going to try looking them up and see what sort of functions they perform... I'm familiar with USER32.dll already, hehe.

Edit: The funny thing is, I had to use 3 different online computer dictionaries to get the definitions for user32.dll, kernel32.dll, and gdi32.dll even though all 3 are common for most computers... It seems that the Kernel32.dll might be what I'm looking for since it handles interrupt requests, and that's exactly what I would like to do, interrupt to depression of the ALT key. From the way this topic has been going I'm not expecting to get help on this matter either anytime soon.. so back to doing some more research to see how to implement this .dll to perform what it is I want.

Edited by Nomad

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0