execute javascript on Mozilla Firefox with scratchpad

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

execute javascript on Mozilla Firefox with scratchpad

09 Feb 2014, 08:56

I am using this to send searchitems to a website from Excel.
Opening Mozillas Scratchpad (Shift-F4) you can paste javascript and execute it.
Its not very sophisticated but it works well.

Code: Select all

txt:= "alert('hallo world')"
scratchpad(txt)
return

scratchpad(code){
	Sleeptime:=200
	;translate this if you are not using a german Firefox
	scratchpadtitle:="JavaScript-Umgebung"
	closingpadtitel:="Änderungen nicht gespeichert"

	IfWinExist , ahk_class MozillaWindowClass
	{
		x:=Clipboard
		clipboard:=code
		WinActivate , ahk_class MozillaWindowClass
		send, +{F4}
		WinWaitActive, %scratchpadtitle%
		WinHide, %scratchpadtitle%
		WinMinimize 
		BlockInput, on
		SendInput,^v
		Sleep,%Sleeptime%
		SendInput,^r
		Sleep,%Sleeptime%
		SendInput,^w
		WinWaitActive, %closingpadtitel%
		WinHide, %closingpadtitel%
		send,!n
		BlockInput, Off
		clipboard:=x
	}	
return	
}


Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 178 guests