How to send a new line without using `n `r? without an enter - variables

i know that n means "ENTER", but when i'm using n, i dont want to press enter. I just want to put the text in a new line, but what "n" does, it puts in a new line but it also press enter.. i don't want to press enter...
For example
::pergunta::Hello, n How are you? n what are you doing? n bye...
How can i fix that issue?

First, you need to determine what keystrokes your application uses for this purpose, and then you can implement that in Autohotkey.
For example, in Excel, multiple lines of text can be typed into a single cell by pressing ALT-ENTER at the end of each line (instead of ENTER).
So, the following AutoHotkey script would work for Excel:
:X:pergunta::Send, Hello,!{Enter}How are you?!{Enter}what are you doing?!{Enter}bye...
The ":X:" at the beginning means "run a script", which in this case is the "Send" command. The !{Enter} part means ALT-ENTER.
You might also want to use SetKeyDelay to speed up the typing of text:
SetKeyDelay, 0
:X:pergunta::Send, Hello,!{Enter}How are you?!{Enter}what are you doing?!{Enter}bye...

Related

Find and Replace/Insert 'CR', del Space wherever a user Clicks in a Word document

Short Version
In MS Word, is there a way to insert some text and remove some(simultaneously) at the point of blinking cursor or wherever a user clicks repeatedly.
This (Insertion/Deletion) can be achieved in the following ways:
Mouse click
(Ctrl, Alt or Shift) + Mouse click
Ctrl/Alt/Shift+Mouse click + (Any Key)
Long Version
I have text copied from various sources in different word files which I want to format in a particular style so as to match a given layout. Basically the text needs to be broken down into new lines/paragraphs at specific places which is given in the instructions. Instead of having to press 'Enter' and then remove/delete spaces at every line, I wish to do that with just one click per line using macro.
These files could be 500+ in number, so modifying all in one go using Macros is the preferred way.(Although I find it impossible when the point of insertion of 'Enter' can only be done manually on each file.) I have used Macros to achieve 90% of that however need one last step where a Macro can do the following:
Where ever the user clicks on the page, all space(regular, non-breaking space, white-space) until the next printed character is deleted.
An 'Enter' or Carriage-Return is inserted, so that the text moves to the next line.
Steps 1 and 2 are repeated at every click the user makes on the text.
Example Text
This is an example, of my text, which I need to split up, into different lines.
Expected Text
This is an example, of my text,
which I need to split up,
into different lines.
Notice that as 'Enter' is pressed at the end of these lines although they come in next line but usually a space character is there in front of those lines. Another approach is to click, delete the required spaces until the next character and then hit enter. I want either of these to be done automatically with just a mouse click or a minimum of key+mouse combo.
Something like Find ^w and Replace with ^p running at every place a user clicks, but with Macros.
Any help is appreciated.
This would be possible by defining a shortcut to your macro. So you would need to click at a position and use your shortcut to run the macro.
Eg. Add this to a module in your document
Option Explicit
Public Sub DeleteSpacesAndInsertEnter()
Application.ScreenUpdating = False
Selection.SetRange Selection.Start, Selection.Start + 1
If Asc(Selection.Text) = 32 Or Asc(Selection.Text) = 160 Then
Do While Asc(Selection.Text) = 32 Or Asc(Selection.Text) = 160
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeBackspace
Selection.SetRange Selection.Start, Selection.Start + 1
Loop
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
End If
Application.ScreenUpdating = True
End Sub
and assign a shortcut to it.
It deletes all spaces & non breaking spaces right from the current cursor position and then inserts an enter.
Earlier, I thought of using Find and Replace at the place of cursor, Finding ^w and Replacing with ^p but this required me to Constantly lift the shortcut keys I assigned with my macro, otherwise it would just break the complete text at every word into paragraphs. Just pressing Ctrl and click would highlight the text between cursor and mouse click. All in all, I had to press (Ctrl+D), move the cursor to the new point using Click, AGAIN press Ctrl+D. Thus lifting 3 fingers for every change, making it impractical.
Pᴇʜ Macro helped
Ctrl+D+Click still doesn't work seamlessly. Works in 3 steps repeating.
Alt+D+Click worked almost flawlessly, with just one step repeating.
Applying this macro, even if I keep Alt+D(my shortcut) pressed all the time, simply clicking at the desired place does my job. Although Alt + Click anywhere in Word 2007 brings up a Research Window which updates as the text is clicked but in no way interferes with the job being done.
Thanks a lot everyone and especially P for all your help, really appreciate it.
Cheers

