Repository Public
1#!/bin/zsh2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : Claude Remote / Codex Remote8# File : Scripts/asc-safari.sh9# Module : Scripts10# Repository : https://git.spboucher.ai/claude-remote-apple11# Project Website : https://claude.spboucher.ai12# Created : 2026-11-2913# Last Modified : 2026-11-2914#15# Author : Simon-Pierre Boucher16# Position : Professor of Finance17# Institution : Université du Québec en Outaouais (UQO)18# Organization : SP Boucher19# Website : https://spboucher.ai20# Git : https://git.spboucher.ai21#22# Preferred Contact: support@spboucher.ai23# Technical Contact: dev@spboucher.ai24# Security/Admin : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License : None specified (no license file in this repository)33#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