wait while the exact sub-window exists

Discuss and share scripts and script files...
Post Reply
Posts: 138
Joined: 02 Feb 2015 05:02

wait while the exact sub-window exists

Post by suslo » 15 May 2018 06:13

this is the part of my working script:

Code: Select all

sendkeys "k"; wait 40000; sendkeys "e"
the problem is that i need to change the wait 40000 so that there were no necessity to wait 40s everytime
because sometimes 25s is enough (and sometimes even 10s is enough)

1. after sendkeys "k" is performed (the foobar's main window is active), a small foreground foobar's sub-window appears and begins the process of converting
this sub-window has the following settings:
program:                                          C:\Program Files\Foobar\foobar2000.exe
a part of the actual window caption:   Converting
window class:                                   #32770
2. after conversion is done, the sub-window automatically closes
then sendkeys "e" has to be automatically performed (the foobar's main window is active)
there should be a 3000ms delay after the sub-window was closed (and before sendkeys "e" was performed)

is it possible? if yes, how exactly should i change this part of my script?

Posts: 903
Joined: 20 Oct 2017 21:14
Location: 1809 x64

Re: wait while the exact sub-window exists

Post by jupe » 15 May 2018 06:27

You'll probably get better replies than this, but my suggestion would be launching a AutoHotKey script, with some combination of


or similar command, on a timer polling for the Window if need be, and then performing the functions, exiting, and then returning to your script.

edit: According to the below link you may be able to not have to use sendkeys, depending on the command you are sending it might be able to be done with /command:?????? via comand line, but again I haven't used foobar so am not sure.

http://wiki.hydrogenaud.io/index.php?ti ... line_Guide

Also If you are just converting audio files with these foobar commands, I would suggest using ffmpeg instead and automating the whole thing via CLi.

Posts: 138
Joined: 02 Feb 2015 05:02

Re: wait while the exact sub-window exists

Post by suslo » 15 May 2018 07:57

launching a AutoHotKey script
the whole idea is to have all necessary actions (which are related to this conversion) performed via 1 xyplorer's script
with some combination of
this is all i can do:

Code: Select all

SetTitleMatchMode, 1
SetKeyDelay, 3000

WinWait, Converting
Send e
Send ^k
^k is the continuation of my xy-script and it is sent to xyplorer's main window
but i don't even understand if this ahk-script is correct/complete
via comand line
not an option for me (moreover, i use sendkeys not only for foobar)
using ffmpeg instead and automating the whole thing
absolutely not an option too
the whole thing is already almost completely automated and the solution of this topic could become a substantial help

Posts: 7738
Joined: 06 Feb 2011 00:33

Re: wait while the exact sub-window exists

Post by highend » 15 May 2018 08:19

XY has no relevant external GUI control commands (like waiting for a window to be active, etc.) so no, trying to automate non-command line stuff with it won't work reliable. A simple "I activated a different window" during a wait command would logically send a key to a different window / screen...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Posts: 138
Joined: 02 Feb 2015 05:02

Re: wait while the exact sub-window exists

Post by suslo » 16 May 2018 07:04

1. plenty of changes were done in my xy-script (it is performing conversion from flac-tracks to flac-image with absolutely ready cue-file)
now the ahk-script looks like this:

Code: Select all

SetWinDelay 2000
SetTitleMatchMode 1

WinWait Converting

ControlSend, , {Ctrl down}{Shift down}k{Shift up}{Ctrl up}, XYplorer
ctrl+shift+k means automatic continuation of the xy-script
even though this ahk-script works flawlessly, i would like to specify: are there any mistakes? is something missing?

2. my xy-script is ready and working good. it consists of 2 parts:

Code: Select all

?wait 100; focus; wait 100; new("1.cue", "file"); wait 300; selfilter "*.flac"; wait 100; #1406; wait 100; sendkeys "~"; wait 2000; sendkeys "k"; wait 2000; runq "C:\(Programs)\ahk-script.exe"
a) #1406 means this code
b) sendkeys "~" means enqueuing of flac-tracks to foobar (without problems and limitations described here)
it was achieved due to some changes in: control panel -> folder options -> file types
c) sendkeys "k" means foobar -> convert

Code: Select all

wait 300; focus; wait 100; #251; wait 100; run "1.cue"; wait 500; sendkeys "~"; wait 100; sendkeys "+{Insert}"; wait 100; sendkeys "^{Home}"; wait 100; focus; wait 300; run "1.flac"; wait 2000; sendkeys "y"; wait 1500; focus; wait 300; run "1.flac"; wait 1500; sendkeys "t"; wait 1000; sendkeys "r"; wait 500; sendkeys "e"; wait 500; runq "C:\(Programs)\auto-it-script.exe"; wait 2000; focus; wait 100; attrstamp("r", 4, "<allitems |>"); wait 100; attrstamp("r", , "<curpath>\1.flac"); wait 100; selfilter "* - *.flac"; wait 100; delete 0, 1
d) run "1.flac" means enqueuing of flac-image to foobar
e) sendkeys "y" means foobar -> edit cuesheet
f) sendkeys "t" means foobar -> remove tags from files
g) sendkeys "r" means foobar -> clear
h) sendkeys "e" means foobar -> exit
i) auto-it-script.exe prepares a cue-file

this xy-script is the result which i have after spending many days
the sense of the whole idea: manual actions were reduced from 29 to 1 (without safety belts) or to 3 (with them)

but my scripting skills are very low so advices/remarks are welcomed

Post Reply