Search found 615 matches
- 25 Nov 2020, 06:58
- Forum: Ask for Help (v1)
- Topic: When to use study option (S) of regular expressions? Topic is solved
- Replies: 2
- Views: 264
Re: When to use study option (S) of regular expressions? Topic is solved
OK, I will try, thanks!
- 25 Nov 2020, 06:04
- Forum: Ask for Help (v1)
- Topic: When to use study option (S) of regular expressions? Topic is solved
- Replies: 2
- Views: 264
When to use study option (S) of regular expressions? Topic is solved
Does this mean that just using this option in a loop can improve performance?The study option (S) can sometimes improve the performance of a regular expression that is used many times (such as in a loop).
- 25 Nov 2020, 05:45
- Forum: Ask for Help (v1)
- Topic: How to quickly remove the file name in the path? Topic is solved
- Replies: 6
- Views: 496
Re: How to quickly remove the file name in the path? Topic is solved
so easy! I didn't expect it. But to avoid files with the same name in the path, add a $ at the end.Smile_ wrote: ↑22 Nov 2020, 08:29Code: Select all
path := "C:/TEST/a.txt" filename := "a.txt" Msgbox % RegExReplace(path, "\\?/?" filename,"")
Code: Select all
path := RegExReplace(path, "/" . filename . "$")
- 25 Nov 2020, 05:33
- Forum: Ask for Help (v1)
- Topic: How to quickly remove the file name in the path? Topic is solved
- Replies: 6
- Views: 496
Re: How to quickly remove the file name in the path? Topic is solved
Wonderful, I didn't expect to replace it first. But both are 0ms, so the string should be too simple.mikeyww wrote: ↑22 Nov 2020, 08:19Code: Select all
fpath = /TEST/a.txt fpath := StrReplace(fpath, "/", "\") SplitPath, fpath,, dir dir := StrReplace(dir, "\", "/") MsgBox, #%dir%#
- 22 Nov 2020, 03:26
- Forum: Ask for Help (v1)
- Topic: How to quickly remove the file name in the path? Topic is solved
- Replies: 6
- Views: 496
Re: How to quickly remove the file name in the path? Topic is solved
Thanks, SplitPath is very good, but if making a slight change, like the following
The expected result is
/TEST
Code: Select all
/TEST/a.txt
/TEST
- 22 Nov 2020, 03:12
- Forum: Ask for Help (v1)
- Topic: How to quickly remove the file name in the path? Topic is solved
- Replies: 6
- Views: 496
How to quickly remove the file name in the path? Topic is solved
Code: Select all
path := "C:\TEST\a.txt"
filename := "a.txt"
; Method 1
RegExReplace(path, "\\[^\\]+$")
; Method 2
SubStr(path, 1, InStr(path, filename, true, -1, 1) - 2)
C:\TEST
One uses RegExReplace and the other uses SubStr and InStr. Will the latter be faster?
- 18 Nov 2020, 07:44
- Forum: Ask for Help (v1)
- Topic: How to make the Gui have no focus?
- Replies: 4
- Views: 878
Re: How to make the Gui have no focus?
What if there is no button? In other words, the focus must exist, but it is moved to other controls.
- 17 Nov 2020, 05:20
- Forum: Ask for Help (v1)
- Topic: How to make the Gui have no focus?
- Replies: 4
- Views: 878
How to make the Gui have no focus?
When opening an AHK Gui, if there is an Eidt control, the focus may be set on it. How to make it not set the focus or set the focus on the menu, such as the file menu. But the menu does not have Text and ClassNN attributes.
- 16 Nov 2020, 12:50
- Forum: Ask for Help (v1)
- Topic: The menu command cannot be used in the ? : operator? Topic is solved
- Replies: 6
- Views: 359
The menu command cannot be used in the ? : operator? Topic is solved
2 >1 ? ( Menu, MenuName, Disable, Value1 ) : ( Menu, MenuName, Disable, Value2 ) Why is this invalid? 1 = 0 ? a() : b() return a() { msgbox 1 return } b() { msgbox 2 return } And why doesn't this call the b function? Why would the b function be called when changed to the following? Really weird? x ...
- 16 Nov 2020, 11:15
- Forum: Scripts and Functions (v1)
- Topic: MCode4GCC -- C/C++ to MCode Generator
- Replies: 121
- Views: 53624
Re: MCode4GCC -- C/C++ to MCode Generator
Is it possible to use it to encrypt ahk source code and how to do it?
- 16 Nov 2020, 10:39
- Forum: Ask for Help (v1)
- Topic: How to use mcode to encrypt source code? Are there any ready-made tools?
- Replies: 5
- Views: 973
Re: How to use mcode to encrypt source code? Are there any ready-made tools?
You can see an example of such by referring to Encryptor by FeiYue. https://www.autohotkey.com/boards/viewtopic.php?f=28&t=42494 Oh, no. Don't mention this. I tested it today. The script has only two lines of code. Msgbox OK return After compiling and running, it looked like a virus. Not only did i...
- 04 Nov 2020, 08:49
- Forum: Ask for Help (v1)
- Topic: Does ahk support tail recursion? Topic is solved
- Replies: 5
- Views: 636
Re: Does ahk support tail recursion? Topic is solved
its the other way around. tail recursion(referring to the optimization tail call elimination ) is not a feature present in ahk the example provided is tail recursive, since no other actions are performed after the recursive call to f() What you mean is that it is possible to recurse in this way, bu...
- 04 Nov 2020, 08:46
- Forum: Ask for Help (v1)
- Topic: Does ahk support tail recursion? Topic is solved
- Replies: 5
- Views: 636
Re: Does ahk support tail recursion? Topic is solved
Does ahk support tail recursion? Yes, tail recursion is explained here And does the following example count as tail recursion? no, the example provided will never reach this line : return, f() Sorry, my example is not complete and it has misunderstood you. I meant that n might be equal to 9.
- 02 Nov 2020, 13:10
- Forum: Ask for Help (v1)
- Topic: Does ahk support tail recursion? Topic is solved
- Replies: 5
- Views: 636
Does ahk support tail recursion? Topic is solved
Does ahk support tail recursion? And does the following example count as tail recursion?
Code: Select all
f()
{
Try {
; something
if ( n != 9 )
return, err
}
Catch {
; something
return
}
return, f()
}
- 02 Nov 2020, 08:14
- Forum: Ask for Help (v1)
- Topic: How to traverse folders using loops instead of recursion?
- Replies: 4
- Views: 315
Re: How to traverse folders using loops instead of recursion?
However, this is not the same problem. To be more specific, the traversal of folders I mentioned may not really mean traversing the local computer folders. This is just an analogy.
- 02 Nov 2020, 07:48
- Forum: Ask for Help (v1)
- Topic: How to traverse folders using loops instead of recursion?
- Replies: 4
- Views: 315
How to traverse folders using loops instead of recursion?
How to traverse folders using loops instead of recursion? Do I need to prepare an array and save the folders in the current directory to the array. When the current directory is traversed, take out a value from the array and traverse again until the array is empty? The actual problem is more complic...
- 22 Oct 2020, 06:35
- Forum: Ask for Help (v1)
- Topic: How to use mcode to encrypt source code? Are there any ready-made tools?
- Replies: 5
- Views: 973
How to use mcode to encrypt source code? Are there any ready-made tools?
How to use mcode to encrypt source code? Are there any ready-made tools?
I don't understand mcode. Is it possible to encrypt the source code into an EXE and no longer need AutoHotKey.exe when running it?
I don't understand mcode. Is it possible to encrypt the source code into an EXE and no longer need AutoHotKey.exe when running it?
- 09 Oct 2020, 03:16
- Forum: Scripts and Functions (v1)
- Topic: ScriptGuard: Helps Protect Compiled Scripts from Decompilation
- Replies: 74
- Views: 20822
Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation
My program has been decoded by others, and the account was used to sell it. I can't do anything about it. I know that this day will come sooner or later, and have been considering changing to another language. Of course, this is not the only reason. AutoHotKey does not support multi-threading, and t...
- 07 Oct 2020, 05:59
- Forum: Scripts and Functions (v1)
- Topic: ScriptGuard: Helps Protect Compiled Scripts from Decompilation
- Replies: 74
- Views: 20822
Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation
Unfortunately, this method does not allow the source code to be protected too much.
- 05 Jul 2020, 03:32
- Forum: Ask for Help (v1)
- Topic: Run cmd has an unexpected result
- Replies: 2
- Views: 925
Re: Run cmd has an unexpected result
I don't think it has anything to do with the working directory. The working directory impact will be CMD, and CMD is not in the script directory, nor will it affect the subsequent appA. The problem should be what caused the directory displayed after 'Run, cmd' to be 'C:\Windows\Systme32' instead of ...