In TOAD, is there a way to comment out arbitrary blocks of code (i.e not whole lines)?

The shortcut to comment out code in TOAD (11.6.16) is CTRL+B
However, the problem is that it does not let you comment out an exact selection within a block of code. So, when I press CTRL+B it simply comments out all the lines of the code , so I can't comment out a specific column with /* .. */ via keystroke.
Is there a way to run the arbitrary /* .. */ commenting ?
Not exactly, but you can get there by a lesser known feature. The Search and Replace macro. In the Editor hit Ctrl+R to get to the replace dialog. On the toolbar click the right-most button to get to the macro editor. Copy the entire contents, below, and paste into that dialog within the left side tree. It'll create a macro for you that I made. Hit close, etc. to get out of that dialog. Now, in the editor whenever you make your selection you can invoke this by using the little dropdown next to the replace button on the Editor toolbar. It's not exactly as easy as using keyboard shortcut, but it works and Search/Replace macros are super powerful for more complex work. Here's the dropdown I'm referring to.
Here's the code to copy/paste. Grab everything from (and including) "object" through to (and including) the "end"
object TComponentCollection
Items = {
545046300F5474645265706C6163654D6163726F000B446973706C61794E616D
65060D436F6D6D656E7420426C6F636B0D49676E6F72654661696C757265080A
4D6163726F47726F7570080C5365617263684F726967696E070D736F456E7469
726553636F70650C577261705365617263686573080F50726F6D70744F6E5265
706C616365080A5465787446696E6465720A9C000000545046300F5474645465
78745265706C61636572000D4361736553656E7369746976650811526567756C
617245787072657373696F6E090A5365617263685465726D0606283F73292E2A
0F536561726368446972656374696F6E07097364466F72776172640A57686F6C
65576F726473080B5265706C6163655465787406062F2A24302A2F135265706C
6163655769746854656D706C617465080000054974656D730A32000000545046
301F547464437573746F6D5365617263685265706C6163654D6163726F4C6973
7400054974656D730A0000000000000000}
end

Run macro at key press - Space key

I have a Word 2013 Macro which quickly runs a simple spell check dialogue.
I want to run it every time I type a word.
One way of doing this is by running the macro every time I press space.
Therefore, I tried to use the Options>Customize Ribbon>Keyboard Shortcuts method but that did not work for the space key.
How can I run a macro every time press the "space" key?
Thank you in advance.
You should be able to do this using KeyBindings. I've not tried it with spacebar specifically, but I use this with tab, backspace, etc. The basic idea is:
in a sub that you run at startup or document open:
'This line may differ depending on whether you are running this from a document template or an add-in.
Application.CustomizationContext = ThisDocument.AttachedTemplate
' Create the keybinding.
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeySpacebar), KeyCategory:= _
wdKeyCategoryMacro, Command:="MyMacro"
Then make sure your macro is named to match whatever you put in Command.

How to select all instances of a variable and edit variable name in Sublime

