Search found 1303 matches
- 19 Mar 2023, 02:28
- Forum: Ask for Help (v1)
- Topic: How to store/reference a group of arrays?
- Replies: 3
- Views: 298
How to store/reference a group of arrays?
I have a set of folder paths and a set of file names both in drop down menus. When a path is matched with a file the path is searched according to the contents of the file and three arrays are created. What is the best approach for linking this information together? Currently if a new file/path comb...
- 03 Mar 2023, 20:29
- Forum: Ask for Help (v1)
- Topic: comparing variables what am I missing?
- Replies: 2
- Views: 169
Re: comparing variables what am I missing?
Thanks for the reply. I've now figured out the issue is to do with carriage returns. Still testing but using *t with fileread seems to resolve the problem.
- 03 Mar 2023, 19:41
- Forum: Ask for Help (v1)
- Topic: comparing variables what am I missing?
- Replies: 2
- Views: 169
comparing variables what am I missing?
I have some code that uses fileread to load a text file into a variable called index. I then parse index and look for errors. If I find an error I fix the error and build up a second variable called fix to contain correct lines and the corrected lines. I then compare index and fix like this: if (tri...
- 03 Mar 2023, 17:32
- Forum: Ask for Help (v1)
- Topic: split string to get value of variables. Topic is solved
- Replies: 3
- Views: 301
Re: split string to get value of variables. Topic is solved
Thanks Rohwedder, brilliant! I had to scour the regex quick reference in help to work out how your code was working.
- 03 Mar 2023, 00:27
- Forum: Ask for Help (v1)
- Topic: split string to get value of variables. Topic is solved
- Replies: 3
- Views: 301
split string to get value of variables. Topic is solved
I have a string that can contain letters P, S and T followed by a number. I want to find the value of the number following each letter. This is the method I came up with: t := "P5S1T10" n := strsplit(t,["P","S","T"]) n.removeat(1) f := regexreplace(t,"\d") loop, parse, f %A_loopfield% := n[A_index] ...
- 25 Feb 2023, 01:49
- Forum: Ask for Help (v1)
- Topic: How to find files listed in a text file quickly?
- Replies: 1
- Views: 237
Re: How to find files listed in a text file quickly?
[edited 2023-02-26 to remove redundant arrays]. I've found that making an array for each letter of the alphabet is a lot faster: now := A_tickcount Global pngs := [], snds := [], typ := [] Global fp := [], fs := [], fb := [] ;found pictures, found sounds, found both Global index Global Zet = 1 t = 0...
- 24 Feb 2023, 22:23
- Forum: Ask for Help (v1)
- Topic: Seamless Looping of Audio
- Replies: 24
- Views: 9120
Re: Seamless Looping of Audio
Thanks teadrinker, that works and will be useful.
- 24 Feb 2023, 22:14
- Forum: Ask for Help (v1)
- Topic: How to find files listed in a text file quickly?
- Replies: 1
- Views: 237
How to find files listed in a text file quickly?
I have a directory called store containing over 10,000 pngs and 15,000 mp3s. I have various text files some containing words one per line and some containing multiple words per line separated by tabs and or pipes. I need to create arrays of words in the text files that are file names for pngs, mp3s ...
- 21 Feb 2023, 20:02
- Forum: Ask for Help (v1)
- Topic: Seamless Looping of Audio
- Replies: 24
- Views: 9120
Re: Seamless Looping of Audio
Is this code for AHK v2? I got this error message when I ran it with v1: --------------------------- teadrinker Sound loop test.ahk --------------------------- Error: 0x800A0005 - Source: (null) Description: (null) HelpFile: (null) HelpContext: 0 Specifically: Write Line# 010: code = SetCurrentProce...
- 12 Feb 2023, 04:11
- Forum: Ask for Help (v1)
- Topic: Finding longest text string between pipes and tabs in a text file
- Replies: 4
- Views: 411
Re: Finding longest text string between pipes and tabs in a text file
Thanks for the reply, flyDman and your code. I initially had a problem with multiple lines but this seems to be working:
Code: Select all
fileread, test, D:\My test file.txt
for x,y in strsplit(test,[a_tab,"|","`r`n"])
itm := (z := strlen(y)) > len ? (y, len := z) : itm
msgbox % itm " (" len ")"
- 11 Feb 2023, 21:23
- Forum: Ask for Help (v1)
- Topic: Finding longest text string between pipes and tabs in a text file
- Replies: 4
- Views: 411
Re: Finding longest text string between pipes and tabs in a text file
Thanks for the reply. This seems to be working for me:
Code: Select all
fileread, test, D:\My test file.txt
pipe := regexreplace(test,"\t|\R","|")
lng := ""
While pos := RegExMatch(pipe, "(?<=\|)[^|]++(?=\||\R)", m, pos ? pos + StrLen(m) : 1)
lng := strlen(lng) > strlen(m) ? lng : m
msgbox, 4096, lng,% lng
- 11 Feb 2023, 19:11
- Forum: Ask for Help (v1)
- Topic: Finding longest text string between pipes and tabs in a text file
- Replies: 4
- Views: 411
Finding longest text string between pipes and tabs in a text file
The following useful code by flyingDman finds the longest word in a string variable: fileread, test, D:\My test file.txt While pos := RegExMatch(test, "\b(\w+)\b", m, pos ? pos + StrLen(m) : 1) strlen(m1) > strlen(res) && res := m1 msgbox % res But rather than finding the longest word I want to find...
- 24 Jan 2023, 20:10
- Forum: Ask for Help (v1)
- Topic: Ahk v1 Gui long picture control clicks
- Replies: 2
- Views: 235
Re: Ahk v1 Gui long picture control clicks
Thanks, boiler, I didn't realise that.
- 23 Jan 2023, 22:19
- Forum: Ask for Help (v1)
- Topic: Ahk v1 Gui long picture control clicks
- Replies: 2
- Views: 235
Ahk v1 Gui long picture control clicks
I wanted to monitor how long the enter key or a picture control is clicked, so I used this code in my larger gui: pictest: ;this control is default so fires when enter is pressed enow := A_tickcount keywait lbutton keywait enter if (A_tickcount - enow > 1000) soundbeep msgbox, 4096, OK,% A_tickcount...
- 20 Jan 2023, 22:48
- Forum: Ask for Help (v1)
- Topic: Determine if there is selected text in a text editor Topic is solved
- Replies: 2
- Views: 315
Re: Determine if there is selected text in a text editor Topic is solved
Thanks mikey, I had tried controlgettext but that didn't work - I missed the selected option in Controlget.
- 20 Jan 2023, 20:52
- Forum: Ask for Help (v1)
- Topic: Calculating the number of Saturdays within a time range Topic is solved
- Replies: 5
- Views: 463
Re: Calculating the number of Saturdays within a time range Topic is solved
Thanks, flyingDman, I've just discovered that the solution you proposed works better for what I am doing when the day is an actual Saturday.
- 20 Jan 2023, 20:29
- Forum: Ask for Help (v1)
- Topic: Determine if there is selected text in a text editor Topic is solved
- Replies: 2
- Views: 315
Determine if there is selected text in a text editor Topic is solved
I mainly use notepad++ to edit ahk files and metapad to edit text. Is there anyway to use ahk to determine whether any text is selected in these or other text editors? Searching through posts I came across EM_GETSEL but can't find a reference for it in the help file so don't know if it is useful or ...
- 20 Jan 2023, 00:53
- Forum: Ask for Help (v1)
- Topic: Play video inside AHK GUI
- Replies: 10
- Views: 1606
Re: Play video inside AHK GUI - Start Issue
This is the basic code I'm using to play a video inside a GUI which is part of a larger script: Gui, Vid:New, +alwaysontop -Caption +owndialogs +HwndVNP -dpiscale +E0x02000000 +E0x00080000, Video Now Playing Gui, Add, ActiveX, x0 y0 w%_W% h%_H% vWMP, WMPLayer.OCX ;_W _H width and height of monitor 2...
- 17 Jan 2023, 23:05
- Forum: Ask for Help (v1)
- Topic: Ahk v1 Using CaptureScreen by Linear Spoon
- Replies: 4
- Views: 431
Re: Ahk v1 Using CaptureScreen by Linear Spoon
Thanks for the replies, I'm not using any scaling on this machine. The code: CaptureScreen("-1920, 0, 0, 1080", 0, A_ScriptDir "\test987.png") Gave me a black screenshot. I tried: CaptureScreen("1920, 0, 0, 1080", 0, A_ScriptDir "\test987.png") without the " - " but failed to save the file. I've tri...
- 17 Jan 2023, 21:47
- Forum: Ask for Help (v1)
- Topic: Ahk v1 Using CaptureScreen by Linear Spoon
- Replies: 4
- Views: 431
Ahk v1 Using CaptureScreen by Linear Spoon
I'm having trouble using this code by Linear Spoon to capture an active Window on my second monitor. I believe that the following should capture the active window to a file: CaptureScreen(1,0,"D:\test.png") The problem is if the target window is full-sized and on my second monitor the bottom of the ...