topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 12:50 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Put In brackets  (Read 12108 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Put In brackets
« on: January 08, 2013, 03: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

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #1 on: January 08, 2013, 11:35 AM »
Code: Autohotkey [Select]
  1. ^!#4::
  2. {
  3.     Send, ^c
  4.     ClipWait, 5
  5.     Clipboard := "*" . Clipboard . "\"
  6. }
  7. Return

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #2 on: January 08, 2013, 02:28 PM »
Code: Autohotkey [Select]
  1. ^!#4::
  2. {
  3.     Send, ^c
  4.     ClipWait, 5
  5.     Clipboard := "*" . Clipboard . "\"
  6. }
  7. Return

Oh my God!!!!!!!!

Running to try
Best Regards
 :-*

Contro

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

"this is the text"


"this is the text"


Don't go. What am i doing bad

#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,832
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #4 on: January 08, 2013, 05: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



Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #5 on: January 08, 2013, 05: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,629
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #6 on: January 09, 2013, 01: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:

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: Put In brackets
« Reply #7 on: January 09, 2013, 03: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,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #8 on: January 09, 2013, 05: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
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #9 on: January 09, 2013, 05: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,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #10 on: January 09, 2013, 06:04 AM »
 ;D

I am going to live in other planet

 :P

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #11 on: January 09, 2013, 06:53 AM »
This would copy the result back, replacing the selected string by the new, bracketed, string:
((c) Skwire)
Code: Autohotkey [Select]
  1. ^!#4::
  2. {
  3.     Send, ^c
  4.     ClipWait, 5
  5.     Clipboard := "*" . Clipboard . "\"
  6.     ClipWait, 5
  7.     Send, ^v
  8. }
  9. Return
"this is the text" <Select between quotes, Press ctrl-win-alt-4> -> "*this is the text\"  8)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #12 on: January 09, 2013, 07:34 AM »
 :)
Seems easy.
I will try right now

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #13 on: January 09, 2013, 08:03 AM »
 :-[

Nothing happen in my keyboard.
 :(

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #14 on: January 09, 2013, 01: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)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #15 on: January 09, 2013, 04: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,940
    • View Profile
    • Donate to Member
Re: Put In brackets
« Reply #16 on: January 10, 2013, 12:44 AM »
Ath I am having some sort of problem I am trying to repair :

https://www.donation...?topic=33623.new#new

We'll continue
 :(