jercfd Posted March 2, 2008 Posted March 2, 2008 (edited) I have made this working jEdit Launcher. What this does is open jEdit with special command line parameters. System requirements: This file must be in the same directory as jEdit. Java must be installed jEdit must be installed A computer that supports running java expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Opt("RunErrorsFatal", 1) $jEditLanucher = GUICreate("jEdit Custom Lanucher", 393, 646, -1, -1) GUISetIcon("icon.ico") GUICtrlCreateGroup("Command Line Parameters - Optional", 5, 5, 382, 595) GUICtrlCreateGroup("Plugins", 15, 25, 362, 85) $DisablePlugin = GUICtrlCreateCheckbox("Disable loading of plugins", 25, 75, 342, 30) $EnablePlugin = GUICtrlCreateCheckbox("Enable loading of plugins", 25, 45, 342, 30) GUICtrlCreateGroup("Restore Files", 15, 115, 362, 85) $NoRestore = GUICtrlCreateCheckbox("Do not restore previously open files on startup", 25, 165, 342, 30) $Restore = GUICtrlCreateCheckbox("Restore previously open files on startup", 25, 135, 342, 30) GUICtrlCreateGroup("Run Script", 15, 205, 362, 85) $RunScript = GUICtrlCreateCheckbox("Run the specified BeanShell script", 25, 225, 342, 30) $RunScriptInput = GUICtrlCreateInput("", 25, 255, 260, 21, BitOR($ES_READONLY, $ES_AUTOHSCROLL)) $RunScriptButton = GUICtrlCreateButton("Browse", 295, 255, 72, 21, 0) GUICtrlSetState($RunScriptButton, $GUI_DISABLE) GUICtrlCreateGroup("Settings", 15, 295, 361, 115) $Settings = GUICtrlCreateCheckbox("Store user-specific settings in custom directory instead of the default user.home/.jedit", 25, 315, 342, 30, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_MULTILINE, $WS_TABSTOP)) $SettingsInput = GUICtrlCreateInput("", 25, 345, 260, 21, BitOR($ES_READONLY, $ES_AUTOHSCROLL)) $SettingsButton = GUICtrlCreateButton("Browse", 295, 345, 72, 21, 0) GUICtrlSetState($SettingsButton, $GUI_DISABLE) $DefaultSettings = GUICtrlCreateCheckbox("Start jEdit without loading user-specific settings", 25, 375, 342, 30) GUICtrlCreateGroup("Scripts", 15, 415, 361, 85) $NoStartupScripts = GUICtrlCreateCheckbox("Run startup scripts", 25, 435, 342, 30) $StartupScripts = GUICtrlCreateCheckbox("Disable startup scripts", 25, 465, 342, 30) GUICtrlCreateGroup("Open File", 15, 505, 361, 85) $FileOpen = GUICtrlCreateCheckbox("Open File", 25, 525, 342, 30) $FileOpenInput = GUICtrlCreateInput("", 25, 555, 260, 21, BitOR($ES_READONLY, $ES_AUTOHSCROLL)) $FileOpenButton = GUICtrlCreateButton("Browse", 295, 555, 72, 21, 0) GUICtrlSetState($FileOpenButton, $GUI_DISABLE) $LaunchButton = GUICtrlCreateButton("Launch jEdit with Command Line Paramters", 5, 605, 225, 35) $LaunchNormalButton = GUICtrlCreateButton("Launch jEdit Normally", 235, 605, 152, 35) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $DisablePlugin GUICtrlSetState($EnablePlugin, $GUI_UNCHECKED) Case $EnablePlugin GUICtrlSetState($DisablePlugin, $GUI_UNCHECKED) Case $Restore GUICtrlSetState($NoRestore, $GUI_UNCHECKED) Case $NoRestore GUICtrlSetState($Restore, $GUI_UNCHECKED) Case $RunScript If GUICtrlRead($RunScript) = $GUI_CHECKED Then GUICtrlSendMsg($RunScriptInput, $EM_SETREADONLY, False, 0) GUICtrlSetState($RunScriptButton, $GUI_ENABLE) Else GUICtrlSendMsg($RunScriptInput, $EM_SETREADONLY, True, 0) GUICtrlSetState($RunScriptButton, $GUI_DISABLE) EndIf Case $RunScriptButton $RunScriptPath = FileOpenDialog("jEdit Custom Launcher - Open Script", @DesktopDir, "All (*.*)", 3) If @error Then MsgBox(16, "Error", "No File Choosen.") Else $RunScriptPath = StringReplace($RunScriptPath, "|", @CRLF) GUICtrlSetData($RunScriptInput, $RunScriptPath) EndIf Case $Settings If GUICtrlRead($Settings) = $GUI_CHECKED Then GUICtrlSendMsg($SettingsInput, $EM_SETREADONLY, False, 0) GUICtrlSetState($DefaultSettings, $GUI_UNCHECKED) GUICtrlSetState($SettingsButton, $GUI_ENABLE) Else GUICtrlSendMsg($SettingsInput, $EM_SETREADONLY, True, 0) GUICtrlSetState($SettingsButton, $GUI_DISABLE) EndIf Case $SettingsButton $SettingsPath = FileSelectFolder("jEdit Custom Launcher - Settings Path", 0, @DesktopDir) If @error Then MsgBox(16, "Error", "No Folder Choosen.") Else $SettingsPath = StringReplace($SettingsPath, "|", @CRLF) GUICtrlSetData($SettingsInput, $SettingsPath) EndIf Case $DefaultSettings GUICtrlSetState($Settings, $GUI_UNCHECKED) GUICtrlSendMsg($SettingsInput, $EM_SETREADONLY, True, 0) GUICtrlSetState($SettingsButton, $GUI_DISABLE) Case $NoStartupScripts GUICtrlSetState($StartupScripts, $GUI_UNCHECKED) Case $StartupScripts GUICtrlSetState($NoStartupScripts, $GUI_UNCHECKED) Case $FileOpen If GUICtrlRead($FileOpen) = $GUI_CHECKED Then GUICtrlSendMsg($FileOpenInput, $EM_SETREADONLY, False, 0) GUICtrlSetState($FileOpenButton, $GUI_ENABLE) Else GUICtrlSendMsg($FileOpenInput, $EM_SETREADONLY, True, 0) GUICtrlSetState($FileOpenButton, $GUI_DISABLE) EndIf Case $FileOpenButton $FileOpenPath = FileOpenDialog("jEdit Custom Launcher - File Open", @DesktopDir, "All (*.*)", 3) If @error Then MsgBox(16, "Error", "No File Choosen.") Else $FileOpenPath = StringReplace($FileOpenPath, "|", @CRLF) GUICtrlSetData($FileOpenInput, $FileOpenPath) EndIf Case $LaunchButton If FileExists(@ScriptDir & "\jEdit.jar") = 0 Then MsgBox(16, "Error", "Cannot Find jEdit.jar.") Else _jEditRun() Exit EndIf Case $LaunchNormalButton If FileExists(@ScriptDir & "\jEdit.jar") = 0 Then MsgBox(16, "Error", "Cannot Find jEdit.jar.") Else ShellExecute(@ScriptDir & "\jEdit.jar") Exit EndIf EndSwitch WEnd Func _jEditRun() $DisablePluginData = GUICtrlRead($DisablePlugin) $EnablePluginData = GUICtrlRead($EnablePlugin) $NoRestoreData = GUICtrlRead($NoRestore) $RestoreData = GUICtrlRead($Restore) $RunScriptData = GUICtrlRead($RunScript) $RunScriptInputData = GUICtrlRead($RunScriptInput) $SettingsData = GUICtrlRead($Settings) $SettingsInputData = GUICtrlRead($SettingsInput) $DefaultSettingsData = GUICtrlRead($DefaultSettings) $NoStartupScriptsData = GUICtrlRead($NoStartupScripts) $StartupScriptsData = GUICtrlRead($StartupScripts) $FileOpenData = GUICtrlRead($FileOpen) $FileOpenInputData = GUICtrlRead($FileOpenInput) $DisablePluginCommandData = " " $EnablePluginCommandData = " " $NoRestoreCommandData = " " $RestoreCommandData = " " $RunScriptCommandData = " " $SettingsCommandData = " " $DefaultSettingsCommandData = " " $NoStartupScriptsCommandData = " " $StartupScriptsCommandData = " " $FileOpenCommandData = " " If $DisablePluginData = $GUI_CHECKED Then $DisablePluginCommandData = " -noplugins" If $EnablePluginData = $GUI_CHECKED Then $EnablePluginCommandData = " -plugins" If $NoRestoreData = $GUI_CHECKED Then $NoRestoreCommandData = " -norestore" If $RestoreData = $GUI_CHECKED Then $RestoreCommandData = " -restore" If $RunScriptData = $GUI_CHECKED Then $RunScriptCommandData = " -run=" & $RunScriptInputData If $SettingsData = $GUI_CHECKED Then $SettingsCommandData = " -settings=" & $SettingsInputData If $DefaultSettingsData = $GUI_CHECKED Then $DefaultSettingsCommandData = " -nosettings" If $StartupScriptsData = $GUI_CHECKED Then $StartupScriptsCommandData = " -startupscripts" If $NoStartupScriptsData = $GUI_CHECKED Then $NoStartupScriptsCommandData = " -nostartupscripts" If $FileOpenData = $GUI_CHECKED Then $FileOpenCommandData = " -- -" & $FileOpenInputData Run(@ComSpec & " /c " & "C:\WINDOWS\system32\java.exe -jar " & '"' & @ScriptDir & '\jEdit.jar"' & $DisablePluginCommandData & $EnablePluginCommandData & $NoRestoreCommandData & $RestoreCommandData & $RunScriptCommandData & $SettingsCommandData & $DefaultSettingsCommandData & $NoStartupScriptsCommandData & $StartupScriptsCommandData & $FileOpenCommandData, "", @SW_HIDE) EndFunc ;==>_jEditRun Edited January 14, 2009 by jercfd
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now