How to set keyboard key using registry - python-2.7

Im looking for a way to write a script (hopefully in python) that remmap specific keyboard keys using the registry.
For example: switching only between the enter and the space bar.
In addition I would like to know if there is away to set the value of the spacebar key.
for example: making the spacebar write the word "space".
Thanks (:

You can use the open source project called Sharp keys to change keys in your registry. Its written in C#, but you may give it a try.
Link: http://sharpkeys.codeplex.com/

While the question is old, the problem is still relevant. I'd suggest using AutoHotkey. Following would trigger Space key when Enter is pressed and would print "space" when space key is pressed:
Enter::
Send, {Space}
return
Space::
Send, space
return

Related

Read input live from the terminal C++

I want something with C++ that can read what I type in the terminal and assign it to a string variable.
I want this for a project to make something like notepad, but in simple terminal form, so I need to have live user input available to get word count and stuff.
Unfortunately, I couldn't find anything on the internet about this, and I only found sites that talked about keyboard input, but I don't want that.
I tried to test this using the getch() function and there was no problem in writing and getting input.
But when the user wants to delete something, we don't know which character the user deleted, because we don't have the selected character, if we have it, when we print it after getting the character (if we don't print the user he just writes and doesn't know what he wrote) the problem is that the page must be cleaned once after deleting a letter and this causes the terminal to tick

Kate Text Editor regexp for CNC code alteration on PC

When using some CAM software, the CNC code is usually generated properly with spaces.
But for example when moved to "Citizen Cincom L20" machine via USB or network and edited there it lose spaces and also lose semicolons while preserving new lines which does work as semicolons anyway.
But since editing of CNC program happens in 3 places: CAM Software(ESPRIT in this case), CNC machine controller and also via text editor on the computer as postprocessor in ESPRIT is garbage.I've come up with this regex
([0-9]{1,2})([A-Z])
\1 \2
so
G1G99X5.4Z-.5F.12
Becomes
G1 G99 X5.4 Z-.5 F.12
that works in Kate to space everything back again for clearer reviwing of code. The only issue about it is that I need to do that manually for every file and I would like to automate it, preferably via Kate, so it would happen upon opening any ????.PRG plain text files.
But I do not exactly know how such happening should be called is it like macro or what ?
I'm looking for some suggestions to accomplish this. Or maybe some alternative solutions
First, go to View -> Tool Views -> Show Search and Replace. You will see
Make sure you:
Enable {} regex option on the right as you are using a regex
Enable "AB" option on the right that enables case sensitive matching
Select In Folder value from the dropdown on the right
Fill out the regex, replacement, Folder and the Filter fields with the appropriate values
Click Search button.
You will see the results in a separate pane and Replace / Replace Checked buttons will become enabled.
Review the replacements and click Replace Checked:
Then you may check the updated file contents, and if you are satisifed with the results, use Save All, also by pressing CTRL+L.

sql server management studio shortcut to delete a row

Is there a shortcut in Management Studio 2012 to delete the row where the cursor is.
Except Shift+Del, because this has the side effect on your text saved before with Ctrl+C is deleted after the shortcut.
Is should work like Ctrl+D in Eclipse.
Unfortunately, there is no shortcut in SQL Server Management Studio to delete a row.
Ctrl + x do the deleting job (by cutting and placing to buffer) entire line where the cursor are.
Which can be a useful alternative to setting "delete" shortcut manually.
In case anyone is looking for a way to do this WITHOUT cutting the line to the clipboard, the command you want is called Edit.LineDelete. You can get to it by going to Tools --> Options --> Environment --> Keyboard --> Keyboard and searching for the command in the text box.
You may also need to make sure that the key combination you're assigning it to isn't already being used by anything else.
I think you need to change short cut key from Tools - Options and then Keyboard.
See in below image.
Instead of, Shift + Del you can assign any, you want to set. (Except default keys)

Auto-filling Word documents with Access VBA: Normal.dotm template issues

A somewhat similar question has been asked before, but the solution didn't work for me.
For instance, http://www.xtremevbtalk.com/showthread.php?t=99503
Background:
I have a MS Access 2010 database. In my database I have a form with a button. I've programmed the button to open a saved word document, populated book-marked places in the document, then save-as the word document with a name that includes the time (henceforth referred to as the auto-filled document). This all works just fine.
The problem:
If a different MS word document was already open when I clicked the button, then I have trouble closing the resulting auto-filled document. This is what happens:
1) I try to "x" out of my auto-filled word document.
2) the computer tells me that "This file is in use by another application or user // (C:....\Normal.dotm)"
3) I click "ok"
4) it offers to save-as the Normal template.
5) I click "cancel"
6) I try to "x" out of the word application once more.
7) the computer prompts me: "Changes have been made that affect the global template, Normal. Do you want to save those changes?"
8) I click "Don't save"
9) the application closes.
(This only occurs for instances when a word document is already open when I click the button on the form. Otherwise it works perfectly.)
My question:
Normally, I would just shrug and live with these extra few steps, but I'm the one making the database, so I have to think about my users. (Would it mess anything up to save the normal template--step 7?)
I googled this for a while. For similar situations, some people suggested adding objApp.NormalTemplate.Saved = True (where objApp is the Word application object), but this did not work for me.
Can someone please tell me what's going on? Is there a solution?
Any help will be much appreciated.
What you need to do is check to see if an instance of Word is already open. If it is, you might want to let your user know they need to close their Word doc.
' Handle Error In-Line
On Error Resume Next
Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
'If we got an error, that means there was no Word Instance
Set objWord = CreateObject("Word.Application")
Else
Msgbox ("You're going to need to close any open Word docs before you can perform this function.", vbOK)
Exit Sub
End If
'Reset Error Handler
On Error GoTo 0

Winapi: edit control not expanding its buffer

According to MSDN:
When the system creates an edit control, it automatically creates a text buffer, sets its initial size, and increases the size as necessary.
Yeah, only it doesn't. I have an edit control in my app that shows various logs, and I keep adding text to it using EM_SETSEL message (to find the end of the text in control's buffer) and EM_REPLACESEL message (to append some text to it). I don't know if it's a best way, but it's been working well so far. Today, however, I found out that if I try to append some text when there are lots of logs in edit control already, my app fails to do so. Maximum lenght of text that's shown in it is equal to 30k characters and when I try to append any more logs, it just fails, nothing happens. At first I set it as read-ony edit control, but nothing changes if I make it editable. Just when I try to type more than 30k characters in it, it acts as if I wasn't typing anything.
And now: I know that you can handle buffer expanding by yourself, but that's not the case here. If it is written that it should be expanded automatically, why doesn't it occur? Maybe I accidentaly set something that stops the application from increasing the buffer's size? I don't know and I can't find any answer to that, so I was just wondering if there's any way to actually make my application to expand that buffer on its own.
You need to set a text limit with the EM_LIMITTEXT message. Otherwise:
Before EM_LIMITTEXT is called, the default limit for the amount of
text a user can enter in an edit control is 32,767 characters.