Search found 557 matches
- 09 May 2022, 13:52
- Forum: Ask for Help (v1)
- Topic: Can I get a random fruit from fruits.color.species?
- Replies: 8
- Views: 645
Re: Can I get a random fruit from fruits.color.species?
using your type of associative array you could do something like this fruits := [] fruits.yellow := [] fruits.green := [] fruits.yellow.push("banana") fruits.yellow.push("lemon") fruits.yellow.push("Pineapple") fruits.yellow.push("Mango") fruits.green.push("grape") fruits.green.push("pear") fruits.g...
- 30 Apr 2022, 09:29
- Forum: Ask for Help (v1)
- Topic: [Solved] Is it Possible to Set the "Image Name" of a Script? Topic is solved
- Replies: 7
- Views: 615
Re: Is it Possible to Set the "Image Name" of a Script? Topic is solved
I'm not sure about that, perhaps someone else will know...
However, compiling your script will allow you to set a custom icon and it will show the executable name in task explorer as well instead of autohotkey.exe.
However, compiling your script will allow you to set a custom icon and it will show the executable name in task explorer as well instead of autohotkey.exe.
- 27 Apr 2022, 02:48
- Forum: Ask for Help (v1)
- Topic: Edit/Button/Calc Topic is solved
- Replies: 3
- Views: 287
Re: Edit/Button/Calc Topic is solved
MsgBox, (%Edit% + 20) this would just display (EDITVALUE + 20) as string, instead use a single percent sign to tell ahk to treat the next code as expression and not string so instead you would do Msgbox % edit+20 Here's an example outputting the result to a text control #singleinstance,force Gui, +...
- 23 Apr 2022, 15:57
- Forum: Ask for Help (v1)
- Topic: move, then click
- Replies: 7
- Views: 551
- 23 Apr 2022, 10:09
- Forum: Ask for Help (v1)
- Topic: Need help converting 1 line of C++ to AutoHotkey. Topic is solved
- Replies: 4
- Views: 676
Re: Need help converting 1 line of C++ to AutoHotkey. Topic is solved
In this Original C++ code the variable i starts with a value of 0 or will it starts with a value of 1 because of the indexing condition of i++ at the end of the first line? the increment in the for loop for(i = 0; i < 7; i++ ) only happens at the end of the loop so It will start with 0 and run thro...
- 22 Apr 2022, 18:38
- Forum: Ask for Help (v1)
- Topic: Need help converting 1 line of C++ to AutoHotkey. Topic is solved
- Replies: 4
- Views: 676
Re: Need help converting 1 line of C++ to AutoHotkey. Topic is solved
In c++ that is the modulo operator, in ahk you would use mod(i,2) I have no idea what (REAL) does though, I've never used that points := [] maxPoints := 7 loop % maxPoints { i := a_index-1 points.push({x:i * 5.0 * mod(i,2),y:50.0 - i * 5.0}) } str := "" for k,v in points str .= "Point " k ": " round...
- 20 Apr 2022, 23:54
- Forum: Ask for Help (v1)
- Topic: Pre-Loading Sound Files to Memory Topic is solved
- Replies: 5
- Views: 774
Re: Pre-Loading Sound Files to Memory Topic is solved
According to PlaySound SND_ASYNC will return immediately after the sound, so that should work fileread,soundOff,*c SOUND.wav ;loads sound into memory fileread,soundOn,*c SOUND.wav ;loads sound into memory SoundSet, 1, MASTER, mute,10 return ~*F12::(toggle := !toggle) ? PlaySound(soundOn) : PlaySound...
- 20 Apr 2022, 13:18
- Forum: Scripts and Functions (v1)
- Topic: [game] Wordle
- Replies: 14
- Views: 2224
Re: [game] Wordle
afoster Capitalization does not matter, this will not work with AHK V2 and I have no idea if it runs on windows 11, if you are not getting any errors and it's displaying nothing then I'm not really sure why that would be... I've updated my original post to include a link to a zip file containing th...
- 20 Apr 2022, 12:17
- Forum: Scripts and Functions (v1)
- Topic: [game] Wordle
- Replies: 14
- Views: 2224
Re: [game] Wordle
afoster Hi there! Make sure you are running the wordle.ahk file and not classes/functions file. Assuming you copied the code correctly into each file >wordle.ahk, functions.ahk, classes.ahk< it should run without errors Also make sure if you do not have a gdip library to download the one linked in ...
- 20 Apr 2022, 10:22
- Forum: Ask for Help (v1)
- Topic: Can I get a link title with AHK
- Replies: 8
- Views: 1071
Re: Can I get a link title with AHK
Here's another way as well =P Some googling also shows a way to get the title from a youtube no embed link, which returns very basic information in json format including title ;GetTitleFromUrl(clipboard) Msgbox % GetTitleFromUrl("https://www.youtube.com/watch?v=hZRggm8RkhM") ;example exitapp GetTitl...
- 19 Apr 2022, 20:43
- Forum: Ask for Help (v1)
- Topic: Pre-Loading Sound Files to Memory Topic is solved
- Replies: 5
- Views: 774
Re: Pre-Loading Sound Files to Memory Topic is solved
I've done this once in the past I'm pretty sure you just do fileread with *c before the path to load it into memory, then you can dllcall playsound with the memory flag I haven't tested it but this should work, although I think it only works for .wav files fileread,soundOff,*c SOUND.wav ;loads sound...
- 07 Apr 2022, 05:34
- Forum: Ask for Help (v1)
- Topic: async sleep to suspend script after some time Topic is solved
- Replies: 3
- Views: 441
Re: async sleep to suspend script after some time Topic is solved
This would be a good use for a timer isActive := false Suspend F1:: Suspend, Toggle isActive := !isActive if (isActive) { settimer,suspendTimer,-10000 ;negative value means the timer label only runs once } else { settimer,suspendTimer,off ;if the previous timer was still running turn it off } return...
- 23 Mar 2022, 13:36
- Forum: Ask for Help (v1)
- Topic: regular expression in a loop Topic is solved
- Replies: 2
- Views: 502
Re: regular expression in a loop Topic is solved
You can just take the position from the result and do another RegExMatch just after that position until there is no more matches Here's a function that simplifies the process, adding all the matches into an array. str = ( xx ABC #abc xxxx xx CDE #cde Xxx xx x x ) matches := GetAllMatches(str,"\n([A-...
- 15 Mar 2022, 05:11
- Forum: Ask for Help (v1)
- Topic: Variable function name and variable parameters.
- Replies: 5
- Views: 971
Re: Variable function name and variable parameters.
This was also posted 7 years ago, not sure he needs help anymore lol
- 11 Mar 2022, 16:58
- Forum: Ask for Help (v1)
- Topic: Access Variable String Content with Offset
- Replies: 9
- Views: 1055
Re: Access Variable String Content with Offset
Thanks you for replying, but isn't this exactly the same as SubStr? Because it still allocates new memory buffer for the substring(which is inside that new variable). Whoops, yeah it's basically the same. XD I guess another question is why does your string have to be so big, what is it exactly? It ...
- 11 Mar 2022, 13:42
- Forum: Ask for Help (v1)
- Topic: Access Variable String Content with Offset
- Replies: 9
- Views: 1055
Re: Access Variable String Content with Offset
You can get a pointer to the memory address of the variable and use StrGet to convert the bytes into string.
Code: Select all
string := "The Quick Brown Fox Jumps Over the Lazy Dog"
msgbox % strget(&string+10) ;strget(stringPointer,length,encoding) +10 because unicode stores string in 2 bytes each
- 27 Feb 2022, 22:13
- Forum: Scripts and Functions (v1)
- Topic: [game] Wordle
- Replies: 14
- Views: 2224
Re: [game] Wordle
Thanks! =) Wow the whole GUI is implemented with GDIP? Of course! I've sort of specialized in graphics programming with AutoHotKey, whenever possible I prefer to create my own gui from scratch :D This was just a quick project for fun, if you want to see more impressive stuff check out some of the li...
- 26 Feb 2022, 11:16
- Forum: Ask for Help (v1)
- Topic: How Do I Use RTrim? Topic is solved
- Replies: 5
- Views: 718
Re: How Do I Use RTrim? Topic is solved
You probably want StrReplace or RegExReplace or even StrSplit name := "file.mp4" msgbox % StrReplace(name,".mp4") ;using strreplace msgbox % RegExReplace(name,"\.([^\.])*$","") ;replaces anything ending with an extension, regardless of type s := strsplit(name,".") msgbox % "fileName: " s[1] "`nFileE...
- 24 Feb 2022, 18:27
- Forum: Ask for Help (v1)
- Topic: New Random Values each loop
- Replies: 1
- Views: 245
Re: New Random Values each loop
It would probably help if you posted some code, not sure what your random values are, however all you have to do it use the random function to set a variable to a random number loop 5 { randomValue := Random(1,1000) ;just call Random(min,max) to set a new value msgbox % "Index: " a_index "`nValue: "...
- 24 Feb 2022, 12:15
- Forum: Ask for Help (v1)
- Topic: Function recursion limit Topic is solved
- Replies: 25
- Views: 3270
Re: Function recursion limit Topic is solved
a better idea is to use a timer, with this approach you can easily turn imagescan loop on and off as well searching := false itemX := 50 itemY := 50 return !^1:: searching := !searching settimer,search,% (searching ? 10 : "off") ;this hotkeys enables and disables searching, if enabled set search tim...