Skip to content

Commit

Permalink
Merge pull request #18 from WoosterFromWA/major_overhaul
Browse files Browse the repository at this point in the history
Major overhaul
  • Loading branch information
WoosterInitiative authored Feb 22, 2019
2 parents 67dc198 + 3ccd8de commit b2b118b
Show file tree
Hide file tree
Showing 48 changed files with 456 additions and 289 deletions.
27 changes: 17 additions & 10 deletions 3CX.ahk
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
3CXFocus(paste:=0) ; function that actually does stuff... defaults to just clearing any existing input
{
global 3cxSleep
if WinExist("ahk_exe 3CXWin8Phone.exe")
{
winid := WinExist("ahk_exe 3CXWin8Phone.exe")
}

if winid
{
WinActivate
WinActivate
Expand All @@ -20,7 +16,7 @@
return
}

Sleep, 500
Sleep, %3cxSleep%

SendInput, {Esc} ; clear text from 3CX window

Expand All @@ -33,17 +29,28 @@ return
}

#SingleInstance, force
Menu, Tray, Icon, red_q_on_blue_bkgd.ico
Menu, Tray, Icon, images\red_q_on_blue_bkgd.ico
Menu, Tray, Tip, QI Tools: 3CX

^!\:: ; ctrl+alt+\ switches to 3CX and readies it for number entry (if on number page)
F12::
; Define INI file location
pathINI = %A_AppData%\Quest Integration\QI Tools.ini

; Read INI file (all times in ms); last values on each line are defaults
IniRead, 3cxSleep, %pathINI%, 3CX, 3cxSleep , 100 ; Time to wait before sending input
IniRead, numEnter, %pathINI%, 3CX, numEnter, F11 ; Key to use for copy number
IniRead, phoneFocus, %pathINI%, 3CX, phoneFocus, F12 ; Key to use to bring 3CX to focus

Hotkey, %numEnter%, copyNumber
Hotkey, %phoneFocus%, pFocus
return

pFocus:

3CXFocus()

return

F11:: ; copy text in active window and paste into 3CX
copyNumber: ; copy text in active window and paste into 3CX

SendInput, {End}+{Home}^c ; select all text in active box

Expand Down
5 changes: 5 additions & 0 deletions Basic Shortcuts.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#SingleInstance, force ; Forces only one instance, allows to re-run script without reloading
Menu, Tray, Icon, images\red_q_on_blue_bkgd.ico ; Icon for this script
Menu, Tray, Tip, QI Tools: Basic Shortcuts ; Change tooltip on icon in tray

SetNumLockState, AlwaysOn
17 changes: 9 additions & 8 deletions GMSearch.ahk
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#SingleInstance, force
Menu, Tray, Icon, red_q_on_blue_bkgd.ico
Menu, Tray, Icon, images\red_q_on_blue_bkgd.ico
Menu, Tray, Tip, QI Tools: GoldMine Search
; SetTitleMatchMode, 2

