Check Text Size Via Command Prompt Windows 7 - windows-7

I'm using Sikuli to do some tests which requires the computers resolution and text size to be set to a certain size. In this case, the text size should be set as "smaller - 100%". I'd like the computer to check to make sure this is the case before it actually wastes time attempting to run the test.
Is there a command you can type into command prompt that will tell you what the text size setting is set to? Or another quick way of finding the information? The only way I know of to get the information is Control Panel\Appearance and Personalization\Display. Using Sikuli to open up the control panel and visually check the text size wouldn't be worth the time, so I'd like a quick way of checking.
Also, I'd rather this be without any addon or anything like that.
Thanks.

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
AppliedDPI DWord
This is a per user setting.

Related

How do I write a script that will change the size of text and app when opening a program?

I have a Windows 7 laptop with the size of text and apps set to small. However, one program I use needs this setting to be set on medium. I'm sick of changing this setting every time I have to use the program.
How do I use a batch file to change the size and text of this program to medium without impacting other programs and keep the resolution at 1280x960?
I have no previous experience in writing batch files.
If the program is a batch file or its cmd.exe, you can just create a shortcut to that program, go into shortcut properties, go into the Layout tab and set the window size by changing Width to the width you want the window to be and the Height to the height you want to window to be. For the text go into the Font tab and set the text size to an option already there or input a custom one by clicking in the box that tells you the size selected and type in your own. Then press enter. This will close the properties. You must do this or it will go to the nearest option to your custom size. Now simply run the shortcut instead of running said program and it should have custom size and text.

Can I make emacs grep windows just use the other window to open files in?

I've got emacs in front of me.
I've run a find-grep, and it's got many hits, which are displayed in a window. The file names are displayed in green as hyperlinks.
I make that the only window, with C-x 1.
If I click on a file name, the window splits vertically, and the file with the found text is displayed in the other window.
If I click on further filenames, then the new file replaces the old file, which is what I want to happen.
So far, so good...
However if I resize the windows, then emacs will periodically (when I click) split one of the two windows again, rendering the display difficult to read. It will then cycle opening new files between the two new windows. Occasionally it will open more windows and make the situation worse. If I close any of these new windows they just get reopened again.
In fact sometimes this perverse behaviour happens even if I don't resize anything. It just seems to happen more often if I do.
I would like emacs to stop buggering around and just have one find-grep window and one 'display' window, and always replace the display window with the new file. I would also like to be able to set these windows to the sizes that seem most convenient.
Is there any way to achieve this?
Or can anyone point me to an essay on how the whole (replace the contents of this window/replace the contents of a different window/create another window by splitting) thing works, so I can go and hack it sane.
Short fix:
Try doing this
(setq split-height-threshold nil
split-width-threshold nil)
This will prevent Emacs from splitting windows automatically (horizontally or vertically). This might be undesirable in other situations, but this should do the job. Try it for a week or so and see if it disrupts your flow.
Also, I found that if the point was in one of the windows, and I clicked on a link, the file opened up in the next window (if any).
So, if you want to make the file open in the right window (when you have more than one window), you can ensure that the point is in the window before the window you want.
Longer answer:
OK. I was able to reproduce the problem. The thing is the window showing the files is pretty big (wide or tall) because you resized it and Emacs sees that the width or height is greater than the respective threshold and splits it likewise. So, we have to either make the threshold higher or disallow the behaviour completely.
And, just to answer the last few questions:
To get current window - (selected-window)
To get next window - (next-window)
To select a window - (select-window foo-window)
To get the buffer of the current window - (current-buffer)
To get the buffer of some window - (window-buffer foo-window)
To set a buffer for a window - (set-window-buffer foo-window bar-buffer)
I'm sure you can hack together decent window/buffer management functions using these functions.
You can use C-h f to get more details on each of these functions.
Also check out the Elisp manual - http://www.chemie.fu-berlin.de/chemnet/use/info/elisp/elisp_26.html

Resize terminal from command?

I'm using cygwin but, is it possible to resize the terminal window via a command rather than doing it myself every time I open it? Some scripts I want to be a certain size for my own benefit.
The 'CSI t' sequence can be used for that on xterm-compatible terminals. Search https://invisible-island.net/xterm/ctlseqs/ctlseqs.html for XTWINOPS for details.
For example, to resize to 50 rows and 80 columns.
echo -ne '\e[8;50;80t'
This works for me on bash.exe :
mode.com 80,50
to set 80 columns and 50 rows.
Note that mode and mode.com are not the same in this case.
You can't resize the default terminal, since it's just windows' native 'cmd'. Alternatively, I saw this new addition of late: http://georgik.sinusgear.com/2011/11/23/mintty-resizable-terminal-for-windows/. Not particularly sure whether you can resize that reminal from commandline though. It's still a windows console application.

Changing CMD window properties programmatically

How can I change the appearance of my current CMD window?
I know there is a 'mode' and 'color' commands that give you some control, but it's not enough...
Is it possible to change Screen Buffer Size separately? To turn QuickEdit mode on/off?
Is there an API for this?
Search engines are amazing things :).
Search for Windows Console API and the 2nd link is: this. Digging in a tiny bit more and you find the interestingly named "SetConsoleMode" and "SetConsoleScreenBufferSize" APIs which appear to set the console mode (which includes quick edit mode) and screen buffer size.
I've not used the APIs so I don't know if there are any caveats, but from the documentation, these seem to be what you're looking for.
another way: use reg /? to query your registry for reg query HKEY_CURRENT_USER\Console. There you can see keys like ScreenBufferSize etc. Use reg to delete the key and add it back with new values. Type reg /? on the command line to see its help usage. make sure you backup registry before trying.

Reuse Edit Control as Command Window

This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such:
Name of favorite porn star:
The user should be able to enter text after the prompt like such:
Name of favorite porn star: Raven Riley
But I need to prevent the user from moving the cursor into the prompt area. Users should also be prevented from backspacing into the prompt in order to prevent the following:
Rrraven Rrrileeey Ruuuulez!!! Name of favorite porn star:
Also need to control text selection and so on. And finally, I should have no problem retrieving only the text the user entered (minus prompt text).
Will it be better to create my own window class from scratch (i.e inherit from CWnd) or should I reuse the Windows EDIT control (i.e. inherit from CEdit)?
A similar command window can be seen in AutoCAD and Visual Studio (in debug mode).
I think you'd be better off creating a subclass of CEdit and limiting filtering key-presses. I suppose the hard part is not letting the user move the caret to the prompt area, but you can probably write some code to make sure the caret always get sent back to where it belongs (the input part).
Anyway, if you really, really want to implement your own control (it's not that difficult after all) I recommend you read Jacob Navia's "technical documentation" on how he built the LCC compiler and environment. Actually, it seems the docs are not online anymore, but I'm sure you can get them through his e-mail (jacob#jacob.remcomp.fr).
Edit: I liked your previous example better. Keep it classy, LOL :)
I had a very similar requirement and did exactly what davidg suggested; subclassed a edit control and filtered key presses. This was actually using Qt not MFC but the principle will be exactly the same.
You need to remember to filter keys such as home as well as left and backspace. I just checked to see if the move would move the caret into the prompt and if it did ignored the keypress.
Another thing to watch for is pasting multiline text, you will have to choose whether to just paste the first line or all lines, adding the prompt on all lines after the first. When subclassing the control you get lots of behaviour which won't work exactly as you want it.

Resources