Skip to content

Commit

Permalink
Merge pull request #2319 from maxilampert/fix/ghostscript_ahk [ghosts…
Browse files Browse the repository at this point in the history
…cript.app:10.2.1 ghostscript:10.2.1]
  • Loading branch information
AdmiringWorm authored Nov 6, 2023
2 parents 8c499bc + 43abafe commit dfe679c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions automatic/ghostscript.app/ghostscript.app.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Ghostscript has been under active development for over 20 years, and offers an e
<releaseNotes>https://ghostscript.readthedocs.io/en/latest/News.html</releaseNotes>
<dependencies>
<dependency id="chocolatey-core.extension" version="1.3.3" />
<dependency id="autohotkey.portable" version="2.0" />
</dependencies>
</metadata>
<files>
Expand Down
6 changes: 6 additions & 0 deletions automatic/ghostscript.app/tools/ChocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ $packageArgs = @{
validExitCodes = @(0)
}

# silent install requires AutoHotKey after installer removed silent flag
$ahkFile = Join-Path $toolsPath "ghostscript.ahk"
$ahkProc = Start-Process -FilePath AutoHotkey.exe -ArgumentList "$ahkFile" -PassThru
Write-Debug "AutoHotKey start time:`t$($ahkProc.StartTime.ToShortTimeString())"
Write-Debug "AutoHotKey Process ID:`t$($ahkProc.Id)"

Install-ChocolateyInstallPackage @packageArgs

Remove-Item -Force -ea 0 "$toolsPath\*.$($packageArgs.fileType)*"
33 changes: 33 additions & 0 deletions automatic/ghostscript.app/tools/ghostscript.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#Requires AutoHotkey v2.0
#NoTrayIcon
#SingleInstance Force
#Warn
SetTitleMatchMode "RegEx"
exe_re := "gs.+.exe"

If WinWait("ahk_exe " exe_re, "Next >", 20)
ControlSend "{ENTER}",, "ahk_exe " exe_re
Else
exit 1

If WinWait("ahk_exe " exe_re, "I Agree", 20)
ControlSend "{ENTER}",, "ahk_exe " exe_re
Else
exit 1

If WinWait("ahk_exe " exe_re, "Install", 20)
ControlSend "{ENTER}",, "ahk_exe " exe_re
Else
exit 1

If WinWait("ahk_exe " exe_re, "Finish", 20)
ControlSend "{ENTER}",, "ahk_exe " exe_re
Else
exit 1

if WinWait("ahk_exe " exe_re, "OK", 20)
ControlSend "{ENTER}",, "ahk_exe " exe_re
Else
exit 1

ExitApp

0 comments on commit dfe679c

Please sign in to comment.