Send ^v does not work

Get help with using AutoHotkey and its commands and hotkeys
Wigi
Posts: 60
Joined: 05 Jun 2017, 10:52
Contact:

Send ^v does not work

15 Aug 2018, 08:10

Hi all,

I have an issue with pasting the clipboard. My code to comment other code with Ctrl-k almost works but pasting the result gives incorrect output.
I have this code:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



So for example. Change this:

Code: [Select all] [Download] GeSHi © Codebox Plus

   If( DimensionExists( pDim ) > 0 );

vDim = Dimnm( '}Dimensions', Dimix( '}Dimensions', pDim ));
DimensionElementInsertDirect( vTempDimForDims, '', vDim, 'N' );

ElseIf( CubeExists( pDim ) > 0 );


to:

Code: [Select all] [Download] GeSHi © Codebox Plus

#   If( DimensionExists( pDim ) > 0 );
#
# vDim = Dimnm( '}Dimensions', Dimix( '}Dimensions', pDim ));
# DimensionElementInsertDirect( vTempDimForDims, '', vDim, 'N' );
#
# ElseIf( CubeExists( pDim ) > 0 );


# is the commentary sign in the program at hand.

With msgbox I can see that the clipboard is fine but pasting the result fails. The result does not include the # character and removes spaces.

See 3 pictures attached please.

Wim
Attachments
03.png
03.png (4.35 KiB) Viewed 108 times
04.png
04.png (13.59 KiB) Viewed 108 times
05.png
05.png (4.14 KiB) Viewed 108 times
Rohwedder
Posts: 1283
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Send ^v does not work

15 Aug 2018, 09:15

Hallo,
you have not given function CountLines()
Wigi
Posts: 60
Joined: 05 Jun 2017, 10:52
Contact:

Re: Send ^v does not work

15 Aug 2018, 11:46

Hello,

I will add it later today. But msgbox just before pasting the clipboard confirms the contents of the clipboard. See the image. I’m surprised that it does not paste correctly.
swagfag
Posts: 1089
Joined: 11 Jan 2017, 17:59

Re: Send ^v does not work

15 Aug 2018, 11:54

this is what ur else branch produces for me

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



this is a way to write # before each line:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Wigi
Posts: 60
Joined: 05 Jun 2017, 10:52
Contact:

Re: Send ^v does not work

15 Aug 2018, 12:33

Great, I will adapt and test. Thanks
Wigi
Posts: 60
Joined: 05 Jun 2017, 10:52
Contact:

Re: Send ^v does not work

16 Aug 2018, 01:46

Hi,

Here is that custom function:

Code: [Select all] [Download] GeSHi © Codebox Plus

CountLines(Text)
{
StringReplace, Text, Text, `n, `n, UseErrorLevel
Return ErrorLevel + 1
}
Wigi
Posts: 60
Joined: 05 Jun 2017, 10:52
Contact:

Re: Send ^v does not work

16 Aug 2018, 04:03

Many thanks both !

In fact, I missed a Return command and subsequent coding was pasting the text without spaces and such. My bad.

Here is the code to comment (Ctrl-k) and Uncomment (Ctrl-k). You have to select the text first before launching the hotkey.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: anobayan, shgilad81 and 80 guests