Looking for text character counting functionality in ahk - autohotkey

Is there any text counting functionality in ahk?
I want to make an character counter where, if i press ctrl+alt+-, an input box will open. And the number of characters used in the variable‘s value will be counted.
You can start with:
<^<!-::
InputBox, Text1, Count, Paste the text in the text box to count the number of characters it has, and find things in that text
MsgBox text:You typed %Text1%.`nCharacters:
return
any answers? thanks.

The StrLen() function retrieves the count of how many characters are in a string.
<^<!-::
InputBox, Text1, Count, Paste the text in the text box to count the number of characters it has, and find things in that text
if ErrorLevel
return
number_of_chars := StrLen(Text1)
MsgBox text:You typed %Text1%.`nCharacters:%number_of_chars%
return

Related

Hide certain characters in a text field in Flutter

I have a text field which I need to style for example with bold or italics parts.
I tried overridding the TextEditingController's buildTextSpan and formatting the text using annotation ranges with custom styles but the edge cases were too much and I really couldn't get it to work.
So, thought about using a formatter where before every change in format I'll add a custom character, like this:
This text is |bBOLD and this is |iITALICS. Would get me this:
This text is BOLD and this is ITALICS. So I override the buildTextSpan to build the TextSpan from a parse function where I split the text by the special characters and check the initial letter of each text for formatting info.
This works well except for the fact that when I press the right arrow to go the next character after the "This text is ", the cursor will stay fixed as it thinks there are two characters but being only for formatting, they aren't there on the render.
Is there any way I could tell the textfield to ignore certain characters when selecting, moving selection or typing?
I think this would work!
static const kCharToBEIgnored = 0x2C;
// Here 0x2C means ',' comma
// For complete list visit https://api.flutter.dev/flutter/charcode/charcode-library.html
String get text {
return String.fromCharCodes(
_value.text.codeUnits.where((ch) => ch != kCharToBEIgnored),
);
}

Is there a way to have a variable value equal to text? Trying to display a user-chosen word in the middle of an fprintf line

I am trying to code a MadLibs-type game in Octave on a Mac, and can't figure out how to display a user-chosen WORD in the middle of a string of text. I used fprintf to display the sentence with the variable in the middle and it works just fine as long as the variable is equal to a NUMBER. If you enter anything other than a number you get an error.
Word=input('Enter a word: ');
fprintf('You chose %d as the word.\n', Word)
How would I allow the user to chose a word, then display that word in the middle of a string of text?
Thanks in advance.
Input has the option of returning the entered text as a MATLAB string, without evaluating expressions.
STR = input(PROMPT,'s')
So that whatever is entered will be output as a string.
for your example:
Word=input('Enter a word: ','s');
fprintf('You chose %d as the word.\n', Word)
Numbers or text will display correctly.
The format specifier for strings is %s thus you can change your snippet to:
fprintf('You chose %s as the word.\n', Word)

gtk turn on italic, bold, etc in textview

[Revised]
I am trying GTK3 TextView, in C. I know how to apply tags, such as italics, etc., to a region of text.
But how do I "turn on" a style (italics, bold, etc) while typing in the buffer? For example, suppose I am typing text and there are no styles set. Then I want to type in italics. I want to apply the italic tag to the insert point, after which whatever I typed would be in italics.
I notice that when you place the insert cursor to the right of any existing styled text, the tags of the previous character are inherited, but only if the style is in effect before and after the insert point. Interestingly, the trailing newline can be stylized, so when the insert point is at the end of a line and the last visible character has a style, then that style is inherited.
I've looked at some methods that use a key-press signal and then apply a text tag to the region of the untagged character just typed, but that is slow and looks odd on screen -- the plain char is displayed and then replaced by the tagged char.
I've also tried:
gtk_text_buffer_insert_markup(buf, &iter, "<i>", -1);
but that gets a Warning: Invalid markup string: ... Element 'markup' was closed, but the currently open element is 'i' and has no effect on the displayed text. Using <i></i> gets no warning but also has no effect. I finally resorted to:
gtk_text_buffer_insert_markup(buf, &iter, "<i> </i>", -1); // 2 spaces
gtk_text_iter_backward_char (&iter);
gtk_text_buffer_place_cursor(buf, &iter);
which lets me start typing in italics between 2 new spaces -- that's not so bad.
But clicking an "I" button to start typing in italics -- that is a basic editing function that has been around for decades. It must be possible in GTK somehow?
Any ideas?
thanks

LibreOffice Calc - text in a cell ending with an underscore and by a number will be converted to a small number

In LibreOffice Calc, If you enter text in a Standard cell ending with an underscore followed by a number, then the text is converted in the following way: the underscore is removed and the number is set in a small font (subscript).
Exemple:
If I enter TEST_1 in a cell and press Enter, then the content of the cell is replaced by TEST₁
How is it possible to cancel this behavior ?
The autocorrect behavior depends on the language.
In my case the Autocorrect options (in menu Tools->Autocorrect) were set to French (France).
The autocorrect rules causing this problem were in the form
.*_0 converted to ₀
It is possible to delete these rules to avoid the problem.

How to select and modify all caption fields at once in a Word document?

I have been trying to change the numbering style of my figure and table captions. All of my headings are in Roman numerical. However, I want Arabic numerical in my caption numbering. Could anyone tell me an easy way to do it at once? Below is an example:
Heading title: "Chapter V". My captions appear as "Figure V-2". However, I want them to appear as "Figure 5-2"
Also, is there any way I can select all figure caption fields at once and edit their field code?
To change in one caption: Press Alt-F9 and remove \* ARABIC .
Ctrl+A, F9 to update fields.
Now to change in all captions: try with a search and replace (Ctrl+H) to replace SEQ Figure \* Arabic \s 1 with SEQ Figure \s 1
To modify all field codes, you could use search & replace or you can modify field codes in VBA this way:
Sub ChangeAllFields()
'does not process headers/footers
Dim oFld As Field
For Each oFld In ActiveDocument.Fields
fld.Code = Replace(fld.Code, "SEQ Figure \* ARABIC \s 1", "SEQ Figure \s 1")
Next oFld
End Sub
When you insert captions from now on, change the numbering in the dialog box that pops up. I think you'll have to change it every time, because Word (correctly) defaults to matching the Roman numerals in your chapter headings to Roman numerals in your captions. If you want to be abnormal, you'll have to change from the default every time you insert a caption, or change them all using one of the methods from Toon Flores.
p.s. I said "abnormal" because every style manual I've ever seen would frown on what you are doing.