^!=:: ; ctrl+alt+= clears search in GM
^!=:: ; ctrl+alt+= clears search in GM
; winid := WinExist()
if WinExist("ahk_exe gmw.exe") { ; check if GoldMine is running
if WinExist("ahk_exe gmw.exe") { ; check if GoldMine is running
winid := WinExist("ahk_exe gmw.exe")
} else if WinExist("ahk_exe mstsc.exe") { ; check if RDP is running (assumed GM is what is being run in RDP)
winid := WinExist("ahk_exe mstsc.exe")
} else if WinExist("gm rdp ahk_exe mstsc.exe") { ; check if RDP is running (assumed GM is what is being run in RDP)
winid := WinExist("gm rdp ahk_exe mstsc.exe")
} else {
MsgBox, 8256, Not Running, GoldMine is not running; cancelling, 5 ; task modal (8192), icon asterisk/exclamation (64), times out after 5 seconds
return
}
; MsgBox %winid% ; debugging only
; MsgBox %winid% ; debugging only
if winid
{
InputBox, var, Name, Name to Search For
Expand All @@ -29,6 +30,6 @@ if winid
return
}

Click, 200, 90 ; clicks in search field of GM
SendInput, ^a%var%{Enter} ; selects all and clears text
Click, 200, 90 ; clicks in search field of GM
SendInput, ^a%var%{Enter} ; selects all and clears text
return
7 changes: 6 additions & 1 deletion QI Tools.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
#awayInterval=15
#roundInterval=5
#onCallPos="80,500"
#onCallColors="0x0000FF,0x575757,0xC1C1C1,0xFF0000"
#onCallColors="0x0000FF,0x575757,0xC1C1C1,0xFF0000"

[3CX]
#3cxSleep=100
#numEnter=F11
#phoneFocus=F12
182 changes: 150 additions & 32 deletions QI Tools.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
!define VERSIONBUILD 11
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link
!define UPDATEURL "http://..." # "Product Updates" link
!define ABOUTURL "http://..." # "Publisher" link
; !define HELPURL "http://..." # "Support Information" link
; !define UPDATEURL "http://..." # "Product Updates" link
; !define ABOUTURL "http://..." # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
; !define INSTALLSIZE 7233

Expand All @@ -30,17 +30,33 @@ InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
; LicenseData "license.rtf"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
Icon "red_q_on_blue_bkgd.ico"
outFile "QI Tools-installer.exe"
Icon "images\red_q_on_blue_bkgd.ico"
outFile "QI Tools.exe"
RequestExecutionLevel admin

!include LogicLib.nsh
!include FileFunc.nsh
!include nsProcess.nsh
!include nsDialogs.nsh
!include Sections.nsh
!include MUI2.nsh

!define MUI_ICON "images\red_q_on_blue_bkgd.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "image\red_q_on_blue_bkgd.bmp"
!define MUI_FINISHPAGE_RUN "$INSTDIR\run all.bat"
!define MUI_FINISHPAGE_RUN_TEXT "Run All Installed Scripts"

Insttype "Standard Install"
Insttype "Full Install"
; Insttype "Custom Install"

# Just three pages - license agreement, install location, and installation
; page license
page directory
Page instfiles
; page custom nsDialogsCustom
; page components
; page directory
; Page instfiles

; !macro VerifyUserIsAdmin
; UserInfo::GetAccountType
Expand All @@ -56,19 +72,41 @@ Page instfiles
; setShellVarContext all
; ; !insertmacro VerifyUserIsAdmin
; functionEnd

Function .onInit
setOutPath $INSTDIR
FunctionEnd

section "install"
; Section "Common Files (Required)"
; SectionIn RO

; setOutPath $INSTDIR

; file "images\red_q_on_blue_bkgd.ico"

; setOutPath "$APPDATA\${COMPANYNAME}"

; file "QI Tools.ini"

; SectionEnd

section "Common Files (Required)"
SectionIn RO

# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
setOutPath $INSTDIR
; setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
file "3cx.exe"
file "GMSearch.exe"
file "Quick Status Change.exe"
file "Window Switching.exe"
; file "3cx.exe"
; file "GMSearch.exe"
; file "Quick Status Change.exe"
; file "Window Switching.exe"
; file "Basic Shortcuts.exe"

# Add any other files for the install directory (license files, app data, etc) here
; CreateDirectory "$INSTDIR"
file "images\red_q_on_blue_bkgd.ico"
file "run all.bat"
file /oname=images\red_q_on_blue_bkgd.ico images\red_q_on_blue_bkgd.ico
file /oname=images\q_on_red_bkgd.ico images\q_on_red_bkgd.ico

${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
Expand All @@ -84,13 +122,14 @@ section "install"

# Start Menu
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\3CX.lnk" "$INSTDIR\3cx.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\GoldMine Search.lnk" "$INSTDIR\GMSearch.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Quick Status Change.lnk" "$INSTDIR\Quick Status Change.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Window Switching.lnk" "$INSTDIR\Window Switching.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\Run All.lnk" "$INSTDIR\run all.bat" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
; createShortCut "$SMPROGRAMS\${COMPANYNAME}\GoldMine Search.lnk" "$INSTDIR\GMSearch.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
; createShortCut "$SMPROGRAMS\${COMPANYNAME}\Quick Status Change.lnk" "$INSTDIR\Quick Status Change.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
; createShortCut "$SMPROGRAMS\${COMPANYNAME}\Window Switching.lnk" "$INSTDIR\Window Switching.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
; createShortCut "$SMPROGRAMS\${COMPANYNAME}\Basic Shortcuts.lnk" "$INSTDIR\Basic Shortcuts.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"

createShortCut "$SMSTARTUP\3CX.lnk" "$INSTDIR\3cx.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
createShortCut "$SMSTARTUP\Quick Status Change.lnk" "$INSTDIR\Quick Status Change.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
; createShortCut "$SMSTARTUP\3CX.lnk" "$INSTDIR\3cx.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"
; createShortCut "$SMSTARTUP\Quick Status Change.lnk" "$INSTDIR\Quick Status Change.exe" "" "$INSTDIR\red_q_on_blue_bkgd.ico"

# Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}"
Expand All @@ -99,10 +138,10 @@ section "install"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\images\red_q_on_blue_bkgd.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\red_q_on_blue_bkgd.ico$\""
; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\images\red_q_on_blue_bkgd.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
Expand All @@ -114,11 +153,79 @@ section "install"
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd

Section "3CX Click-to-Dial"
SectionIn 1 2

setOutPath $INSTDIR

file "3cx.exe"

createShortCut "$SMPROGRAMS\${COMPANYNAME}\3CX Click-to-Dial.lnk" "$INSTDIR\3cx.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Add to start menu
createShortCut "$SMSTARTUP\3CX Click-to-Dial.lnk" "$INSTDIR\3cx.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Launch on startup

SectionEnd

Section "Teams Status Change"
SectionIn 1 2

setOutPath $INSTDIR

file "Teams Status.exe"
file /oname=images\q_on_green_bkgd.ico images\q_on_green_bkgd.ico
file /oname=images\q_on_red_bkgd.ico images\q_on_red_bkgd.ico
file /oname=images\q_on_yellow_bkgd.ico images\q_on_yellow_bkgd.ico

createShortCut "$SMPROGRAMS\${COMPANYNAME}\Teams Status Change.lnk" "$INSTDIR\Teams Status.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Add to start menu
createShortCut "$SMSTARTUP\Teams Status Change.lnk" "$INSTDIR\Teams Status.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Launch on startup

SectionEnd

Section "GoldMine Search"
SectionIn 2

setOutPath $INSTDIR

file "GMSearch.exe"

createShortCut "$SMPROGRAMS\${COMPANYNAME}\GoldMine Search.lnk" "$INSTDIR\GMSearch.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Add to start menu
createShortCut "$SMSTARTUP\GoldMine Search.lnk" "$INSTDIR\GMSearch.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Launch on startup

SectionEnd

Section "Window Switching"
SectionIn 2

setOutPath $INSTDIR

file "Window Switching.exe"

createShortCut "$SMPROGRAMS\${COMPANYNAME}\Window Switching.lnk" "$INSTDIR\Window Switching.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Add to start menu
createShortCut "$SMSTARTUP\Window Switching.lnk" "$INSTDIR\Window Switching.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Launch on startup

SectionEnd

Section "Basic Shortcuts"
SectionIn 2

setOutPath $INSTDIR

file "Basic Shortcuts.exe"

createShortCut "$SMPROGRAMS\${COMPANYNAME}\Basic Shortcuts.lnk" "$INSTDIR\Basic Shortcuts.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Add to start menu
createShortCut "$SMSTARTUP\Basic Shortcuts.lnk" "$INSTDIR\Basic Shortcuts.exe" "" "$INSTDIR\images\red_q_on_blue_bkgd.ico" ; Launch on startup

SectionEnd

; !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

# Uninstaller

function un.onInit
SetShellVarContext all
; SetShellVarContext all

#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Expand All @@ -132,16 +239,22 @@ section "uninstall"
# Kill all processes
${nsProcess::KillProcess} "3cx.exe" $R0
${nsProcess::KillProcess} "GMSearch.exe" $R1
${nsProcess::KillProcess} "Quick Status Change.exe" $R2
${nsProcess::KillProcess} "Teams Status.exe" $R2
${nsProcess::KillProcess} "Window Switching.exe" $R3
${nsProcess::KillProcess} "Basic Shortcuts.exe" $R4

# Remove Start Menu launcher
delete "$SMPROGRAMS\${COMPANYNAME}\3CX.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\3CX Click-to-Dial.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\GoldMine Search.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\Quick Status Change.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\Teams Status Change.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\Window Switching.lnk"
delete "$SMSTARTUP\3CX.lnk"
delete "$SMSTARTUP\Quick Status Change.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\Basic Shortcuts.lnk"
delete "$SMPROGRAMS\${COMPANYNAME}\Run All.lnk"
delete "$SMSTARTUP\3CX Click-to-Dial.lnk"
delete "$SMSTARTUP\Teams Status Change.lnk"
delete "$SMSTARTUP\GoldMine Search.lnk"
delete "$SMSTARTUP\Window Switching.lnk"
delete "$SMSTARTUP\Basic Shortcuts.lnk"
; delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"

# Try to remove the Start Menu folder - this will only happen if it is empty
Expand All @@ -150,9 +263,14 @@ section "uninstall"
# Remove files
delete "$INSTDIR\3cx.exe"
delete "$INSTDIR\GMSearch.exe"
delete "$INSTDIR\Quick Status Change.exe"
delete "$INSTDIR\Teams Status.exe"
delete "$INSTDIR\Window Switching.exe"
delete "$INSTDIR\red_q_on_blue_bkgd.ico"
delete "$INSTDIR\Basic Shortcuts.exe"
delete "$INSTDIR\run all.bat"
delete "$INSTDIR\images\red_q_on_blue_bkgd.ico"
delete "$INSTDIR\images\q_on_red_bkgd.ico"
delete "$INSTDIR\images\q_on_yellow_bkgd.ico"
delete "$INSTDIR\images\q_on_green_bkgd.ico"

# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
Expand Down
Loading

0 comments on commit b2b118b

Please sign in to comment.