Custom text wrapping script

Post a reply


In an effort to prevent automatic submissions, we require that you type the text displayed into the field underneath.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Custom text wrapping script

Re: Custom text wrapping script

Post by kkwillmert » 19 Sep 2017, 14:12

carno wrote:I would like to see the hotkey you wrote that utilizes this script. Please post that too with an example how to do it.


Here you go! I'm using this in Windows 10, not sure how well it will behave for other OS's.

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



So with this hotkey set up, you could highlight all of this text...

Code: [Select all]GeSHi © Codebox Plus

/* **************************************************************************************************

This is a code header comment:

This is a really long purpose that has lots of text and stuff and is going to be way super long so that i will want it to wrap because i am writing an autohotkey for wrapping text and in order to wrap text i need some super long text to test the routine on because i need to know if it's actually working the way i want or not and stuff.

************************************************************************************************** */


...then hit Ctrl + Shift + W, and it would paste over it with this text:

Code: [Select all]GeSHi © Codebox Plus

/* **************************************************************************************************

This is a code header comment:

This is a really long purpose that has lots of text and stuff and is going to be way super long so
that i will want it to wrap because i am writing an autohotkey for wrapping text and in order to wrap
text i need some super long text to test the routine on because i need to know if it's actually
working the way i want or not and stuff.

************************************************************************************************** */


In this type of comment format, you can also use the hotkey to re-do the wrapping on the text after you make an edit.

Re: Custom text wrapping script

Post by kkwillmert » 19 Sep 2017, 14:02

Helgef wrote:Maybe add msgbox % wrappedText after Gosub , WrapText in the example.


Done :-)

Helgef wrote:Note:
wrappedText would be: "C:\Games\`nGuild`nWars\`nGW.exe"
actually becomes C:\Games\`nGuild Wars\GW.exe


Thanks for catching that, that's the OP's example and I didn't actually test it out :oops: . I'm not sure if I broke his multiple character set functionality when I fixed up the script to work in current AutoHotkey versions, or if it didn't work to begin with, but unfortunately I won't have the time to figure it out for a while :-(

Re: Custom text wrapping script

Post by carno » 17 Sep 2017, 22:09

I would like to see the hotkey you wrote that utilizes this script. Please post that too with an example how to do it.

Re: Custom text wrapping script

Post by Helgef » 14 Sep 2017, 16:42

Nice, thanks for sharing :thumbup:
Maybe add msgbox % wrappedText after Gosub , WrapText in the example.
Note:
wrappedText would be: "C:\Games\`nGuild`nWars\`nGW.exe"
actually becomes C:\Games\`nGuild Wars\GW.exe

Cheers.

Custom text wrapping script

Post by kkwillmert » 14 Sep 2017, 16:00

In my search for a script that would help me write a hotkey to wrap highlighted text (for use in code header block comments), I stumbled across an old script by Gehn in the archived forums: https://autohotkey.com/board/topic/2459-custom-text-wrapping-script/

Unfortunately, the script doesn't work on the current AutoHotkey version, I think probably because it uses array-style reference syntax (square brackets) in pseudo-array variable names within function calls (e.g. StringLen), which I'm guessing probably worked prior to the implementation of associative arrays (see https://autohotkey.com/docs/misc/Arrays.htm).

But I really wanted it, so I took the time to correct the bugs and spruce it up a bit. Since this took me most of a day and I found it pretty useful, I thought I should share (see below) :D

Suggested improvements would be appreciated. If anyone is interested in seeing the hotkey I wrote that utilizes this script, I can post that too.

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


Top