Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Paste to command prompt


  • Please log in to reply
12 replies to this topic
murple
  • Guests
  • Last active:
  • Joined: --
Hey,

I just found a great windows explorer extension at Codeproject called The Command Prompt Explorer Bar. With that installed, hitting Ctrl+M when in explorer splits the explorer-window so part of it shows the folder contents and part of it shows a command prompt opened at the current location. Clicking around in the graphical tree folder hiearchy also sends cd commands to the command prompt so the two windows stay synchronized. It's fabulous stuff:
Posted Image


I started to think about what a hassle it is, not being able to use Ctrl+V to paste text into command prompts and discovered there are some alternatives such as Alt+SPACE, E, P which brings up an E&dit -> P&aste menu.

I made a simple AutoHotkey script which lets the user type Win+V for paste: (More similar to Ctrl+V and faster than Alt+SPACE, E, P)

#V::send !{SPACE}EP

This works like a charm as long as the command prompt is not full screen. If you're in a full screen command prompt though, hitting the Win-key (for Win+V) will bring you out of full screen. The command will still work though, so when you maximize the command prompt window the text will have been pasted, but it's still way too much of a hassle to be practical. I'm sure it's possible to maximize the command prompt right afterwards, but that would probably result in an extremely annoying flicker.

Are there any good workarounds for this? I've thought of something like:
screenupdate=false
paste text
maximize command prompt
screenupdate=true

but that's ugly and to my knowledge there is nothing that can "freeze" the screen this way. I also thought of taking a screenshot, then filling the screen with that screenshot, paste the text and maximize the command prompt "behind the screenshot" and then remove it, i.e. use a screenshot like a screen-curtain, but that's even uglier.

How can this be accomplished?

P.S. Is AutoHotkey ready for Vista??


Cheers,
Murple

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Why is this topic in the Scripts & Functions section?
Beside that, I should try this bar, at work I often have to use the command prompt and using this should ease the navigation.
Two shortcuts on the cmd that you (or somebody else reading this) might not know (might need some registry tweaking or option setting): Tab autocomplete the file name or dir name you started typing, cycling among the possible candidates; and right-click copy the current selection to clipboard (you might also want to activate Fast Edit Mode and Insertion Mode) if something is selected, and paste the textual content of the clipboard if nothing is selected.
Simulating a right-click with AHK in the window client area also works.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Dippy46
  • Members
  • 171 posts
  • Last active: Aug 17 2007 06:53 AM
  • Joined: 06 Jul 2004
@murple

Normally in a console window once focused, you can right click and paste, so should work if their console is standard create process.

Regards
Dave
Simple ideas lie within reach, only of complex minds

Murple
  • Guests
  • Last active:
  • Joined: --
Sorry for posting in the wrong category, I spent so much time on that entry that I didn´t give any thought to the category I was posting in.

Right-clicking to paste in the command prompt is fine, it would just be nice to have a surefire way of using Ctrl+V or Win+V instead. I´ll try to simulate right-clicking thoug. Thanks,

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
#IfWinActive ahk_class ConsoleWindowClass

^v::Send %ClipBoard%


JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004
^v::SendInput %ClipBoard%
...is bad...if you have "#Test" in the clipboard it won't send the pound...this is better...
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Isn't using Send quite slow? Pasting directly seems better.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005

Isn't using Send quite slow? Pasting directly seems better.

It was the point: selecting Paste terminates full screen mode. If you don't use that, there is no problem with pasting.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Aaah...
I never use such program in full screen mode, the mouse seems disabled here... It is too big and ugly on my LCD screen anyway.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Murple
  • Guests
  • Last active:
  • Joined: --
This forum is fantasticly active and helpfull. Thanks a lot to all three of you. I´m definetly going to implement some of this.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005

^v::SendInput %ClipBoard%
...is bad...if you have "#Test" in the clipboard it won't send the pound

Just add {RAW} after SendInput, if you ever need to paste the AHK reserved characters.

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006

I just found a great windows explorer extension at Codeproject called The Command Prompt Explorer Bar.

I've to register there to be able to download it. :?

  • Guests
  • Last active:
  • Joined: --
Google it.