Repository Public MIT
1#!/bin/zsh2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : ORIX Astra8# File : Scripts/asc-safari.sh9# Module : Scripts10# Repository : https://git.spboucher.ai/orix-astra11# Created : 2026-11-2212# Last Modified : 2026-11-2213#14# Author : Simon-Pierre Boucher15# Position : Professor of Finance16# Institution : Université du Québec en Outaouais (UQO)17# Organization : SP Boucher18# Website : https://spboucher.ai19# Git : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License : Proprietary, all rights reserved (see license file)32# License File : LICENSE33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# usage: asc-jsfile.sh file.js (file defines: async function main(){...return string})42osascript - "$1" <<'OSA'43on run argv44 set js to read (POSIX file (item 1 of argv)) as «class utf8»45 tell application "Safari"46 repeat with w in windows47 repeat with t in tabs of w48 if (URL of t) contains "appstoreconnect.apple.com" then49 do JavaScript "window.__r='PENDING'; (async()=>{try{" & js & "; window.__r=String(await main())}catch(e){window.__r='ERR '+e}})();" in t50 repeat 80 times51 delay 0.552 set r to do JavaScript "window.__r" in t53 if r is not "PENDING" then return r54 end repeat55 return "TIMEOUT"56 end if57 end repeat58 end repeat59 end tell60end run61OSA62