Skip to content
Permalink
Browse files

Add ScriptViewerArgs config setting

This lets you specify command-line args for your chosen script file
viewer (Scripting menu -> [script] -> View Script).  Default is blank.

For example, if using Notepad++ you can set this to "-lvb" (without
quotes) to have Notepad++ set the language to Visual Basic
automatically, regardless of the file type of the script (usually .txt).
  • Loading branch information...
Davnit committed Dec 1, 2017
1 parent 37b34c1 commit bde1375044638a1e2e6bd7086a492d7ca76327b5
Showing with 16 additions and 1 deletion.
  1. +12 −0 trunk/clsConfig.cls
  2. +4 −1 trunk/modMenuObj.bas
@@ -203,6 +203,7 @@ Private m_QueueCreditRate As Long
Private m_DisableScripting As Boolean
Private m_ScriptingAllowUI As Boolean
Private m_ScriptViewer As String
Private m_ScriptViewerArgs As String

'[EMULATION]
Private m_IgnoreClanInvites As Boolean
@@ -1407,6 +1408,14 @@ Public Property Let ScriptViewer(ByVal sValue As String)
m_ScriptViewer = sValue
End Property

Public Property Get ScriptViewerArgs() As String
ScriptViewerArgs = m_ScriptViewerArgs
End Property

Public Property Let ScriptViewerArgs(ByVal sValue As String)
m_ScriptViewerArgs = sValue
End Property


'-------------------------
' SECTION: EMULATION
@@ -1893,6 +1902,7 @@ Public Sub Save(Optional ByVal sFilePath As String = vbNullString)
WriteSetting SECTION_SCRIPTING, "DisableScripts", m_DisableScripting
WriteSetting SECTION_SCRIPTING, "AllowUI", m_ScriptingAllowUI
WriteSetting SECTION_SCRIPTING, "ScriptViewer", m_ScriptViewer
WriteSetting SECTION_SCRIPTING, "ScriptViewerArgs", m_ScriptViewerArgs

WriteSetting SECTION_EMULATION, "IgnoreClanInvites", m_IgnoreClanInvites
WriteSetting SECTION_EMULATION, "IgnoreKeyLength", m_IgnoreCDKeyLength
@@ -2098,6 +2108,7 @@ Private Sub LoadDefaults()
m_DisableScripting = False
m_ScriptingAllowUI = True
m_ScriptViewer = vbNullString
m_ScriptViewerArgs = vbNullString

'[Emulation]
m_IgnoreClanInvites = False
@@ -2445,6 +2456,7 @@ Private Sub LoadVersion6Config()
m_DisableScripting = ReadSettingB(SECTION_SCRIPTING, "DisableScripts", m_DisableScripting)
m_ScriptingAllowUI = ReadSettingB(SECTION_SCRIPTING, "AllowUI", m_ScriptingAllowUI)
m_ScriptViewer = ReadSetting(SECTION_SCRIPTING, "ScriptViewer", m_ScriptViewer)
m_ScriptViewerArgs = ReadSetting(SECTION_SCRIPTING, "ScriptViewerArgs", m_ScriptViewerArgs)

m_IgnoreClanInvites = ReadSettingB(SECTION_EMULATION, "IgnoreClanInvites", m_IgnoreClanInvites)
m_IgnoreCDKeyLength = ReadSettingB(SECTION_EMULATION, "IgnoreKeyLength", m_IgnoreCDKeyLength)
@@ -141,7 +141,10 @@ Public Sub MenuClick(hWnd As Long, lngMenuCommand As Long)
If (Config.ScriptViewer = vbNullString) Then
ShellOpenURL GetScriptDictionary(GetModuleByName(s_name))("Path"), , False
Else
Shell Chr(34) & Config.ScriptViewer & Chr(34) & Space(1) & Chr(34) & GetScriptDictionary(GetModuleByName(s_name))("Path") & Chr(34)
' Viewer path -> args -> script path
Shell Chr(34) & Config.ScriptViewer & Chr(34) & Space(1) & _
IIf(Len(Config.ScriptViewerArgs) > 0, Config.ScriptViewerArgs & Space(1), vbNullString) & _
Chr(34) & GetScriptDictionary(GetModuleByName(s_name))("Path") & Chr(34)
End If
End If
End If

0 comments on commit bde1375

Please sign in to comment.
You can’t perform that action at this time.