What would be the AutoHotkey code to put in for this? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
africanking223

What would be the AutoHotkey code to put in for this?

23 Oct 2015, 15:40

I have a program on my computer that, when its running, every few minutes a windows would pop up saying to "Continue free trial". I need an AHK code that states that, whenever this windows pops up while the program is running, to automatically press "Continue free trial". Can someone tell me the code to copy/paste into AHK script?

The program is called "Launch Wallpaper.exe", if that helps. Tell me if you need any other information for the script, like the .exe location or something.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: What would be the AutoHotkey code to put in for this?

23 Oct 2015, 17:11

Try this:

Code: Select all

#SingleInstance, Force
#Persistent
SetTimer, Watchdog
Return


Watchdog:
    If WinExist("ahk_exe Launch Wallpaper.exe")
        ControlClick, Continue free trial
Return
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: What would be the AutoHotkey code to put in for this?

23 Oct 2015, 19:46

What happens if you don't press Continue Free Trial? Having it pop up every few minutes would sound like it would be annoying. How about using WinHide, which would hopefully hide the window from your view, but also not have this program keep popping up new windows as a pop up is already present? I would guess this author wouldn't make it so someone who goes AFK for an hour or two comes back to a dozen or more pop ups of the same thing.

(Testing something: WinHide)
africanking223

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 14:35

wolf_II wrote:Try this:

Code: Select all

#SingleInstance, Force
#Persistent
SetTimer, Watchdog
Return


Watchdog:
    If WinExist("ahk_exe Launch Wallpaper.exe")
        ControlClick, Continue free trial
Return
This doesn't work. There seems to be a misunderstanding in the code. The popup doesn't happen as soon as I open the program. It happens a few minutes after I open the program in a window. So, in the program, in a window, it says "Continue free trial" and I need a code that recognizes that when that popup comes up in the the program, to press "Continue free trial.
africanking223

Re: What would be the AutoHotkey code to put in for this?  Topic is solved

24 Oct 2015, 14:42

africanking223 wrote:
wolf_II wrote:Try this:

Code: Select all

#SingleInstance, Force
#Persistent
SetTimer, Watchdog
Return


Watchdog:
    If WinExist("ahk_exe Launch Wallpaper.exe")
        ControlClick, Continue free trial
Return
This doesn't work. There seems to be a misunderstanding in the code. The popup doesn't happen as soon as I open the program. It happens a few minutes after I open the program in a window. So, in the program, in a window, it says "Continue free trial" and I need a code that recognizes that when that popup comes up in the the program, to press "Continue free trial.
Also, the popup windows title says "Video Wallpaper and Video Screensaver" (no quotes).
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 15:21

try replacing one line:

Code: Select all

If WinExist("Video Wallpaper and Video Screensaver")
africanking223

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 15:46

Exaskryz wrote:What happens if you don't press Continue Free Trial? Having it pop up every few minutes would sound like it would be annoying. How about using WinHide, which would hopefully hide the window from your view, but also not have this program keep popping up new windows as a pop up is already present? I would guess this author wouldn't make it so someone who goes AFK for an hour or two comes back to a dozen or more pop ups of the same thing.

(Testing something: WinHide)
If I don't press "Coninue free trial" then nothing happens. I need to press "Coninue free trial" to continue the program. The program doesn't exit, it just stops.
africanking223

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 15:50

wolf_II wrote:try replacing one line:

Code: Select all

If WinExist("Video Wallpaper and Video Screensaver")
Still doesn't work. Like I stated, the popup window opens a few minutes or so after I open the program LaunchWallpaper.exe . The windows name is Video Wallpaper and Video Screensaver. What I want to accomplish is, whenever this window popups up in the LaunchWallpaper program, I need the AHK code to automatically press Continue free trial. Is this possible or not?
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 16:09

If Window Spy can detect the popup window and the button, then it can be done easily. What info do you get from Window Spy?
(Window Spy is available via: Right click on the green "H"-icon in the systemtray)
africanking223

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 22:03

wolf_II wrote:If Window Spy can detect the popup window and the button, then it can be done easily. What info do you get from Window Spy?
(Window Spy is available via: Right click on the green "H"-icon in the systemtray)
never mind, it works now. I just happened to misspell something in the code. I have another question though. Is there anything I can add to the code to make it run everytime my computer starts? Also, is there anything I can add to the code to make the window, when it pops up, to not be the active window? The reason being I don't want the windows to interrupt me while I'm in the middle of playing a fullscreen game.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: What would be the AutoHotkey code to put in for this?

24 Oct 2015, 22:34

I know of no AHK code to prevent an external program from taking window focus when it pops up a window. The ControlClick should avoid AHK making the window active, but it won't stop your wallpaper program from making the window active.

You might get a quicker response by using WinWait in the timer, but it will still interrupt your game.

To make your script run when it autostarts, if you're not on Windows 10, stick the script itself or a shortcut (.lnk) to the script inside of your StartUp folder. On Windows 8.1 it is at %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup. Not sure if that's the same on other OS's.
africanking223

Re: What would be the AutoHotkey code to put in for this?

25 Oct 2015, 00:02

Exaskryz wrote:I know of no AHK code to prevent an external program from taking window focus when it pops up a window. The ControlClick should avoid AHK making the window active, but it won't stop your wallpaper program from making the window active.

You might get a quicker response by using WinWait in the timer, but it will still interrupt your game.

To make your script run when it autostarts, if you're not on Windows 10, stick the script itself or a shortcut (.lnk) to the script inside of your StartUp folder. On Windows 8.1 it is at %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup. Not sure if that's the same on other OS's.
And if you're on Windows 10?
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: What would be the AutoHotkey code to put in for this?

25 Oct 2015, 12:58

Windows 10 does not play well with the start up I guess. I have not been on Windows 10 but have seen numerous reports on the AHK forums with people struggling to get their scripts to launch at start up. You might search the forums for a solution, if anyone has one. People have tried the Task Scheduler as a way to launch the AHK script, but that appears to not have worked.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: What would be the AutoHotkey code to put in for this?

26 Oct 2015, 03:53

There appears to be a bug in Windows 10 which prevents Task Scheduler from starting a script (such as a vbs or ahk file, not an executable) if the path or filename contains spaces.

It is not at all difficult to do on Windows 10, as long as you follow two rules:
  1. Do not set AutoHotkey.exe to "run as administrator".
    If a program which requires admin rights is put in the Startup folder, Windows Vista will show a "blocked programs" popup showing that it prevented the program from starting. Windows 10 (and probably any versions in between) will just ignore the program. Some users set AutoHotkey.exe to run as administrator to work around some other problems, but there are better solutions.
  2. If using Task Scheduler, set the task to launch a program, not a script/document.
    In other words, set the target to AutoHotkey.exe and pass the script filename as a parameter.
Btw, the AutoHotkey variable A_Startup returns the path of the current user's Startup folder.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750, nacken012 and 223 guests