I've found a way :D
There is a third party open source app called Autohotkey ( https://www.autohotkey.com ).
I modified an example from their forum (Example 2 - SetTimer https://www.autohotkey.c...s/viewtopic.php?t=120588 )
I have very limited programming knowledge - so don't ask me what all that array stuff at the end is - it just works for me ;)
This is the code for the Autohotkey script:
#Requires AutoHotkey v2
SetTimer(WinOpenClose, 2000) ; Calls the function WinOpenClose every 2000 milliseconds
Persistent() ; We have no hotkeys, so Persistent is required to keep the script going
WinOpenClose() {
static lastOpenWindows := ListOpenWindows()
currentOpenWindows := ListOpenWindows()
for hwnd in SortedArrayDiff([currentOpenWindows*], [lastOpenWindows*]) {
if !lastOpenWindows.Has(hwnd) {
info := currentOpenWindows[hwnd]
if (info.title = "Finished" || info.title = "DAZStudio") {
ToolTip(info.title "popup closed")
SetTimer(ToolTip, -3000)
WinClose(info.title)
}
} else {
info := lastOpenWindows[hwnd]
if (info.title = "DAZStudio") {
ToolTip(info.title " exiting script")
SetTimer(ToolTip, -3000)
SetTimer(WinOpenClose, 0)
ExitApp
}
}
}
lastOpenWindows := currentOpenWindows
ListOpenWindows() { ; Returns Map where key=window handle and value={title, class, processName}
openWindows := Map()
for hwnd in WinGetList()
try openWindows[hwnd] := {title: WinGetTitle(hwnd), class:WinGetClass(hwnd), processName: WinGetProcessName(hwnd)}
return openWindows
}
SortedArrayDiff(arr1, arr2) { ; also accounting for array length difference
i := 1, j := 1, n := arr1.Length, m := arr2.Length, diff := []
while (i <= n && j <= m) {
if arr1[i] < arr2[j] {
diff.Push(arr1[i]), i++
} else if arr2[j] < arr1[i] {
diff.Push(arr2[j]), j++
} else {
i++, j++
}
}
while i <= n
diff.Push(arr1[i]), i++
while j <= m
diff.Push(arr2[j]), j++
return diff
}
}
line 13 contains every "OK-Popup Window title" seperated by || , for my purpose "Finished" and "DAZStudio" if you have other popups you have to change / add them:
if (info.title = "Finished" || info.title = "second popup title" || info.title = "third popup title" || info.title = "DAZStudio") {
line 20 defines my Endpoint - after closing "DAZStudio" Popup the script will end itself:
if (info.title = "DAZStudio") {
You can find the Popup titles either by reading their title or by using "window spy" from the autohotkey dash (start it and hover your mouse over the desired popup)
@lightBLUE:
- If I had a way to start the script or an ".exe" with your Autoload script automatically that would be quite handy - is it possible?
- Also I'm loading way more than 4 files on a node. With your script I have to select the node, select 4 files, accept, confirm adding another node and repeating the process again. Is there a way to increase the number of files added to one node in one window? Maybe configurable to adjust to your own screen size...
- I'm adding .duf and .dsa - the script can handle both. The standard selection in the file dialog is only .duf and I have to manually switch to .dsa quite often. Would it be possible to add a third filter option including .duf, .dsa and .dse as default option? Or a way to let me define that as default?
I don't think there will ever be a solution for an auto OK from DAZ itself. Since they can't even add a basic function like "cancel whatever is happening right now?"... (eg. dforce explosion or loading big assets ;)