Script stops finding a file?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Script stops finding a file?

Post by PepeLapiu » 28 May 2022, 00:41

So here is a function that makes a call to an other script:

Code: Select all

SPEAK(atuff) { 
		DetectHiddenWindows, on
		Sleep 200
		Loop {
			IfWinNotExist,speak.ahk
				break
			Sleep 200
		}
		Sleep 200
		DetectHiddenWindows, off
		IniWrite,%atuff%,waiting.ini,settings,speak
		Run, speak.ahk
	}
And here is the script we are making a call to:

Code: Select all

Sleep 200
IniRead,speak,waiting.ini,settings,speak
If(InStr(speak,"beep600")) {
	speak:= StrReplace(speak,"beep600", "", beep600count) ; SoundPlay,beep-05.wav
	SoundBeep,600,500
	Sleep,500
}
If(InStr(speak,"beep-5")) {
	speak:= StrReplace(speak,"beep-5", "", beep-5600count) ;
	SoundPlay,beep-05.wav
	Sleep,500
}
ComObjCreate("SAPI.SpVoice").Speak(speak)

If(beep600count=2)
	SoundBeep,600,500
If(beep-5600count=2)
	SoundPlay,beep-05.wav
IniDelete,waiting.ini,settings,speak
ExitApp
It's just a simple script that speaks the progress in a contract or tells me if an error is happening.
It works as planned for a while until I get the following error message:
Image
Why does it suddenly stop finding the speak.ahk script? You can clearly see it in the back on the right and it was found and used a few seconds before he error message.

I don't get it.

TrebleTA
Posts: 134
Joined: 20 Nov 2021, 06:44

Re: Script stops finding a file?

Post by TrebleTA » 28 May 2022, 02:35

Try

Code: Select all

Run, autohotkeyu64.exe speak.ahk,,hide
Be that or a path issule

User avatar
Smile_
Posts: 857
Joined: 03 May 2020, 00:51

Re: Script stops finding a file?

Post by Smile_ » 28 May 2022, 02:39

Before you run the speak.ahk script check the working directory using a message-box for example:

Code: Select all

...
MsgBox, % A_ScriptDir
Run, speak.ahk
...

User avatar
Xtra
Posts: 2744
Joined: 02 Oct 2015, 12:15

Re: Script stops finding a file?

Post by Xtra » 28 May 2022, 02:58

It wouldn't hurt to set the Run command WorkingDir parameter:

Code: Select all

Run, speak.ahk, % A_ScriptDir

User avatar
Smile_
Posts: 857
Joined: 03 May 2020, 00:51

Re: Script stops finding a file?

Post by Smile_ » 28 May 2022, 03:45

+1 for @Xtra

Post Reply

Return to “Ask for Help (v1)”