Sign in to follow this  
Followers 0
Gene

__IsPressed()

8 posts in this topic

#1 ·  Posted (edited)

This may lead to a challenged question... I'm beginning work on a routine to find a record as the user types in the name, address, zip code or whatever field is being searched. As each key is typed the number of records meeting the criteria would be reduced. I was thinking I could use the _IsPressed() UDF to capture and build the search variable as it is typed using a select... case endselect statement. I was starting off with the vowels and the space to improve speed, when I realized that _IsPressed() apparently only addresses capitals. I also notice that commas and other keys are missing too. I could work around the case issue, but I'm not sure how to get around the comma and some of the other shifted number keys across the top of the keyboard

Now the question, is there a way to determine the case of letters pressed? What about codes for commas, colons, semi-colons, etc. Is this learned information, looked up information or a construct? If it is looked up info and you (ezzitabbi , Jon or someone else) don't mind telling me where, I'll be happy to look it up for myself.

Code snippet below.

Gene

$dll = DllOpen("user32.dll") ; this would be at the beginning of the routine

Select

Case _IsPressed("??", $dll) ;a

$sSearchStr = $sSearchStr & "a"

Case _IsPressed("??", $dll) ;e

$sSearchStr = $sSearchStr & "e"

Case _IsPressed("??", $dll) ;i

$sSearchStr = $sSearchStr & "i"

Case _IsPressed("??", $dll) ;o

$sSearchStr = $sSearchStr & "o"

Case _IsPressed("??", $dll) ;u

$sSearchStr = $sSearchStr & "u"

Case _IsPressed("41", $dll) ;A

$sSearchStr = $sSearchStr & "A"

Case _IsPressed("45", $dll) ;E

$sSearchStr = $sSearchStr & "E"

Case _IsPressed("49", $dll) ;I

$sSearchStr = $sSearchStr & "I"

Case _IsPressed("4F", $dll) ;O

$sSearchStr = $sSearchStr & "O"

Case _IsPressed("55", $dll) ;U

$sSearchStr = $sSearchStr & "U"

Case _IsPressed("20", $dll) ;space

$sSearchStr = $sSearchStr & " "

Edited by Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Does the name keypressed not say anything?

It only record wich key is pressed not wich ascii char

Its like the old bios scan codes in C++.

so if you want to capture capital etc just record is the shift is pressed and depressed and put that in a variable also test capslock ofcourse.

Edited by MrSpacely

Share this post


Link to post
Share on other sites

so if you want to capture capital etc just record is the shit is pressed and depressed and put that in a variable also test capslock ofcourse.

can you repeat that in english?


[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This may lead to a challenged question... I'm beginning work on a routine to find a record as the user types in the name, address, zip code or whatever field is being searched.

I must question your intentions with your script. Bad keylogger programs do the same for stealing information. Bitdefender was marking all AutoIt scripts 2 days ago as viruses as from someone's evil deed with AutoIt.

If you have an AutoIt gui, then you can get this information directly with the return. If it is a 3rd party appliction being automated, then ControlGetText can get the text from the edit field. So your keylogging for what reason?

Edited by MHz

Share this post


Link to post
Share on other sites

O darn I said if the shit is pressed

I meant the shift and capslock

and keyloggers suck I just used the keypressed with a check so it only reacts wich handle is active so you can type etc in the window you want

I needed to capture some buttons in a other windows (so you could select colors in differend ways)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

41 "A" etc should work for capital and lower case

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I must question your intentions with your script. Bad keylogger programs do the same for stealing information. Bitdefender was marking all AutoIt scripts 2 days ago as viruses as from someone's evil deed with AutoIt.

If you have an AutoIt gui, then you can get this information directly with the return. If it is a 3rd party appliction being automated, then ControlGetText can get the text from the edit field. So your keylogging for what reason?

I would have responded earlier, but I had trouble staying logged on to the forum for several days.

On second glance, I suppose it is a keylogger, but I didn't conceive it that way. I'm trying to duplicate a feature in MS Access. On a user defined application screen, when you click to Filter by Form, you can type a search string in any field. As you do, the search string is replaced/becomes the first match to the search string (determined as you type each additional character) in that field until it matches or fails to match the record or records meeting the typed criteria. When the desired content appears, you click the Funnel icon to apply the filter. My goal is a little narrower than that, I plan to address just one field, and display the Lname, Fname, Initial & Status (dead or alive) fields of the record found plus the two before and the two following in a List Box. All the fields for the selected record would be displayed in a tabbed arrangement below the List Box.

As I think about it, the "any field" statement above probably should be "any indexed field".

I am very open to other ways of achieving the same results, by that, I mean being able to update a display as the search string is being typed.

After I wrote the reply above, I realized that I only needed the comma and semi-colon keys in addition to what is already there. I assumed from your tone and that of others I've seen taking people to task for keyloggers or other no-nos, that I would get no help with the codes for those keys. On looking, I almost immediately found them. I won't distribute them, but if I found them, others can too.

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

41 "A" etc should work for capital and lower case

Thank you for the reply.

After I posted I realized that I could just uppercase both the search string and the array variable being compared. I still needed the 'comma' in case the user typed in an Sr. or Jr. or other sufix that would use a comma after the name. I also needed the 'semi-colon' because some fields use them to separate values (so it could stay a flat file) only three fields, children, grandchildren and email addresses. It should never exceed 300 records. As I mentioned elsewhere, I found the codes I needed. I'll probably need more help though, as this thing progresses.

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

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