I can't enter text via the command line, is it possible to do this? - autocad

When you try to automatically enter the desired content (and there will be a lot of such objects with text content and I would prefer to avoid entering all the necessary data manually), the input field moves from the console to the area highlighted with a red rectangle, which makes it impossible to automatically create signatures.
The question is, is it possible to make the input field of the desired content always remain on the command line?
enter image description here
I tried to find the question on the Internet by entering the corresponding queries in Russian, nothing gave results

I understand that by "automatically" you mean copying and pasting from some editor to the AutoCAD command prompt.
I will never work that way, you must use a programming language and I think the easiest thing is to use AutoLISP.
Try copying and pasting this:
(command "_mtext" "36,0" "42,0" "your text here" "")
and note the empty string at the end "" that finalises the MTEXT command.

Related

Sublime Text disable goto animation

When using the goto function to bring my cursor to a particular line number, say 3017, how do I prevent Sublime from jumping around from line to line until I hit enter?
For instance, in that case, I would jump to the following lines:
3
30
301
3017 (finally)
Sublime Text 3 seems to have two "Goto Line" features:
one which is built in via the "Goto Anything" overlay. Internally, the command to execute this is show_overlay with the arguments {"overlay": "goto", "text": ":"}. This is the default, available from the Goto menu -> Goto Line, and with keybinding Ctrl+G. MattDMo is correct in his answer that it is not possible to disable fuzzy matching in this overlay.
one which is included in the "Default" package as a plugin and shows a small prompt panel at the bottom of the screen. Internally, the command to execute this is prompt_goto_line, with no arguments necessary. This implementation has the behavior you desire, and will only go to the specified line when you hit the enter key. It has no default way of accessing it, but read on... :)
The reason I have mentioned the internal commands above is because Sublime Text makes it possible to add or override keybindings, and also to change or add menu items, and the commands are used to instruct Sublime Text what action to perform.
Therefore, this means that you can choose to override the existing menu item and/or keybinding, (and/or you can create a new menu item and/or keybinding) to use the prompt_goto_line command. The two links I have just provided should give enough detail on how to perform these tasks, but if you would like more specific information, please let me know in a comment and I will provide it.
This feature is by design, and cannot be disabled. Most popup menus in Sublime feature "fuzzy matching", meaning you do not need to type the full search term, just a few letters (for example, pci finds Package Control: Install Package in the Command Palette). The menus also feature instant searching, which is what you are seeing. This means that you do not need to hit Enter to search, just start typing and the matches appear as you type.

Remove spaces from a string of text in clipboard

This is maybe a weird request but hear me out:
I have a huge database at my shop containing product codes, like 87 445 G 6 which I need to check for availability on a supplier's website. The problem is, the supplier's website consists of a web form in which I have to enter the code without spaces, so imagine that I have to manually delete spaces every time I paste a code or write it manually without.
I can't edit the database from which I copy the codes.
I wonder if some sort of plugin, script, or trick can be used directly in browser on the supplier's web form, or some software to modify how the windows clipboard works, maybe some option to copy text without spaces. Using Windows XP.
The OP has probably moved on, but for anyone else looking here, my approach was to tackle this from the windows clipboard side.
For background: I keep a list of my credit card info in Keepass. Sometimes (poorly coded) shopping cart checkout forms don't like spaces in between card numbers. I like storing them with spaces since it's easier to read off that way.
There's various Windows clipboard utilites out there, but it took me a while to find one that could do some processing on the clipboard contents and pasting it out - Clipboard Help and Spell
The program has a way to "save" a bunch of text transformations, and even assign the action to a hotkey.
For reference, my "Find and Replace" action is to find "\s" (without quotes) and leave the Replace textbox empty. "\s" will match whitespace character.
Use the javascript console
You could use the javascript console for your browser to edit the textarea after you paste.
Using Google Chrome (or Firefox)
Paste your text in the text area.
Right click the text area and click Inspect Element
Look at the id for the element
Now switch to the console view
then run these lines (making sure to replace with 'the-id' with your id)
var my_text_area = document.getElementById('the-id'); // Put your id in here
my_text_area.value = my_text_area.value.replace(/ /g,"") // Deletes just spaces
It's even simpler if you have access to jQuery:
$('#the-id').val($('#the-id').val().replace(/ /g, ""))
The replace function is simply using regular expressions to convert spaces to nothing. If you want to replace all whitespace (including newlines) you would use .replace(/\s/g,"").
For firefox, the names are the same but the UI is a little bit different.
Use greasemonkey
You can either write a greasemonkey plugin or try to find one that fits your needs.

How to create code box without rich text formatting

My question is related to this topic How to copy and paste code without rich text formatting? except its from the opposite viewpoint: I'm creating a document from PowerPoint in which I have code snippets in text boxes. I want to make the document as simple as possible by making the code snippet text boxes easy to copy and paste the code into a terminal to run without editing anything. However, the way I have it right now is that when I copy and paste it keeps the formatting and I have to go though letter by letter to erase the end of line symbols. How should I format this in PowerPoint?
You can get rid of most formatting by copy/pasting from PPT to Notepad and then copy/pasting from there to your terminal program, or if the latter has a Paste Special command, you should be able to paste as plain text, which'd get rid of formatting.
Line/Paragraph breaks are another matter. If the end of line symbols are the only formatting problem when you've pasted the text into a terminal (emulator program, I assume), it sounds as though the terminal's using CR or LF as a line ending, whereas PPT's using CR/LF pairs. It might only be necessary to reconfigure the terminal software to use CR/LF.
It's worth a look at this page on my site, where I explain what line and paragraph ending characters are used by different versions of PowerPoint in different situations.
Paragraph endings and line breaks
http://www.pptfaq.com/FAQ00992_Paragraph_endings_and_line_breaks.htm
Sorry, my mistake was not realizing that PowerPoint auto formats hyphens and quotation marks to make them stylized, and the terminal was not recognizing the symbols. All I did was type in a quotation mark/hyphen then copying that before I pressed the space bar after it to save the original formatting.

Capture user input by opening a text editor with content

From a bash script, I'd like to
Open the default text editor for current user
Paste a string $original_content in it
Once the user modifies the content then closes the text editor,
Capture the modified string into a variable $modified_content
Then save $modified_content to an $output_file
Google searches for capturing user input shows read which is not what I'm looking for.
Can someone point me to the right direction?
Thank you
This method should hopefully work for most editors:
#!/bin/bash
original_content="Your original content"
echo $original_content > /tmp/user_input.tmp
# For example:
# DEFAULT_EDITOR=/usr/bin/vi
$DEFAULT_EDITOR /tmp/user_input.tmp
modified_content=`cat /tmp/user_input.tmp`
echo $modified_content > /tmp/output_file
This script may be a little drawn out but it performs all the actions you wanted except for the pasting part, since you'd probably have to accommodate for all varieties of editors to properly "paste" a string. This script utilizes the benefit that calling most editors with a filename as a parameter opens that file for editing thereby "pasting" your $original_content in the editor.

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