DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Put In brackets  (Read 15,694 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Put In brackets
« on: January 08, 2013, 09:03 AM »
:-*
I would a little script for a simple purpose.
I select a phrase and with a hotkey i am able to put a character before the phrase and other after

Example :

I want to eat


I apply the hotkey control+alt+win+4 and obtain

*I want to eat\


Is it possible ?

:-[

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: Put In brackets
« Reply #1 on: January 08, 2013, 05:35 PM »
Code: (autohotkey)
^!#4::
{
    Send, ^c
    ClipWait, 5
    Clipboard := "*" . Clipboard . "\"
}
Return

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #2 on: January 08, 2013, 08:28 PM »
Code: (autohotkey)
^!#4::
{
    Send, ^c
    ClipWait, 5
    Clipboard := "*" . Clipboard . "\"
}
Return

Oh my God!!!!!!!!

Running to try
Best Regards
:-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #3 on: January 08, 2013, 11:27 PM »
I come to see....

"this is the text"


"this is the text"


Don't go. What am i doing bad

Code
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
^!#4::
{
    Send, ^c
    ClipWait, 5
    Clipboard := "*" . Clipboard . "\"
}
Return

:-*

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,840
    • Coding Snacks
Re: Put In brackets
« Reply #4 on: January 08, 2013, 11:46 PM »
are you selecting the text before you fire the hotkey, or just entering the text?

if you don't select the text there's nothing to copy so no changes are made...

do you also realise that the 'answer' is in the clipboard? You have to paste it in order to see the change


Alcohol is photoshop, bottled
Askhole - someone who ask for advice, then ignores it
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #5 on: January 08, 2013, 11:54 PM »
First I select the text "this is the text" and hit the hotkey control+alt+win+4 (ejem, 4 from the numerical keypad ?)
then paste

"this is the text"

nothing happen.
:-[

Repeat now with 4 from the alpabhetical keypad

~~~"this is the text"

~~~"this is the text"

and happen that
:huh:

But even i have additionally to control+V
I think is better select the text, hit the hotkey and obtain in his place the converted chain.

:-*

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: Put In brackets
« Reply #6 on: January 09, 2013, 07:12 AM »
I think is better select the text, hit the hotkey and obtain in his place the converted chain.
You won't be able to paste the text back into a web-browser, if you selected something there. (Or at least with some undesired by-effects)

Oh, I just copy/pasted and run Skwire's script and it works like a charm :Thmbsup:
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

Renegade

  • Tell me something you don't know...
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
    • Participated in NANY Challenge Three Times
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Re: Put In brackets
« Reply #7 on: January 09, 2013, 09:09 AM »
This finally got me to try out AutoHotkey... damn! It's pretty cool! That's so simple & fast. i.e.:

*That's so simple & fast.\

:D
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #8 on: January 09, 2013, 11:06 AM »
But that is not my purpose.

you have to go to other line and the target is format the selected line.
>:(

PhilB66

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,522
Re: Put In brackets
« Reply #9 on: January 09, 2013, 11:18 AM »
Oh, look what you've done to Contro... now he is angry and will not be asking for your help any longer. You are bad,bad, bad, Renegade.  :D

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #10 on: January 09, 2013, 12:04 PM »
;D

I am going to live in other planet

:P

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: Put In brackets
« Reply #11 on: January 09, 2013, 12:53 PM »
This would copy the result back, replacing the selected string by the new, bracketed, string:
((c) Skwire)
Code: (autohotkey)
^!#4::
{
    Send, ^c
    ClipWait, 5
    Clipboard := "*" . Clipboard . "\"
    ClipWait, 5
    Send, ^v
}
Return
"this is the text" <Select between quotes, Press ctrl-win-alt-4> -> "*this is the text\"  8)
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #12 on: January 09, 2013, 01:34 PM »
:)
Seems easy.
I will try right now

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #13 on: January 09, 2013, 02:03 PM »
:-[

Nothing happen in my keyboard.
:(

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: Put In brackets
« Reply #14 on: January 09, 2013, 07:48 PM »
Nothing happen in my keyboard.
Hm, got something else taking that hotkey? Or does pressing the Win button require to also press another button like <Fn>, on some laptop keyboards?
You could replace the hotkey definition of ^!#4 by something simpler like ^4 so only Ctrl-4 needs to be pressed, just for testing.

Btw, what application is active when you apply the hotkey, after you have selected some text? (I've been testing with the forum-message 'Quick Reply' input-box of my browser)
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #15 on: January 09, 2013, 10:00 PM »
thanks Ath.
May be. I am having problems with dancing clips in Ditto. I don't know why.
I'll modify the hotkey and comment.
Best Regards

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Put In brackets
« Reply #16 on: January 10, 2013, 06:44 AM »
Ath I am having some sort of problem I am trying to repair :

http://www.donationcoder.com/forum/index.php?topic=33623.new#new

We'll continue
:(

Original address: https://www.donationcoder.com/forum/index.php?topic=33605.0