Skip to content

Instantly share code, notes, and snippets.

@mistic100
Last active April 26, 2024 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mistic100/13540de47d1a588033f9ae81df7fce55 to your computer and use it in GitHub Desktop.
Save mistic100/13540de47d1a588033f9ae81df7fce55 to your computer and use it in GitHub Desktop.
; Starts qBitorrent after prompting for the listening port
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
$exeFile = "C:\Program Files\qBittorrent\qbittorrent.exe"
Opt("TrayIconHide", 1)
GUICreate("qBitorrent", 200, 75, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP, $WS_CAPTION))
GUISetFont(12, 400, 0, "Segoe UI")
$VariableInput = GUICtrlCreateInput("", 5, 5, 190, 30)
$ExitButton = GUICtrlCreateButton("OK", 5, 40, 190, 30)
GUISetState(@SW_SHOW)
Func Done()
$port = GUICtrlRead($VariableInput)
Run($exeFile & " --torrenting-port=" & $port)
Exit
EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ExitButton
Done()
Case $VariableInput
If _IsPressed('0D') Then Done()
EndSwitch
WEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment