Code: Select all
#NoEnv
#SingleInstance force
#Persistent
;#################################
Menu, Tray, Icon, %A_ScriptDir%/Icons/Office_Stuff_printer.ico ;Icon must be in same folder.
;~ Menu, Tray, noIcon ;, GearIcon.ico ;Icon must be in same folder.
Menu, tray, NoStandard
;~ Menu, tray, add, Edit Printer Setter App `t(Control+Shift+Alt+E), ^!+e
;~ Menu, tray, Icon, Edit Printer Setter App `t(Control+Shift+Alt+E), %A_ScriptDir%/Icons/IconWrench.ico
Menu, tray, add, Edit Printer Setter App, EditPrinterSetterApp
Menu, tray, Icon, Edit Printer Setter App, %A_ScriptDir%/Icons/IconWrench.ico
Menu, tray, add, Edit Printer Setter Settings, PrinterSetterSettings
Menu, tray, Icon, Edit Printer Setter Settings, %A_ScriptDir%/Icons/IconPencilThick.ico
Menu, tray, add ; Creates a separator line.
Menu, tray, add, Total Exit, TotalExitHandler
Menu, tray, Icon, Total Exit, %A_ScriptDir%/Icons/IconClose.ico
;return
myIP1 = %A_IPAddress1%
Loop, 20 ; 20 is an arbitrary number to keep the loop from going forever.
{
iniRead, iploc, PrinterSetterSettings.txt, IPaddresses, %A_Index%
IfInString, myIP1, %iploc%
{
ipAtNumber = %A_Index%
break
}
}
IfEqual, ipAtNumber, ; If there's no ip addy found, the var = "", so make it "15" instead.
ipAtNumber := 15 ; Building 15 is "Unknown" in the INI file.
iniRead, myBld, PrinterSetterSettings.txt, Buildings, %ipAtNumber%
;~ MsgBox, myBld is %myBld% ;Uncomment these 3 to fake a location.
;~ myBld := "Suquamish"
;~ MsgBox, myBld is NOW %myBld%
;====specific to this location=======
iniRead, myPrinterName, PrinterSetterSettings.txt, %myBld%, printerName
RunWait, C:\Windows\System32\RUNDLL32.exe PRINTUI.DLL`,PrintUIEntry /y /n "%myPrinterName%" ; sets the printer
iniRead, myBuildingNotes, PrinterSetterSettings.txt, %myBld%, buildingNotes
FileRead, MyNotes, %myBuildingNotes%
iniRead, myNumberLock, PrinterSetterSettings.txt, %myBld%, numberLock
SetNumlockState, %myNumberLock%
iniRead, FontColor1, PrinterSetterSettings.txt, %myBld%, FontColor1
iniRead, TransColor, PrinterSetterSettings.txt, %myBld%, transColor
;~ iniRead, myThingToRun, PrinterSetterSettings.txt, %myBld%, thingToRun, noThingToRun
;~ ;if (%myThingToRun% != noThingToRun)
;~ run, "%myThingToRun%" UseErrorLevel
;===always used, despite location========
iniRead, myDateFormat, PrinterSetterSettings.txt, CommonToAll, DateFormat
FormatTime, myDate, A_Now, %myDateFormat%
iniRead, myWeekdayFormat, PrinterSetterSettings.txt, CommonToAll, WeekdayFormat
FormatTime, myWeekday, A_Now, %myWeekdayFormat%
;=========================================
RegRead, OutputVar, HKCU, Software\Microsoft\Windows NT\CurrentVersion\Windows, Device
StringSplit, OutputVar, OutputVar, `,
defaultPrinter = %OutputVar1% ; These three lines get the default printer.
process, exist
pid = %errorlevel%
gui, wal:color, %TransColor%
gui, wal:font, s70 c%FontColor1% , arial bold
gui, wal:-caption +toolwindow +0x02000000 ; toolwindow stops flicker of icon in taskbar
gui, wal:add, text, x0 y0, %myWeekday%
gui, wal:font, s40 c%FontColor1% , arial bold
gui, wal:add, text, x0 y+10, %myDate%
gui, wal:font, s20 c%FontColor1% , arial bold
;gui, wal:add, text, x0 y+8, IP Address: %myIP1%
gui, wal:add, text, x0 y+10, %defaultPrinter%
gui, wal:add, text, x0 y+10, %MyNotes%
gui, wal:show, x1200 y100
winset, transcolor, %TransColor%, ahk_pid %pid% ; drak gray
WinSet, Bottom,, ahk_pid %pid%
winget, hw_gui, ID, ahk_pid %pid% ; These lines dock it to desktop.
winget, hw_desktop, ID, ahk_class Progman
DllCall("SetParent", "int*", hw_gui, "int*", hw_desktop)
Run, C:\Users\swkunkel\AutoHotkey\AutoCorrect\AutoCorrect2016.exe
return
; ^!+r:: Reload ; Just reload this script. 1-25-2017 disabled so I can use hotkey in MLO.
EditPrinterSetterApp:
Run, C:\Users\swkunkel\AutoHotkey\SciTE\SciTE.exe "C:\Users\swkunkel\AutoHotkey\AutoPrinterSetter\PrinterSetterApp.ahk"
return
PrinterSetterSettings:
Run, C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe "C:\Users\swkunkel\AutoHotkey\AutoPrinterSetter\PrinterSetterSettings.txt"
return
TotalExitHandler:
ExitApp
return