@@ -13,43 +13,45 @@ property targetWindow: null
13
13
on run argv
14
14
set theURL to item 1 of argv
15
15
16
- tell application " Chrome"
16
+ with timeout of 2 seconds
17
+ tell application " Chrome"
17
18
18
- if (count every window) = 0 then
19
- make new window
20
- end if
19
+ if (count every window) = 0 then
20
+ make new window
21
+ end if
21
22
22
- -- 1: Looking for tab running debugger
23
- -- then, Reload debugging tab if found
24
- -- then return
25
- set found to my lookupTabWithUrl(theURL)
26
- if found then
27
- set targetWindow's active tab index to targetTabIndex
28
- tell targetTab to reload
29
- tell targetWindow to activate
30
- set index of targetWindow to 1
31
- return
32
- end if
23
+ -- 1: Looking for tab running debugger
24
+ -- then, Reload debugging tab if found
25
+ -- then return
26
+ set found to my lookupTabWithUrl(theURL)
27
+ if found then
28
+ set targetWindow's active tab index to targetTabIndex
29
+ tell targetTab to reload
30
+ tell targetWindow to activate
31
+ set index of targetWindow to 1
32
+ return
33
+ end if
33
34
34
- -- 2: Looking for Empty tab
35
- -- In case debugging tab was not found
36
- -- We try to find an empty tab instead
37
- set found to my lookupTabWithUrl(" chrome://newtab/" )
38
- if found then
39
- set targetWindow's active tab index to targetTabIndex
40
- set URL of targetTab to theURL
41
- tell targetWindow to activate
42
- return
43
- end if
35
+ -- 2: Looking for Empty tab
36
+ -- In case debugging tab was not found
37
+ -- We try to find an empty tab instead
38
+ set found to my lookupTabWithUrl(" chrome://newtab/" )
39
+ if found then
40
+ set targetWindow's active tab index to targetTabIndex
41
+ set URL of targetTab to theURL
42
+ tell targetWindow to activate
43
+ return
44
+ end if
44
45
45
- -- 3: Create new tab
46
- -- both debugging and empty tab were not found
47
- -- make a new tab with url
48
- tell window 1
49
- activate
50
- make new tab with properties {URL :theURL}
46
+ -- 3: Create new tab
47
+ -- both debugging and empty tab were not found
48
+ -- make a new tab with url
49
+ tell window 1
50
+ activate
51
+ make new tab with properties {URL :theURL}
52
+ end tell
51
53
end tell
52
- end tell
54
+ end timeout
53
55
end run
54
56
55
57
-- Function:
0 commit comments