/
DistanceNewProject.ahk
64 lines (51 loc) · 1.36 KB
/
DistanceNewProject.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
;;; AutoHotkey script - Create a new Distance project
#Include Config.ahk
#Include Utilities.ahk
SetWinDelay, %PauseTime% ; Recommend 1000 (milliseconds) at least
OpenLog(LogFile)
;;;
;;; Start Distance
;;;
AppendLog(LogFile, "Starting Distance")
Run %DistanceExe%
WinWait Distance
WinWaitActive Welcome ; Welcome to Distance
Send !o ; Click OK
AppendLog(LogFile, "Create Project (Design a new survey)")
AppendLog(LogFile, "Project directory: " ProjectDir)
AppendLog(LogFile, "Project name: " ProjectName)
Send !f!n ; Select File=>New...
WinWaitActive Create Project
Send %ProjectFile%
Send !c ; Click Create
WinWaitActive New Project
; Step 1: Type of Project
Send !d ; Design a new survey
Send !n ; Click Next
Send !f ; Finish
WinWaitActive Distance - %ProjectName%
IfNotExist, %ProjectFile%.dst
{
AppendLog(LogFile, "Project file: " ProjectFile ".dst cannot be found...Exiting")
Exit
}
IfNotExist, %ProjectDir%\%ProjectName%.dat
{
AppendLog(LogFile, "Project directory: " ProjectFile ".dat cannot be found...Exiting")
Exit
}
WinActivate Distance - %ProjectName%
;;;
;;; Exit
;;;
AppendLog(LogFile, "Exiting Distance")
Send !f!x ; Select File=>Exit...
WinWaitActive Distance Confirmation
Send !y ; Click Yes
Sleep %PauseTime% ; Wait extra time for exit
;;;
;;; Clean up
;;;
FileDelete, %ProjectFile%.dst
FileRemoveDir, %ProjectFile%.dat, 1
CloseLog(LogFile)