Search found 180 matches

by carno
Today, 06:38
Forum: Scripts and Functions
Topic: Function: FileReadLines()
Replies: 3
Views: 270

Re: Function: FileReadLines()

myword wrote:
19 Apr 2019, 11:07
Just wondering what would be a good use case for a partial read of a file?
There are nitche uses. Not something you can use everyday.
by carno
19 Apr 2019, 08:20
Forum: Scripts and Functions
Topic: Function: FileReadLines()
Replies: 3
Views: 270

Re: Function: FileReadLines()

Nice function. I can use this in some of my applications!
by carno
19 Apr 2019, 08:12
Forum: Scripts and Functions
Topic: Copy Files By Date
Replies: 2
Views: 145

Re: Copy Files By Date

Helgef wrote:
19 Apr 2019, 02:22
It works, thanks for sharing 🌞

Note that var := is not valid syntax, it should be var := "" or var =.

Cheers.
Good point and a nice reminder!
by carno
17 Apr 2019, 07:12
Forum: Scripts and Functions
Topic: [function] MSWord_CompareStringsOrFiles()
Replies: 4
Views: 265

Re: [function] MSWord_CompareStrings()

Can this also compare 2 plain text files?
by carno
11 Feb 2019, 00:17
Forum: Ask For Help
Topic: Adding Copy button to copy selected text
Replies: 0
Views: 144

Adding Copy button to copy selected text

I have a fully functioning code except for the Copy button that is not functioning as expected. Expected function is to copy any selected text in the "lower box" that currently contains this text (but could be any other text): En/Decrypted text appears here and is also copied to the clipboard! I wou...
by carno
10 Feb 2019, 19:14
Forum: Scripts and Functions
Topic: [AHK v2] Compare Texts and Highlight Differences
Replies: 8
Views: 925

Re: [AHK v2] Compare Texts and Highlight Differences

@burque505: Righto, your bet is on the money! :D Can I adapt/modify this script for v1 or I must install v2?
by carno
10 Feb 2019, 00:11
Forum: Scripts and Functions
Topic: [AHK v2] Compare Texts and Highlight Differences
Replies: 8
Views: 925

Re: [AHK v2] Compare Texts and Highlight Differences

When I double-click on textCompare.ahk I get this error message: Error in #include file "Class_RichEdit.ahk": parameter #2 invalid. Specifically: "Integer" Line# } ; ------------------------------------------------------------------------------------------------------------------- SetModified(Modifi...
by carno
29 Jan 2019, 18:07
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

Loop, Parse, list, `n { X := SubStr(A_Loopfield, st := InStr(A_Loopfield, ".") + 3, 30 - st) = 0 ? result .= SubStr(A_Loopfield, 1, 6) "`n" : result .= A_Loopfield "`n" } Just in case anybody wanted or are intrigued by it, here is the "condensed version" of alternative to RegEx code. Note - use aga...
by carno
29 Jan 2019, 17:48
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

Looking for a RegEx so that I can trim any number with 6 decimal places so that I can trim the leading floating zeros only after the decimal point but leave 2 zeros after the decimal point if all digits after the decimal point are zeros and 1 zero after the first non-zero digit following the decima...
by carno
29 Jan 2019, 16:24
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

Thanks, SOTE. I think we have now hit the peak of perfection! :salute:
by carno
29 Jan 2019, 16:04
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

That was the output, but what was the desired output? I think you want this: truncate trailing zeros, but maintain at least 2dp. vOutput .= RegExReplace(A_LoopField, "\.\d\d+?\K0+$") "`r`n" Check for a dot, a digit, and one or more digits (the +? means: grab one or more but as few as possible). Any...
by carno
29 Jan 2019, 15:33
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

For better responses, provide a fuller list of before/after examples. I first apologize. The assumption in my original request was 6 decimal places ONLY! :oops: That said, I ran the following: :ugeek: vList := " ( 123.000000 123.012345 123.100000 123.123456 123.120000 0.000814 0.0000814 0.00000814 ...
by carno
29 Jan 2019, 14:51
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

TrimZeros(n) { len := StrLen(n) Loop, 4 { if (SubStr(n, len, 1) = 0) --len else break } return SubStr(n, 1, len) } Always assumes 6 digits after the decimal per OP I apologize, and yes, my original assumption was only 6 decimal places. :facepalm:
by carno
29 Jan 2019, 14:49
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

TrimZeros(n) { len := StrLen(n) Loop, 4 { if (SubStr(n, len, 1) = 0) --len else break } return SubStr(n, 1, len) } Always assumes 6 digits after the decimal per OP I apologize, and yes, my original assumption was only 6 decimal places.
by carno
29 Jan 2019, 14:47
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

Am I missing something or misunderstanding the question? Because this seems to work. List = ( 123.000000 123.012345 123.100000 123.123456 123.120000 ) msgbox % list Loop, Parse, list, `n { If InStr(A_Loopfield, "0000") { result .= StrReplace(A_Loopfield, "0000", "") "`n" } else { result .= A_Loopfi...
by carno
29 Jan 2019, 14:38
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

IMEime's solution fails for all numbers that don't have at least four 0s at the end. For example, 123.456700 fails, it will not match the pattern and will stay as it is, when it should really become 123.4567 . Strangely enough, IMEime's solution returns 123.456700 for 123.4567000000 (while no criti...
by carno
29 Jan 2019, 14:15
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

Looks like the first script from jeeswg also failed with 0.000000814. It returns 0.00814. So the winner is IMEime whose script is so far standing tall. :thumbup:
by carno
29 Jan 2019, 14:04
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

IMEime wrote:
29 Jan 2019, 13:44
try to love simple one
I agree. Yours is the simplest and easiest to understand -- specially for someone who is still struggling with basic RegEx. :D
by carno
29 Jan 2019, 13:39
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

Both jeeswg and IMEime solutions seem to return solid results! :D
by carno
29 Jan 2019, 13:27
Forum: Ask For Help
Topic: RegEx to trim floating decimal places Topic is solved
Replies: 34
Views: 1272

Re: RegEx to trim floating decimal places Topic is solved

SALZKARTOFFEEEL wrote:
29 Jan 2019, 12:58
Not wanting to brag or anything, but my solution is the most fail-safe and perhaps the cleanest so far :P
I think I found the first dangerous bug:
3453/4242443=0.000814 (8.13917829891881E-04)
But when the RegEx code is run, it returns: 0.00814 (one zero is missing)

Go to advanced search