{{tag>dokuwiki usb apache autoit}}
== DokuWikiStick Menu ==
This [[https://www.autoitscript.com/site/autoit/|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.
{{ info:logiciels:doku:dokuwikistick-systray.png?300 |}}
Here comes the source :
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=DokuWikiStickGeekitude.ico
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include
#include
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 :
* Got to that page: https://www.autoitscript.com/site/autoit/downloads/
* 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 : [[http://www.geekitude.fr/externe/dokuwiki/dokuwikistick/DokuWikiStick.ico|{{info:logiciels:doku:dokuwikistick.ico?40}}]] (based on an image from [[http://www.splitbrain.org/blog/2007-12/01-dokuwiki_on_a_stick|Andreas Gohr's blog]] or [[http://www.geekitude.fr/externe/dokuwiki/dokuwikistick/DokuWikiStickGeekitude.ico|{{info:logiciels:doku:dokuwikistickgeekitude.ico?40}}]] (wich I made from [[https://openclipart.org/detail/167170/usb-thumb-drive-3-by-rygle|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 [[http://www.geekitude.fr/externe/dokuwiki/dokuwikistick/DokuWikiStick.exe|here]].