If I insert the Hotstring into another program it is not fast enough and mixes sometimes keys on the right position or it lags. It happens when I am using a long text.
I am using:
:*:ex1::Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod t
empor incididunt ut labore et dolore magna aliqua. Ut enim ad minim venia
m, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commod
o consequat. Duis aute irure dolor in reprehenderit in voluptate velit es
se cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupida
tat non proident, sunt in culpa qui officia deserunt mollit anim id est l
aborum Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod t
empor incididunt ut labore et dolore magna aliqua. Ut enim ad minim venia
m, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commod
o consequat. Duis aute irure dolor in reprehenderit in voluptate velit es
se cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupida
tat non proident, sunt in culpa qui officia deserunt mollit anim id est l
aborum
And it will result in some errors or a longer waiting duration.
This works faster, but sometimes I get an error with double text if I press an Endchar like enter too fast, or I do some different things which I can't lay my finger on.
:*:ex2::
Clipboard = %text%
Send ^v
Exit
Also there is the Clipboard messed up (I think I can store it with an variable and refill it but I am using this Multi-clipboard from windows Windows+V)
Also I am updating the Autohotkey script with excel and it is much easier to use concatenate with the first example.
=IF(List1!B34<>"",(CONCATENATE(":",List1!C34,":",List1!A34,"::",List1!B34)),(CONCATENATE(";",List1!A34)))
So I can use in C something like *0
In A the shortcut and in B the actual text.
If there is nothing in the shortcut field, my headline is inserted in the code for a better overview.
Thanks
Try this
:*:ex1::
ClipSaved := ClipboardAll ; save the entire clipboard to the variable ClipSaved
clipboard := "" ; empty the clipboard (start off empty to allow ClipWait to detect when the text has arrived)
clipboard = ; copy this text:
(
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
)
ClipWait, 1 ; wait for the clipboard to contain data.
If (!ErrorLevel) ; If NOT ErrorLevel clipwait found data on the clipboard
Send, ^v ; paste the text
Sleep, 300 ; don't change clipboard while pasting! (Sleep > 0)
clipboard := ClipSaved ; restore original clipboard
VarSetCapacity(ClipSaved, 0) ; free the memory
return
If you often have to send such a complex or long text, you can create a function, for not repeating the whole code every time:
:*:ex1::
my_text =
(
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
)
Send(my_text)
return
Send(text){
ClipSaved := ClipboardAll
clipboard := ""
clipboard := text
ClipWait, 1
If (!ErrorLevel)
Send, ^v
Sleep, 300
clipboard := ClipSaved
VarSetCapacity(ClipSaved, 0)
}
See ClipboardAll and ClipWait
Related
Is there a solution for getting a useful vim diff with very long lines? The problem I have is that for example I have one long line in one file:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
In another file I have a line very similar, but I have two changes. I capitalize ipsum to IPSUM and Duis to DUIS.
Lorem IPSUM dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. DUIS aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
The problem is that now, when I compare these two files with :diffthis, vimdiff highlights everything between IPSUM and DUIS, and this is really useless to look at. I would like to just see highlighted LOREM and DUIS and their lowercase counterparts. Here is an image of what my vimdiff view looks like. Is there a way to achieve this?
The behaviour I want is actually the default diff view in pycharm. This image is from pycharm:
I found a plugin that does what I am asking for:
https://github.com/rickhowe/diffchar.vim
If I type the following into an fsx in Visual Studio Code
let longString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
and run F# interactive on it by highlighting and pressing Alt+Enter, the output in the interactive window is
- let longString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepte- ur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";;
val longString : string =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed "+[384 chars]
or as screenshot:
How can I tell the F# interactive window to display the full string? Is there a shortcut or else?
I am aware of this post, but as fas as I know this is different here because a string is not lazily-evaluated.
printfn will print it completely:
printfn "%s" longString
Alternatively, you can change the fsi object properties, for instance:
fsi.PrintWidth <- 1000;;
Also, you can use AddPrinter:
fsi.AddPrinter (fun (s:string) -> s)
Here is the documentation: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/fsharp-interactive-options#f-interactive-structured-printing
If it is just for testing/debugging:
If you are in VSC you can run your script interactively as you mentioned. You can take advantage of that by using the interactive terminal and typing (in said interactive terminal)
longString;;
//output
val it : string =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
This will then show the whole string and is in most cases sufficient (since you do not want to clutter your script with unnecessary outputs anyway).
I am trying to set the height of a UITextview and all works well until I try to format the text.
An example might be "/n" or using a line break with the Swift Multiline String Literals.
After that the Textview becomes scrollable with some sort of max height value.
Does formatting the text destroy the "self.overViewTxt.contentSize.height"?
Thanks.
#IBOutlet weak var overViewTxt: UITextView!
#IBOutlet weak var overviewTxtHC: NSLayoutConstraint!
overViewTxt.text = "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, \n sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
overviewTxtHC.constant = self.overViewTxt.contentSize.height
or
overViewTxt.text = """
Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
"""
UITextView has a unique property of calculating height automatically. You DON'T need to take the IBOutlet of constraint or do not give any fix HEIGHT constraint, rather than you need to disable it's scrolling property and then assign any text it will be automatically became of it's size.
Note: Make sure you give proper constraints, i.e., top, bottom, leading & trailing.
Try to update frame instead of using constraint:
overViewTxt.text = "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, \n sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
let overviewTxtHCSize = overviewTxtHC.intrinsicContentSize
overviewTxtHC.bounds.size = overviewTxtHCSize
I want to print large string in flutter but they are truncated.
Example, this is 1342 characters string:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad'); // minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
Only the top 1022 characters will be printed.
I try to use debugPrint and print functions but nothing.
What I can do?
That's due to VS Code truncating big strings, usually bigger than 1000 char of being printed at once.
You can try a little "hack" by splitting it into words and print each of it.
myLongString.split(' ').forEach((word) => print(" " + word));
You can also try to use the logging package, but probably it will experience the same problem when trying to print the whole string, since it is trying to stdout all at once.
you can use log(message) function.
How does Kentico calculate the length of inputted content in a text area on a form and how much value does it give to a line break? A line break is 2 characters according to my JavaScript calculation but seems like Kentico calculates it as being more than 2 characters.
Summary of problem:
I have a maximum length of 2500 set on a text area input on a form on my Kentico site.
I have entered some text into a this text area and with my JavaScript calculations (used to show how many characters the user has left) the character length is exactly 2500 (including line breaks and spaces) and so should therefore validate and send. However Kentico is failing my input saying that my max length has been exceeded. See below:
If I remove the line break and type some extra characters to bring my character calculation back up to 2500, the form sends without failing.
Test used that fails:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae
augue ac enim molestie scelerisque a id metus. Suspendisse purus
justo, iaculis quis accumsan ut, congue vitae mauris. Nunc luctus
vulputate scelerisque. Nullam ullamcorper porta elit, sed ornare lorem
placerat dictum. Sed quis enim quis nibh convallis sagittis nec vitae
felis. Sed porttitor, nibh et volutpat posuere, neque dui sollicitudin
sapien, at scelerisque lacus elit quis enim. Donec at metus lectus.
Sed quis enim quis nibh convallis sagittis nec vitae felis. Sed
porttitor, nibh et volutpat posuere, neque dui sollicitudin sapien, at
scelerisque lacus elit quis enim. Donec at metus lectus. Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Quisque vitae augue ac
enim molestie scelerisque a id metus. Suspendisse purus justo, iaculis
quis accumsan ut, congue vitae mauris. Nunc luctus vulputate
scelerisque. Nullam ullamcorper porta elit, sed ornare lorem placerat
dictum. Sed quis enim quis nibh convallis sagittis nec vitae felis.
Sed porttitor, nibh et volutpat posuere, neque dui sollicitudin
sapien, at scelerisque lacus elit quis enim. Donec at metus
lectus.Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque vitae augue ac enim molestie scelerisque a id metus.
Suspendisse purus jus
to, iaculis quis accumsan ut, congue vitae mauris. Nunc luctus
vulputate scelerisque. Nullam ullamcorper porta elit, sed ornare lorem
placerat dictum. Sed quis enim quis nibh convallis sagittis nec vitae
felis. Sed porttitor, nibh et volutpat posuere, neque dui sollicitudin
sapien, at scelerisque lacus elit quis enim. Donec at metus lectus.
Sed quis enim quis nibh convallis sagittis nec vitae felis. Sed
porttitor, nibh et volutpat posuere, neque dui sollicitudin sapien, at
scelerisque lacus elit quis enim. Donec at metus lectus. Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Quisque vitae augue ac
enim molestie scelerisque a id metus. Suspendisse purus justo, iaculis
quis accumsan ut, congue vitae mauris. Nunc luctus vulputate
scelerisque. Nullam ullamcorper porta elit, sed ornare lorem placerat
dictum. Sed quis enim quis nibh convallis sagittis nec vitae felis.
Sed porttitor, nibh et volutpat posuere, neque dui sollicitudin
sapien, at scelerisque lacus elit quis enim. Donec at metus
lectus.Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque vitae augue ac enim molestie scelerisque a id metus.
Suspendisse purus justo, iaculis quis accumsan ut, congue vitae maur d
Test used that passes: Notice that the line break has been removed and 2 extra characters added to the end to bring it back up to 2500 characters
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae
augue ac enim molestie scelerisque a id metus. Suspendisse purus
justo, iaculis quis accumsan ut, congue vitae mauris. Nunc luctus
vulputate scelerisque. Nullam ullamcorper porta elit, sed ornare lorem
placerat dictum. Sed quis enim quis nibh convallis sagittis nec vitae
felis. Sed porttitor, nibh et volutpat posuere, neque dui sollicitudin
sapien, at scelerisque lacus elit quis enim. Donec at metus lectus.
Sed quis enim quis nibh convallis sagittis nec vitae felis. Sed
porttitor, nibh et volutpat posuere, neque dui sollicitudin sapien, at
scelerisque lacus elit quis enim. Donec at metus lectus. Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Quisque vitae augue ac
enim molestie scelerisque a id metus. Suspendisse purus justo, iaculis
quis accumsan ut, congue vitae mauris. Nunc luctus vulputate
scelerisque. Nullam ullamcorper porta elit, sed ornare lorem placerat
dictum. Sed quis enim quis nibh convallis sagittis nec vitae felis.
Sed porttitor, nibh et volutpat posuere, neque dui sollicitudin
sapien, at scelerisque lacus elit quis enim. Donec at metus
lectus.Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque vitae augue ac enim molestie scelerisque a id metus.
Suspendisse purus justo, iaculis quis accumsan ut, congue vitae
mauris. Nunc luctus vulputate scelerisque. Nullam ullamcorper porta
elit, sed ornare lorem placerat dictum. Sed quis enim quis nibh
convallis sagittis nec vitae felis. Sed porttitor, nibh et volutpat
posuere, neque dui sollicitudin sapien, at scelerisque lacus elit quis
enim. Donec at metus lectus. Sed quis enim quis nibh convallis
sagittis nec vitae felis. Sed porttitor, nibh et volutpat posuere,
neque dui sollicitudin sapien, at scelerisque lacus elit quis enim.
Donec at metus lectus. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Quisque vitae augue ac enim molestie scelerisque a id
metus. Suspendisse purus justo, iaculis quis accumsan ut, congue vitae
mauris. Nunc luctus vulputate scelerisque. Nullam ullamcorper porta
elit, sed ornare lorem placerat dictum. Sed quis enim quis nibh
convallis sagittis nec vitae felis. Sed porttitor, nibh et volutpat
posuere, neque dui sollicitudin sapien, at scelerisque lacus elit quis
enim. Donec at metus lectus.Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Quisque vitae augue ac enim molestie scelerisque a id
metus. Suspendisse purus justo, iaculis quis accumsan ut, congue vitae
maur dee
The problem lay in the fact that my calculation in my JavaScript gave a length of 1 to a line break whereby Kentico's calculation gives a length of 2 to a line break. So they weren't matching up. Hence my character counter said that the length of the entered text was ok but Kentico's check deemed it over the max length.
This is what I had previously:
enteredText = textareaVariableName.val();
characterCount = enteredText.length; //one line break entered returned 1
This is what I have changed it to:
enteredText = textareaVariableName.val();
enteredTextEncoded = escape(enteredText);
//next I match any line break characters - %0A - after encoding the text area text
linebreaks = enteredTextEncoded.match(/%0A/g);
(linebreaks != null) ? linebreaksLength = linebreaks.length : linebreaksLength = 0;
characterCount = enteredText.length + linebreaksLength; //one line break entered now returns 2
Is there a better way I could check for line breaks in the text, rather than to encode the text and then check for the substring %0A ?
EDIT/UPDATE: I believe the following is a better solution as opposed to what I was doing above.
var limit = 2500; //for example
enteredText = textareaVariableName.val();
numberOfLineBreaks = (enteredText.match(/\n/g)||[]).length;
left = limit - enteredText.length - numberOfLineBreaks;
if (left < 0) {
//character count over code here
} else {
//character count within limits code here
}
This is basically JavaScript problem related to browser. In Firefox or Chrome or any other WebKit based browser textareaVariableName.val().length will count only 1 character for new line (\n). Same for jQuery implementation. But in IE document.getElementById('textareaVariableName').value.length will count 2 for new line (\r\n)
In Kentico, the text is validated to the actual count of characters and therefore the validation is failing.
Quick fix for this is simple regular expression for counting the actual length:
function getTextLength(elementId){
if (elementId) {
var elem = document.getElementById(elementId);
if (elem) {
var str = elem.value;
if (str) {
str = str.replace(/(\r\n|\r|\n)/g, '\r\n');
return str.length;
}
}
}
return 0;
}
This should help you to count characters correctly independently of the browser used by the customer.