If I select a variable (not just any string) in my code, all other instances of that variable get a stroke (white outline) around them:
Is there a keyboard shortcut that will let me select all of those instances of the variable and edit them all at once?
Things I've Tried:
⌘D, ⌘K, and ⌘U lets me select them one-by-one, but I have to manually exclude the non-variable string matches:
And using Ctrl⌘G simply selects all the string matches:
Clearly, Sublime is able to differentiate between variable and string matches. Is there no way to select just the variable matches?
Put the cursor in the variable.
Note: the key is to start with an empty selection. Don't highlight; just put your cursor there.
Press ⌘D as needed. Not on a Mac? Use CtrlD.
Didn't work? Try again, making sure to start with nothing selected.
More commands:
Find All: Ctrl⌘G selects all occurences at once. Not on a Mac? AltF3
Undo Selection: ⌘U steps backwards. Not on a Mac? CtrlU
Quick Skip Next: ⌘K⌘D skips the next occurence. Not on a Mac? CtrlKCtrlD
Sublime Docs
I know the question is about Macs, but I got here searching the answer for Ubuntu, so I guess my answer could be useful to someone.
Easy way to do it: AltF3.
Despite much effort, I have not found a built-in or plugin-assisted way to do what you're trying to do. I completely agree that it should be possible, as the program can distinguish foo from buffoon when you first highlight it, but no one seems to know a way of doing it.
However, here are some useful key combos for selecting words in Sublime Text 2:
Ctrl⌘G - selects all occurrences of the current word (AltF3 on Windows/Linux)
⌘D - selects the next instance of the current word (CtrlD)
⌘K,⌘D - skips the current instance and goes on to select the next one (CtrlK,CtrlD)
⌘U - "soft undo", moves back to the previous selection (CtrlU)
⌘E, ⌘H - uses the current selection as the "Find" field in Find and Replace (CtrlE,CtrlH)
This worked for me. Put your cursor at the beginning of the word you want to replace, then
CtrlK, CtrlD, CtrlD ...
That should select as many instances of the word as you like, then you can just type the replacement.
The Magic is, you have to start with an empty selection, so put your cursor in front of the word/character you want to multi-select and press Ctrl+D .
To me, this is the biggest mistake in Sublime. Alt+F3 is hard to reach/remember, and Ctrl+Shift+G makes no sense considering Ctrl+D is "add next instance to selection".
Add this to your User Key Bindings (Preferences > Key Bindings):
{ "keys": ["ctrl+shift+d"], "command": "find_all_under" },
Now you can highlight something, press Ctrl+Shift+D, and it will add every other instance in the file to the selection.
As user1767754 said, the key here is to not make any selection initially.
Just place the cursor inside the variable name, don't double click to select it. For single character variables, place the cursor at the front or end of the variable to not make any selection initially.
Now keep hitting Cmd+D for next variable selection or Ctrl+Cmd+G for selecting all variables at once. It will magically select only the variables.
It's mentioned by #watsonic that in Sublime Text 3 on macOS, starting with an empty selection, simply ⌃⌘G (AltF3 on Windows) does the trick, instead of ⌘D + ⌃⌘G in Sublime Text 2.
At this moment, 2020-10-17, if you select a text element and hit CTRL+SHIFT+ALT+M it will highlight every instance within the code chunk.
Just in case anyone else stumbled on this question while looking for a way to replace a string across multiple files, it is Command+Shift+F

Make IntelliJ reformat the current line on line-completion

Is there a way to have my line reformatted upon completing it in IntelliJ? (For those familiar, this kind of feature is available on FlashDevelop.)
Let's says I just entered this code in PHP:
$var=array("a","b","c");
Upon entering the semicolon, I would like the editor to reformat it to (or whatever my configuration states):
$var = array("a", "b", "c");
This auto-reformat trigger could also be executed on brackets and other line-terminators characters.
There is no such feature in IDEA. You can use Reformat Code (Ctrl + Alt + L) action when needed.
You can actually do something like.
Go to where you want to insert ;
Tools/Start Macro Recording
Type in ;
Then select Code/Auto Indent Lines
Tools/Stop Macro Recording
Name the macro "reformat"
Now go to settings, Keymap, Macros, select "reformat"
Assign a keyboard shortcut of ;
You may have to play with it a bit to get your cursor in the right spot after the macro runs.
This is based on jhormans answer above and i know that the question is more than 6 years old. But IntelliJ IDEA 2017.1.5 still does not have a feature that automatically reformats the current line when semicolon is pressed like VisualStudios.
The workaround is to create a macro as described by jhorman but after pressing ';' run Code -> Reformat Code. Then stop recording and under Settings/Keymap/Macros add the shortcut "Shift+Comma" to the macro. Now when typing the semicolon by pressing Shift + Comma in the code, the code will be reformated aswell. The only shortcoming: the whole code will be reformated each time Shift+Comma is pressed. This may take a second on large files.
This workaround will only work if you just have one line terminator like semicolon. To automatically reformat the code on multiple line terminators (closing brackets, semicolon, ...) you would need to add the shortcuts to "Settings" -> "Keymap" -> "Main Menu" -> "Code" -> "Reformat Code" directly. In this case there's no need to create a macro.
Just formatting the current line isn't possible as far as i know.