PowerAutomate to AutoHotKey - Browser manipulation, First Instance of Window

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
arcylix
Posts: 54
Joined: 27 Sep 2022, 14:43

PowerAutomate to AutoHotKey - Browser manipulation, First Instance of Window

Post by arcylix » 27 Jan 2023, 11:52

I'm in the process of wanting to ditch some of what I've created for PowerAutomate Desktop from Microsoft into AHK scripts. I've found AHK to be a bit more reliable and easier to work with despite the simplicity of PAD. The biggest hang-up I have is the browser automation aspect of it. I'm not sure I'm comprehending what I need to do to replicate the process in AHK, so I'm hoping someone here can help. Here are the steps that I go through with PAD:

1. I grab the active row information in an Excel worksheet (already know how to do this in AHK)
From here on out, this is what I am struggling with trying to figure out:
2. A specific tab is selected in Microsoft Edge (has to be Edge, used by work
3. Manipulate the URL to direct to a page based on the Excel information (for example, manipulating it to be: https://someexample.com/search?name=[excelname]&date=[exceldate])
4. Set a timer to watch for the URL to change from step three to the actual record information (it'll change to something like: https://somexample.com/results/action?id=123456)
4a. If it doesn't see a change in URL in 30 seconds, prompt with a 'Restart' message, which will end the thread. If no to restart, continue waiting and ask again in 30 seconds
5. If URL change is successful, end timer and stop the thread.

The reason for the timeouts is because sometimes the site being accessed is down for maintenance, so it provides the option to stop the thread and move on to my next task. How complicate would this be to automate using AHK? I'm still fairly new to it, but I've written a nice little hotkey script for many of the stuff I already do. Just really looking to expand things.

As a side request... how would I go about making only the FIRST window in a group be active with WinActive? Or how would I grab the PID for that particular window? For example, I have three Excel files open. File 1 is the one I grab information from. However, it seems that AHK will only activate the most recent active window rather than the first instance of it.

Is any of this actually possible, or am I living a pipe dream? Thanks!

Tre4shunter
Posts: 139
Joined: 26 Jan 2016, 16:05

Re: PowerAutomate to AutoHotKey - Browser manipulation, First Instance of Window

Post by Tre4shunter » 30 Jan 2023, 10:16

Hey @arcylix

You can probably 100% do you what are asking via AHK.

I also would maybe ask this question in a different forum - this one is for Finished AHK scripts for V2, not sure if you are working in V1 or V2 as well.

But for starters, if using V1 I into Chrome.ahk by Geekdude (there is now a V2 version as well) or Rufaydium. Both will allow you to manipulate web browsers like chrome/edge (both built on the chromium engine) to do what you want.

you could also use Webview2, by thqby, which utilizes the edge webview2 runtime.

Thanks

-Tre4

arcylix
Posts: 54
Joined: 27 Sep 2022, 14:43

Re: PowerAutomate to AutoHotKey - Browser manipulation, First Instance of Window

Post by arcylix » 30 Jan 2023, 12:16

@Tre4shunter

Well, it would certainly help if I read the description of the forum. Though to be fair, the person who approved this should have caught it, I feel! Thanks for the feedback. I will have to check out these options, though. And I'll repost this in the correct forum. For the record, it is V2 that I am using. Thanks again!


[Mod action: Topic moved from "AutoHotkey v2 Scripts and Functions"]

Post Reply

Return to “Ask for Help (v2)”