Geekitude

Geekeries en tout genres

User Tools

Site Tools


en:info:doku:dokuwikistick_systray
DokuWikiStick Menu

This AutoIt script launches DokuWikiStick and opens the web page as the bundled run.bat script does but MicroApache is automatically minimized and a systray icon gives access to the following menu :

  • open the wiki in default browser
  • restart MicroApache
  • open DokuWikiStick folder in Windows Explorer
  • if a GitHub folder exists in your Documents folder, the menu is expanded with the following functions : open github.com and explore Documents\GitHub folder
  • exit (kill MicroApache and exit from the script.

Here comes the source :

DokuWikiStick.au3
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=DokuWikiStickGeekitude.ico
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
 
#include <Constants.au3>
#include <WindowsConstants.au3>
 
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 3)
 
TraySetToolTip ("DokuWikiStick")
 
If FileExists(@ScriptDir & "\server\mapache.exe") Then
	TrayTip("DokuWikiStick", "Starting MicroApache...", 2, 2)
  	FileChangeDir (@ScriptDir & "\server")
	Run("mapache.exe", "", @SW_MINIMIZE)
	ShellExecute("http://localhost:8800/doku.php")
	Menu()
Else
	MsgBox(16, "Error", "Missing \server\mapache.exe")
	Exit
EndIf
 
Func Menu()
	Local $idBrowseDWS = TrayCreateItem("Browse DokuWikiStick website")
	Local $idRestart = TrayCreateItem("Restart MicroApache")
	Local $idExploreDWS = TrayCreateItem("Explore DokuWikiStick folder")
	If FileExists(@MyDocumentsDir & "\GitHub") Then
		TrayCreateItem("")
		Local $idBrowseGH = TrayCreateItem("Browse GitHub website")
		Local $idExploreGH = TrayCreateItem("Explore Documents\GitHub folder")
	EndIf
	TrayCreateItem("")
	Local $idExit = TrayCreateItem("Exit")
	While 1
		Switch TrayGetMsg()
			Case $idBrowseDWS
				ShellExecute("http://localhost:8800/doku.php")
			Case $idRestart
				TrayTip("DokuWikiStick", "Restarting MicroApache...", 2, 2)
				Run("ApacheKill.exe")
				Sleep(1000)
				Run("mapache.exe")
			Case $idExploreDWS
				ShellExecute(@ScriptDir)
			Case $idBrowseGH
				ShellExecute("https://github.com")
			Case $idExploreGH
				ShellExecute(@MyDocumentsDir & "\GitHub")
			Case $idExit
				KillApache()
		EndSwitch
	WEnd
EndFunc
 
Func KillApache()
	TrayTip("DokuWikiStick", "Killing MicroApache...", 2, 2)
	Run("ApacheKill.exe")
	Sleep(1000)
	Exit
EndFunc

This file (DokuWikiStick.au3) has to be compiled with the following procedure :

  • Download and install AutoIt Full Installation (choose Edit when the install asks what to do when opening au3 files)
  • Download and install AutoIt Script Editor
  • Download the script source file (DokuWikiStick.au3) and one of these icons : (based on an image from Andreas Gohr's blog or (wich I made from this clipart)
  • Open DokuWikiStick.au3 in AutoIt Script Editor
  • In [Tools] menu, select [Compile]
  • Make sure the icon you want is selected
  • Click Compile Script

You can also download the exe file here.

en/info/doku/dokuwikistick_systray.txt · Last modified: 2018/05/03 11:10 by 127.0.0.1