All-
I've been trying to search and find a solution for a while but I'm still stumped on 2 questions
1) Basically lets say I have this key:
System.Windows.Forms.Keys.A
And I want to send it using SendMessageto a window where the keyboard layout could be ANYTHING. It could be US-EN, or DE, or BE, anything.
How can I achieve this? Right now the windows are interpretting the key differently based on their regional settings.
I thought maybe KeysConverter but I don't see a function that would help with this.
2) Lets say I just have a list of keys, how can I convert them to the correct codes (virtual?) to pass to SendMessage?
Thanks in advance!
Related
is it possible to slow the Sendkeys feature down, when I've set that it sends the keys out of a textbox?
So I mean that it takes longer / that there is a delay before sending each letter?
Ive also thought about if it is possible to have to press a key for sending each line.
I prefer the first option. Hope that is even technically possible.
Thank you for reading this
I've got the answer!
I bet the most people don't need help with this, but why shouldn't I publish the answer I found?
Code:
foreach(char uga in rbox.Text)
{
System.Threading.Thread.Sleep(50);
SendKeys.SendWait(uga.ToString());
}
If you got {ENTER} in the Textbox/String, then do this:
{ENTER} has an alternative keyword.
{ENTER} has "~". Writing the {example} keywords in the string will not work!
Just ENTER has this :( And some other keys, but they dont have keywords in these things: {example}
This site did help me!
Is there a way to show a question, with buttons, and allow the user to wither pick one of the buttons or specify a different answer?
For instance, have the bot ask: "how can I help you today?"
the specify buttons with: "Get on a diet, find a good hotel, learn English" and then let the user either pick one of these, or just way something different such as: "I would like to get to the moon".
We are currently using:
PromptDialog.Choice(context, OnMenuOptionSelected, m_requestTypes, "Here's what I can do for you", descriptions: m_requestTypes.Select(t => t.GetDescription()));
In case the user types in text that does not match the buttons it would show the question again.
Definitely doable but not with the out-of-the-box PromptChoice. What you would have to do is to inherit from it, override the TryParse and add your custom logic, to either pass-through any response you receive or just the ones you want.
The CancelablePromptChoice from the ContosoFlowers sample shows this approach, in this case, to accept terms to quit from the PromptChoice.
I can show you how I do this in node.js. You can probably port it to C#:
http://www.pveller.com/smarter-conversations-part-3-breadcrumbs/#Relaxed-Prompt
The idea is to make sure that Bot Framework doesn't re-prompt if the answer is not one of the options (buttons) provided.
Im searching about services/strategies to detect when entered names in forms are spammy, example: asdasdasd, ksfhaiodsfh, wpoeiruopwieru, zcpoiqwqwea. crazy keyboard inputs.
I am trying akismet is not specially for names (http://kemayo.wordpress.com/2005/12/02/akismet-py/).
thanks in advance.
One strategy is having a black list with weird names and/or a white list with normal names, to reject/accept names. But it can be difficult to found it.
you could look for unusual character combinations like many consecutive vowels/consonants, and watch your registrations and create a list of recurring patterns (like asd) in false names
i would refrain from automatically block those inputs and rather mark them for examination
Ask for a real email and send info to connect there. Then get info from the account.
No way is really safe anyway.
If speed isn't an issue, download a list of the top 100k most common names, throw them in an O(1) lookup data structure, see if the input is there, and if not, you could always compare the input to the entries using a string similarity algorithm.
Although if you do, you will probably want to bucket by starting letter to prevent having to perform that calculation on the entire list.
I would like to clear the search box in metro search charm after the user accepted one of the result suggestion my app is providing to the charm. How? Sounds easy but it is not, SearchPane.QueryText is read only.
I am actually surprised by the default system behavior. After the user accepted the ResultSuggestion (please remember to distinguish from QuerySuggestion) it does not make sense in my eyes to pre-populate the search box with this accepted result...
Try
var searchPane = Windows.ApplicationModel.Search.SearchPane.getForCurrentView();
searchPane.trySetQueryText("myQueryText");
The user's text stays there in case after looking at one of the results they decide "oh that's not it, I will look at this other result from" and the other result could even be from a different app. There is no way for an app to override this.
So, basically what i'm doing is using JNA to set a LowLevelKeyboardProc Keyboard hook, everything works perfectly fine, i can get the values exactly like i want them in java, but the problem i get is when trying to convert to chars, it becomes extremely ennoying handling caps locks, SHIFT keys and tons of other things like everything thats not a-z 0-9 on the keyboard, i was wondering if there is a easier way to do the conversion?
heres the details of what I'm getting from the hook every time a key is pressed
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644967(v=VS.85).aspx
, i Figured it might be best to find a way to manually generate a KeyEvent(Not char, since i need something to handle things like F keys, caps lock button, CTRL button etc etc).
Any help i can get is highly appriciated!.
The Abbot project (http://abbot.sf.net) has a system for mapping keycodes to keychars, using predefined keyboard mappings (it generates a wide variety of keystrokes and records the resulting character output). However, Java does not provide a way for "predicting" the resulting character output given a particular key code.
There may be something within the MS libraries.