Script to add plugin to FF

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
MileHiDave
Posts: 17
Joined: 10 Dec 2020, 14:36

Script to add plugin to FF

03 May 2024, 12:58

Hello,

This script should work. I admit, I am still fairly new to V2.

Any pointers as to what I did wrong, or to scripting help, would be appreciated:

Code: Select all

#f::
{If WinExist('ahk_class MozillaWindowClass')
	Send "^T"
	Sleep 500
	SendInput "{Raw}about:debugging#/runtime/this-firefox"

	Sleep 500
	Send "{Tab 6}"
	WinWaitActive ("firefox.exe")
	SendInput  "{Raw}C:\Dir1\Dir2\manifest.json"
	Send "{Enter}"
}		


Thanks,
Dave

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
[Mod edit: Since this is a help request, moved from 'Scripts and Functions'.]
User avatar
boiler
Posts: 17175
Joined: 21 Dec 2014, 02:44

Re: Script to add plugin to FF

03 May 2024, 16:05

MileHiDave wrote: This script should work.
Good to be confident, I guess. ;) Several things that I spot:

Don't send a capital letter for ^t because it can cause it to hold Shift as well.

Don't put a space between a function name and the open parenthesis that follows it when calling a function.

This is most likely the showstopper: The process name is not the window title. To use the process name for the WinTitle parameter, it needs to be preceded by ahk_exe:

Code: Select all

	WinWaitActive ("ahk_exe firefox.exe")
In case you're expecting a difference between Send and SendInput, the default Send mode in v2 is already Input, so there's no need to use SendInput as long as you don't change the mode.

Do you realize that the only line that's conditionally executed after the if is the one immediately following it since you didn't group multiple lines into a code block? Your indenting would suggest that you expect everything after it to be conditional.

There may be other issues regarding timing and expecting windows to be come active.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: CoffeeChaton, Felix Siano, ntepa and 28 guests