Search found 214 matches

by oif2003
20 Feb 2020, 16:35
Forum: Scripts and Functions (v2)
Topic: [v2] Scintilla Edit control class
Replies: 9
Views: 4397

Re: [v2] Scintilla Edit control class

Thanks for posting this. I needed a simple editor control so I took portions of your code to build this minimalist demo and updated it for the lastest v2 (2.0-a108-a2fa0498). Maybe this will be useful to others as well. main := GuiCreate() sc := Scintilla.New(main, "ClassScintilla w800 h400 xs Secti...
by oif2003
05 Aug 2019, 06:15
Forum: Scripts and Functions (v2)
Topic: Finite-state machine
Replies: 0
Views: 3585

Finite-state machine

Hi, I wrote this script as an exercise while learning about finite-state machine ( https://en.wikipedia.org/wiki/Finite-state_machine ). I find it useful because it seems like a cleaner way to model certain problems. As you can see in my attempt to simulate the operations of a microwave, the state d...
by oif2003
29 Dec 2018, 13:44
Forum: Ask for Help (v1)
Topic: Capitalise nth word of string?
Replies: 9
Views: 2229

Re: Capitalise nth word of string?

jeeswg wrote:
29 Dec 2018, 12:57
Thanks! :D I'll check that out later. For now this seems to work for me:

Code: Select all

RegExReplace(s, "^([\w\-]*[\W]*){" n-1 "}\K[\w\-]*", "$t0")
by oif2003
29 Dec 2018, 12:37
Forum: Ask for Help (v1)
Topic: Capitalise nth word of string?
Replies: 9
Views: 2229

Re: Capitalise nth word of string?

Nifty! :bravo: I have trouble getting the correct results when the phrase starts with quotations so I inserted "`n" before the string and then later removed it. How can we do this more cleanly? s = ( firstword "out (of) africa;;;is a:'movie'"!.out of africa,is=an ? "africa-themed" movie )" loop 14 ...
by oif2003
28 Dec 2018, 18:03
Forum: Ask for Help (v1)
Topic: Capitalise nth word of string?
Replies: 9
Views: 2229

Re: Capitalise nth word of string?

Edit: Sorry I miss read it. This is not exactly what you asked for but this is what I ended up with. v1: ; s = string, n = nth word, delim = delimiters, ignore = ignored chars, i = start pos capitalizeN(ByRef s, n, delim:=" `t`r`n:;,.!?()=", ignore:="-'""", i:=1) { while n InStr(ignore,c:=SubStr(s,i...
by oif2003
28 Dec 2018, 17:18
Forum: Ask for Help (v1)
Topic: Delete program folder on exit
Replies: 1
Views: 729

Re: Delete program folder on exit

Saw this on https://stackoverflow.com/questions/1606140/how-can-a-program-delete-its-own-executable process.start("cmd /c ping localhost -n 3 > nul & del filepath") exit replace process.start with whatever command your programming language uses to start programs with arguments replace filepath with ...
by oif2003
25 Dec 2018, 01:31
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

I see what you are going for now. I made the adjustments but it appears that StrLen is still faster on average after running both inside an untimed loop first. Without the untimed loop, I was getting inconsistent results. Str1(byref s1){ NumPut(0, s1 .= ".",StrLen(s1)*2-4,"short"), VarSetCapacity(s1...
by oif2003
24 Dec 2018, 11:46
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

That's quite interesting... I poked around a bit and didn't see any obvious way to locate where strlen is stored based on the string address. The code may become too fragile anyway if we start messing with AHK internals. Speaking of which, maybe one day someone will compile an AHK with functions for...
by oif2003
23 Dec 2018, 13:03
Forum: Ask for Help (v2)
Topic: AHK v2 - Local Help file - Window Spy
Replies: 13
Views: 6020

Re: AHK v2 - Local Help file - Window Spy

That's pretty slick! I prefer this solution over compiling the script to exe, because it avoids the command prompt pop-up from batch files or the use of VBS, while keeping the script file easily accessible. Also just to add, sometimes even old v2 scripts are not compatible with the current v2 build.
by oif2003
23 Dec 2018, 12:56
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

I keep forgetting we are dealing with UTF-16 here. My mind keeps defaulting back to UTF-8 because that's what I'm used to seeing :crazy: AHK strings cuz AHK saves string's length somewhere and just retrieves that value on request That explains a lot. It does appear to be at least 2x faster on my tes...
by oif2003
23 Dec 2018, 03:02
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

I suppose the word "usual" does need to be qualified. If I recall correctly, Matlab, Lua, Julia and VBA behave like this, so I didn't see it as anything special in AHK. I've never seen it in C but I've seen it used in C++. In some languages you can do === to see if objects are not only identical but...
by oif2003
23 Dec 2018, 00:07
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

vvhitevvizard wrote:
22 Dec 2018, 06:13
Might not be worthwhile, but can we push each function reference into an array and then call the function by index (o) to avoid using %o%?

Edit: Nevermind, you already tested that :facepalm:
by oif2003
22 Dec 2018, 23:51
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

I've manually reworked the post #152 custom-logic mcode to search for every white space as 1 operation ( \t , \r , \n , " " and all other codes below Chr(32) can be considered whitespace and thus denoting number token field's end). And using setxx asm instructions, I managed to get rid of 3/4 condi...
by oif2003
21 Dec 2018, 14:21
Forum: Ask for Help (v1)
Topic: which languages should I learn to learn DllCall and Windows API Functions?
Replies: 21
Views: 6307

Re: which languages should I learn to learn DllCall and Windows API Functions?

Hi, for accessing AHK functionality from other programming languages, you can try using AHK_H's Autohotkey.dll. I am unfamiliar with Python so I cannot give you a working example. (https://hotkeyit.github.io/v2/docs/AutoHotkeyDll.htm) Note: (https://hotkeyit.github.io/v2/) AutoHotkey_H v1.1 document...
by oif2003
21 Dec 2018, 13:19
Forum: Editors
Topic: Visual studio Vs Sublime Vs Scite. Fight!
Replies: 23
Views: 16861

Re: Visual studio Vs Sublime Vs Scite. Fight!

Hi, I recommend SciTE if you like tinkering, because: 1) it lets you manipulate text with lua functions (http://lua-users.org/wiki/UsingLuaWithScite) -Many possibilities here, for example: SciTE already comes with the ability to shift lines up/down, but you can also easily implement shifting left/ri...
by oif2003
21 Dec 2018, 12:32
Forum: About This Community
Topic: Guestbook: say hi, thank you, whatever!
Replies: 107
Views: 83861

Re: Guestbook: say hi, thank you, whatever!

jeeswg wrote:
19 Dec 2018, 18:11
You are like an AHK historian, constantly documenting ideas and connecting them. Some of those posts have been very helpful, so a big THANK YOU for that! :)
Oh, and Merry Christmas :xmas:
by oif2003
21 Dec 2018, 12:19
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

I see that you have been putting the MCode to good use already :thumbup: Seems like you are on the path to replacing nearly everything inside the while loop of Get() with MCode :D With that idea, is it possible to load the string into MCode's address space at the beginning of Get(), use the MCode to...
by oif2003
20 Dec 2018, 14:52
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

Nice work! You can further improve speed by storing the addresses in variables instead of objects! class mcode{ __New(_s){ ;allocates the virtual addr space of the calling process and changes its protection ;If 1st arg=0, 1=size (1 byte for mcodes <4096) is rounded up to the next page boundary ;Mem...
by oif2003
20 Dec 2018, 14:44
Forum: Ask for Help (v1)
Topic: Can A Script Do Something Depending On Whether it Finds Something?
Replies: 4
Views: 1460

Re: Can A Script Do Something Depending On Whether it Finds Something?

Hi,
Being new is more the reason to check out the tutorials! Here's the official one: https://www.autohotkey.com/docs/Tutorial.htm
Good luck!
by oif2003
20 Dec 2018, 03:21
Forum: Ask for Help (v2)
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 46429

Re: AHK v2: converting/optimizing scripts Topic is solved

I see...I thought treating them as fixed size would be faster than being redirected via pointers, because I remember reading about something in another language where declaring numbers as an array of Real numbers is slower than array of Double or Int64 since Real numbers are stored as pointers in th...

Go to advanced search