How can I make Vivaldi automatically click a few links when I visit a specific domain?
-
I'm creating a personal Minecraft server. I have ~500 mods in a folder. I have created a button in my file browser (Directory Opus) to Google search the selected filename. The top result is always the one I want. I then always have to click the "Files" link at the top, then I always have to click the "Show All Files" link then I always have to select "1.12.2" from the dropdown menu that appears...
I want Vivaldi to, at least temporarily, always click "Files" then "Show All Files" then select "1.12.2" whenever I open a new tab from my DOpus button.
Is this possible? I haven't experimented with commands chains too much. And frankly I can't even get Tab to focus on links on a webpage...
AutoHotkey is another option... maybe... I don't know how I would use it... because I think some banners or descriptions might be larger than others, meaning I can't use coordinates to automate clicks... unless I could strip everything first... I dunno.
Any thoughts would be appreciated. Edit: I never actually mentioned the website I'm referring to, not that it's really relevant I don't think - CurseForge, as you may have guessed. Thanks.
Edit2: Here's the jscript code for the button I "created" (read:found online)
function OnClick(data) { data.func.command.ClearFiles(); var objEnum = new Enumerator(data.func.sourcetab.selected); while (!objEnum.atEnd()) { var item = objEnum.item().name_stem; objEnum.moveNext(); var encoded = encodeURIComponent(item); var search = encoded.replace(/%/g,"%%"); data.func.command.RunCommand("http://www.google.com/search?q=" + search); } }
-
@dracho Hi - automating web page interactions is unfortunately not something command chains can do at this point.
Yes, AHK is powerful but a massive learning curve and very obtuse/horrible language to learn.
I recommend looking into some other alternatives. A quick search found:
https://chrome.google.com/webstore/detail/chromium-browser-automati/jmbmjnojfkcohdpkpjmeeijckfbebbon?hl=en
https://www.maketecheasier.com/extensions-automating-repetitive-browsing-tasks/
https://browserflow.app -
@pathduck Uh, why not? With a bookmarklet you should theoretically be able to click stuff on a page and this can be done through command chains. If this particular case would work out in the end, I canโt tell, someone needs to try it.
@dracho Take a look at command chain recipes, you might be able to come up with something yourself.
-
@luetage Oh yeah - in theory for sure. But I'm certainly not going to attempt coding it
-
I ended up using AHK, which has been working well so far.
I tried a couple extensions but they let me down. Did not play with command chains yet.
For anyone interested, here's my script:
;Minecraft 1.12.2 Mod Update Checker Script, for use with Directory Opus custom jscript button that searches Google. ;CapsLock key automatically clicks the first Google result, then clicks the "Files" link, then clicks the "View All link", then inputs "1.12.2" into the dropdown box. ;Do not edit the following 5 lines: #NoEnv SendMode Input SetWorkingDir %A_ScriptDir% #SingleInstance Force CoordMode, Mouse, Screen CapsLock:: Sleep, 500 ;Initial Sleep Click, 430, 280 ;Click first Google search result Sleep, 6000 ;wait for page to load Click 500, 350 ;Click Files link Sleep, 6000 ;wait for page to load Click, 1500, 40 ;Click address bar Sleep, 1000 ;Sleep so no double click Click, 1500, 40 ;Click address bar to place cursor at end Sleep, 200 ;small sleep Send {NumpadDiv}all ;Append "/all" to address Sleep, 200 ;small sleep Send {Enter} ;Navigate to "http:/...address/all" Sleep, 6000 ;wait for page to load Click, 1200, 400 ;Click dropdown box Sleep, 200 ;wait for dropdown to load Send 1.12.2 ;Send game version Sleep, 200 ;small sleep Send {Enter} ;Navigate to 1.12.2 page Esc::ExitApp ;when ESC is pressed, stop and exit.
You will need to customize coordinates based on your monitor resolution and window placement. To find coordinates, run this script:
;The following AHK script will display coordinates as a tooltip. ;Pressing PrintScreen button will copy coordinates to clipboard. #SingleInstance force #Persistent settimer start1, 0 return start1: CoordMode, ToolTip, Screen CoordMode, Mouse, Screen MouseGetPos xx, yy tooltip %xx% %yy%, 0, 0 PrintScreen:: clipboard = %xx%, %yy% return
edit: I did make a minor change: one of my auxiliary mouse buttons now directly runs the script and the script exits once it's done. The Escape button still terminates the script - helpful in the rare instance that CurseForge isn't the first search result.
On a side note, I find AHK to be almost relaxing. The syntax, especially for novices like me, seems easy and concise. Plus the huge helpful community surrounding it and virtually endless pre-made scripts makes automation decently easy... but unfortunately I usually use coordinate systems, meaning my scripts probably won't work for most other people without customization of coordinates, which can take a few minutes, and can change...
-
Does he need to click anything? I'd think there is something simple he could do to the URL to get there. That's what we don't know here, whether the buttons and links are encoded into the final URL somehow.
-
@sgunhouse Each link is specific. For example:
https://www.curseforge.com/minecraft/mc-mods/calculator
https://www.curseforge.com/minecraft/mc-mods/calculator/files
https://www.curseforge.com/minecraft/mc-mods/calculator/files/all
(This is the only link that doesn't stay at the same coordinates, as there are sometimes other versions above the "View All" link.
The "1.12.2" from the dropdown doesn't change the address. But at least it's in a consistent location.
I suppose I could skip a step and just append "/files/all" to the address. Thanks.
Other than that, I think it's "optimized" the best it can be. It doesn't help CurseForge is acting up at the minute...
edit: I also added a click on the Description link and a sleep command of a few seconds so I can skim the description, sometimes I don't need to go further than that.
-
@dracho Yeah @sgunhouse does have a point - assuming your goal is to always obtain the latest version - at least for that site it looks the URL will be consistent:
https://www.curseforge.com/minecraft/mc-mods/calculator/downloadAnd if the site admins wanted to make life easier for its users, they would make it easier by just skipping the download page outright, allowing users to directly download the latest version with the above URL. Could even be scripted completely without a browser.
But of course, then they would miss out on all that nice advertising revenue
-
@pathduck Actually my goal isn't that.
I am playing on version 1.12.2, which is actually quite old. I am trying to find the latest mod release for 1.12.2 only, therefore the /download link doesn't work, since most of the mods have 1.15 or 1.16 versions, which are the default downloads.
Unfortunately, there's no option to globally hide all versions of all mods except 1.12.2 compatible versions... Boy, I wish there was.
Also, the filename of the mod is sometimes different from the title of the mod listed on CurseForge. Mods are made by individuals, using their own naming schemes, so I can't just copy and paste, but actually Google search.
-
@dracho Could you give me an example search term? I would be surprised, if this wasnโt possible
-
Ppafflick moved this topic from Desktop on
-
The project is completed now, but here is my mods folder if you were still interested. Sorry for the late reply.
I highlight one, then press my mouse button to activate my macro which clicks the Google button in the toolbar, then clicks the links to download the mod. I'm surprised how well it worked, actually, but with uBlock Origin blocking a lot of content, links lined up nicely. I think I had to re-download 2 just because their names were so short, but it was trivial to open the Trashcan menu and see which links didn't start with "Downloading..."
Anyway, thanks for the help.