Change my Autokey script to AHK Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TheGene
Posts: 15
Joined: 09 Sep 2015, 10:16

Change my Autokey script to AHK

Post by TheGene » 28 May 2022, 09:38

Hi guys, I have a problem and need assistance? I used Autokey on Linux Mint for many many years now, nut am switching everything back to Windows now. I need a couple of lines of code in my OLD script to be updated -

It worked as follows - I'd have Firefox open but in background, so I need the script NOT to open a new instance but to simply return to the page I was on and complete the rest of the code.

In AUTOKEY I had:

Code: Select all


# Do prelim vars here, I'm fine with this part

#start firefox or switch to firefox
import subprocess
command = 'wmctrl -l'
output = system.exec_command(command, getOutput=True)

if 'Firefox' in output:
    window.activate('Firefox',switchDesktop=True)

else:
    subprocess.Popen(["/usr/bin/firefox"])
#
time.sleep(0.3)
mouse.click_absolute(544, 519, 1)

# Finish edits here, this is all good
This code would simply get some info from me, then open the browser to where I were last, and insert changed info and then let me check it all before saving.

I just need the correct code to duplicate what the old code did? If there's someone kind enough to help, please.

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Change my Autokey script to AHK  Topic is solved

Post by mikeyww » 29 May 2022, 02:23

Code: Select all

If WinExist(winTitle := "ahk_exe firefox.exe")
 WinActivate
Else Run, firefox.exe
WinWaitActive, %winTitle%,, 5
If !ErrorLevel
 MouseMove, 544, 519 ; See CoordMode

TheGene
Posts: 15
Joined: 09 Sep 2015, 10:16

Re: Change my Autokey script to AHK

Post by TheGene » 02 Jun 2022, 19:01

Thank you ever so much!!

Post Reply

Return to “Ask for Help (v1)”