Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance Force
- #KeyHistory 0
- ListLines, Off
- SetBatchLines, -1
- OnMessage(0x404, "AHK_NOTIFYICON")
- Ver = 6.37.5.0
- ;--------------------------------------
- Menu, Tray, UseErrorLevel
- Menu, Tray, Tip, Nord Helper
- Menu, Tray, Icon, C:\Program Files\NordVPN\%Ver%\Resources\toast.ico
- Menu, Tray, NoStandard
- Menu, Tray, Add, R&eload, Reload
- Menu, Tray, Add, E&xit, Exit
- ;---------------------------------------
- RunAsAdmin()
- doGui()
- return
- ;---------------------------------------
- return
- doGui()
- {
- if WinExist("Dashboard")
- {
- Gui 1: Destroy
- }
- Gui 1: +AlwaysOnTop
- Gui 1: Color, c005198
- Gui 1: Add, Button, w90 h20 x10 y5 gRunNord, Run Nord
- Gui 1: Add, Button, w90 h20 x10 y35 gKillNord, Close Nord
- Gui 1: Add, Button, w90 h20 x125 y5 gConnectNord, Connect
- Gui 1: Add, Button, w90 h20 x125 y35 gDisconnectNord, Disconnect
- Gui 1: Show, w225 h60, Dashboard
- enableGuiDrag(1)
- }
- KillNord()
- {
- RunWait, %ComSpec% /c Taskkill /IM "NordVPN.exe" /F && Taskkill /IM "nordvpn-service.exe" /F,, Hide
- }
- RunNord()
- {
- RunWait, %ComSpec% /c cd "C:\Program Files\NordVPN\" && start NordVPN.exe,, Hide
- }
- ConnectNord()
- {
- RunWait, %ComSpec% /c cd "C:\Program Files\NordVPN\" && nordvpn --connect,, Hide
- }
- DisconnectNord()
- {
- RunWait, %ComSpec% /c cd "C:\Program Files\NordVPN\" && nordvpn --disconnect,, Hide
- }
- RunAsAdmin()
- {
- Global 0
- IfEqual, A_IsAdmin, 1, Return 0
- Loop, %0%
- params .= A_Space . %A_Index%
- DllCall("shell32\ShellExecute" (A_IsUnicode ? "":"A"),uint,0,str,"RunAs",str,(A_IsCompiled ? A_ScriptFullPath : A_AhkPath),str,(A_IsCompiled ? "": """" . A_ScriptFullPath . """" . A_Space) params,str,A_WorkingDir,int,1)
- ExitApp
- }
- enableGuiDrag(GuiLabel=1)
- {
- WinGetPos,,,A_w,A_h,A
- Gui, %GuiLabel%:Add, Text, x0 y0 w%A_w% h%A_h% +BackgroundTrans gGUI_Drag
- return
- GUI_Drag:
- PostMessage 0xA1,2
- return
- }
- AHK_NOTIFYICON(wParam, lParam, uMsg, hWnd)
- {
- if (lParam = 0x201)
- {
- KeyWait, LButton
- KeyWait, LButton, D T 0.10
- if (Errorlevel)
- {
- return
- }
- else
- {
- doGui()
- }
- }
- }
- ;----------------------------------------------------
- GuiClose:
- Gui 1: Destroy
- goTo, Exit
- return
- Reload:
- Reload
- Sleep 1000
- ExitApp
- Exit:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement