전면에 가져올 새 Chrome 인스턴스 (아래 스크립트 참조)를 어떻게 시작할 수 있는지 궁금합니다. 현재 셸 스크립트는 백그라운드에서 새 Chrome 인스턴스를 엽니 다.이 인스턴스는 최적 상태가 아닙니다. Applescript에서 쉘 스크립트를 실행해도이 문제를 해결할 수 없습니다.Chrome을 스크립트에서 시작하여 앞으로 가져 오기
set q to "'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --user-data-dir=/tmp/1234"
do shell script q
AppleScript를
do shell script "~/bin/chrome-fresh"
쉘 스크립트
:재미있는 것은 내가 애플 스크립트에서 직접 쉘 명령어를 사용하여 크롬을 열 경우 전경에서 열 것이다
#!/bin/sh
# This is quite useful for front-enders, as it will launch a fresh
# Chrome instance with no loaded plugins or extensions that messes
# with your performance profiling or network debugging
#
# Install:
# install -m 555 ~/Downloads/chrome-fresh /usr/local/bin/
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
ARGS="[email protected]"
# make a fresh user directory
TMP_USERDIR=$(mktemp -d);
# avoid the dialog on the first startup
touch "$TMP_USERDIR/First Run";
# start chrome using a fresh user directory
"$CHROME" --user-data-dir="$TMP_USERDIR" "$ARGS"
의 명령은 앞에 해당 응용 프로그램을 제공합니다 '응용 프로그램 "XXX"를 말할 활성화'마지막 명령의 프로세스 ID를 얻을 수 있습니다. – pbell
알지만 Chrome 인스턴스가 여러 개 있습니다. 마지막 하나를 어떻게 제어하나요? 피디? – oligofren
'응용 프로그램 "XXX"의 마지막 창에 활성화를 알리십시오 -이 방법은 작동하지 않지만 시작해야합니다. 나는 그것을 확인하고 작동하게 만들었지 만 나는 지금 창문에있다. –