-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathFcnLib-Opera.ahk
76 lines (66 loc) · 1.78 KB
/
FcnLib-Opera.ahk
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
72
73
74
75
#include FcnLib.ahk
;a more specialized version of runprogram("opera")?
RunOpera()
{
oldPath=C:\Program Files\Opera\opera.exe
newPath=C:\Program Files (x86)\Opera\opera.exe
if FileExist(oldPath)
Run, %oldPath%
else if FileExist(newPath)
Run, %newPath%
;TODO kill users command
ForceWinFocus("ahk_class (OperaWindowClass|OpWindow)", "RegEx")
if ForceWinFocusIfExist("Cannot start Opera")
{
while ProcessExist("opera.exe")
ProcessClose("opera.exe")
}
if ForceWinFocusIfExist("Welcome to Opera ahk_class (OperaWindowClass|OpWindow)", "RegEx")
{
Send, {ENTER}
ForceWinFocus("ahk_class (OperaWindowClass|OpWindow)", "RegEx")
}
}
CloseAllTabs()
{
ForceWinFocus("ahk_class (OperaWindowClass|OpWindow)", "RegEx")
Send, ^w
Sleep, 100
while (WinGetActiveTitle() != "Speed Dial - Opera")
{
Send, ^w
Sleep, 100
}
if (WinGetActiveTitle() == "Downloads - Opera")
Send, ^w
}
GoToPage(url)
{
if (url = "known")
url=http://dl.dropbox.com/u/789954/KnownTitle.html
ForceWinFocus("ahk_class (OperaWindowClass|OpWindow)", "RegEx")
Send, !d
Sleep, 100
Send, %url%
oldTitle:=WinGetActiveTitle()
Send, {ENTER}
WinWaitActiveTitleChange(oldTitle)
Sleep, 500
}
;Wait until the title of the active window changes
;(note that changing to another window sets it off, too)
WinWaitActiveTitleChange(oldTitle="")
{
;if they didn't give a title, try to grab the title as quickly as possible
;this is less reliable, but if we don't have the title, we'll just do the best we can
if (oldTitle == "")
WinGetActiveTitle, oldTitle
;loop until the window title changes
Loop
{
WinGetActiveTitle, newTitle
if (oldTitle != newTitle)
break
Sleep, 100
}
}