Javascript to ahk

Get help with using AutoHotkey and its commands and hotkeys
jim7181812
Posts: 16
Joined: 10 Jun 2016, 10:46

Javascript to ahk

07 Oct 2017, 08:00

I built an array in javascript, in a greasemonkey extension, in a browser that does not use COM. I'm trying to directly import it into AHK. Is there any way this can be done?
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Javascript to ahk

07 Oct 2017, 10:41

*Directly* import it? Well, there's FileRead (and related commands like Loop, Read). An example of where a greasemonkey script resides is in my firefox folder at C:\Users\Exaskryz\AppData\Roaming\Mozilla\Firefox\Profiles\idnumber.default\gm_scripts. You can get to here by typing in %appdata% and {enter} in your windows explorer, which brings you to the Roaming folder. Then navigate for your Browser Company then Browser. (Mozilla->Firefox; Moonchild Productions->Pale moon.) I'm not sure where to go for Chrome, as I don't have any Google or Chrome folder in my AppData\Roaming. And I can't find my expected extensions (AdBlock) inside of C:\Program Files (x86)\Google\Chrome\Application. I'm sure you can google for that bit though.

Or do you mean to import it by just copy and pasting into an editor and then translating the array into AHK syntax? Not sure on that one. But I feel like RegExReplace() or StrReplace() might be a useful tool.
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Javascript to ahk

07 Oct 2017, 11:55

If possible - write down the array to JSON file and then load it in AHK using JSON/JXON library.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
jim7181812
Posts: 16
Joined: 10 Jun 2016, 10:46

Re: Javascript to ahk

07 Oct 2017, 12:38

Thanks guys.

Return to “Ask For Help”

Who is online

Users browsing this forum: chill8888, Newbieyikes and 41 guests