forked from skoji/Readium-Web-Components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrome.sh
executable file
·71 lines (45 loc) · 3.07 KB
/
chrome.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
./build.sh
root=$(pwd)
#HTML1="'file://"${root}"/epub-fixed/view_testing/fixed_view.html'"
#HTML1="\"file://"${root}"/epub-fixed/view_testing/fixed_view.html\""
HTML1="file://"${root}"/epub-modules/epub-fixed/view_testing/fixed_view.html"
HTML1=$(echo ${HTML1} | sed 's/ /%20/g')
echo ${HTML1}
HTML2="file://"${root}"/epub-modules/epub-reader/view_testing/reader_view.html"
HTML2=$(echo ${HTML2} | sed 's/ /%20/g')
echo ${HTML2}
HTML3="file://"${root}"/epub-modules/epub-reflowable/view_testing/reflowable_view.html"
HTML3=$(echo ${HTML3} | sed 's/ /%20/g')
echo ${HTML3}
HTML4="file://"${root}"/samples-project-testing/test_site/reader_view.html"
HTML4=$(echo ${HTML4} | sed 's/ /%20/g')
echo ${HTML4}
CHROME_APP=$(ls /Applications/ | grep Chrome | head -n 1)
#CHROME_APP='Google\\ Chrome\\ BETA.app'
echo ${CHROME_APP}
#CHROME_APP_PATH="'/Applications/"${CHROME_APP}"'"
#CHROME_APP_PATH="\"/Applications/"${CHROME_APP}"\""
CHROME_APP_PATH="/Applications/"${CHROME_APP}
#CHROME_APP_PATH=$(echo ${CHROME_APP_PATH} | sed 's/ /\\ /g')
echo ${CHROME_APP_PATH}
osascript -e "tell application \"${CHROME_APP}\"" -e "set chromewindows to every window" -e "repeat with chromewindow in chromewindows" -e "set windowtabs to every tab of chromewindow" -e "repeat with windowtab in windowtabs" -e "tell windowtab" -e "delete" -e "end tell" -e "end repeat" -e "end repeat" -e "end tell"
osascript -e "tell application \"${CHROME_APP}\" to activate"
osascript -e "delay 2" -e "tell application \"${CHROME_APP}\"" -e "tell application \"System Events\"" -e "keystroke \"q\" using {command down}" -e "end tell" -e "end tell" -e "delay 2"
function activateStuff(){
osascript -e "tell application \"${CHROME_APP}\" to activate"
osascript -e "delay 2" -e "tell application \"${CHROME_APP}\"" -e "tell application \"System Events\"" -e "keystroke \"j\" using {command down, option down}" -e "end tell" -e "end tell"
#-e "tell process \"Google Chrome\"" -e "click menu item \"JavaScript Console\" of menu 1 of menu item \"Developer\" of menu 1 of menu bar item \"View\" of menu bar 1" -e "end tell" -e "end tell" -e "end tell"
#osascript -e "tell application \"${CHROME_APP}\" to tell the active tab of its first window" -e "reload" -e "end tell"
#osascript -e "do shell script \'${CHROME_APP_COMMAND}\'"
}
open -a "${CHROME_APP_PATH}" --args --disable-application-cache --disable-web-security -–allow-file-access-from-files --incognito ${HTML4}
activateStuff
#open -a "${CHROME_APP_PATH}" --args --disable-application-cache --disable-web-security -–allow-file-access-from-files --incognito ${HTML2}
osascript -e "tell application \"${CHROME_APP}\"" -e "set myTab to make new tab at end of tabs of window 1" -e "set URL of myTab to \"${HTML3}\"" -e "end tell"
activateStuff
osascript -e "tell application \"${CHROME_APP}\"" -e "set myTab to make new tab at end of tabs of window 1" -e "set URL of myTab to \"${HTML2}\"" -e "end tell"
activateStuff
osascript -e "tell application \"${CHROME_APP}\"" -e "set myTab to make new tab at end of tabs of window 1" -e "set URL of myTab to \"${HTML1}\"" -e "end tell"
activateStuff
exit