Notifications
Clear all

[Closed] Maxscript local Help ?

Hi all,

How can I get Maxscript to use the local version instead of the online help?
I have downloaded the Maxscript htlm help, but can’t find any way to use from within max.
I managed to get the general help to use the local version (preferences), but can’t get it to work for the Maxscript help.

Any clues ?

Regards,
Zbuffer

17 Replies
1 Reply
(@lucpet)
Joined: 11 months ago

Posts: 0

From what I could work out you can have one or the other, but not both and the other ideas posted here may be your only choice.

What version are you using?
Normally there is a helpfile in you programs folder

“C:\Program Files (x86)\Autodesk\3ds Max 2010\help\maxscript.chm”

If you just make a shortcut to that file on your desktop you do not have to connect anymore to the internet.
I did not knew max used the online version … Is that since 2012 ?

only way is to code a small macroscript and hook it to your preferred shortcut/menu.
something like


shelllaunch "D:\\3DSMax2012\\Help\\Maxscript\\index.html" ""

should do it…
Just change the path to your config

Late reply…

I am using max 2012, so no .chm, only online help.
using ‘customize/preferences/help’ i can point to a local folder, but there is no setings for the maxScript help
shellLaunch can launch index but how to get the current word in Maxscript editor to be passed to the index, replacing the original F1 help that points to the online help ?

Maxscript 2012 help launcher
But F1 still not working…

Hi,
I have something… but it does not work and I need Help:

Thanks to the one and only DenisT, and his dotnet Magic,
I can retreive the word at the carret position in the editor.
But I can’t get the parameters to work with “ShellLaunch”
it only opens the index.html file (and NOT the ‘?query=MySearch’
Any ideas ?
here is the script so far:
(click a word in MXS editor and evaluate)

/*
 	MaxScript Local Help
 */
 
 (
 	global Win32Assembly
 	local MXS_HELP_DIR="D:/3D/3dsmax2012/maxscript-doc-2012/"
 
 	fn CreateWin32Assembly forceRecompile:on =
 	(
 		if forceRecompile or not iskindof ::Win32Assembly dotnetobject or (::Win32Assembly.GetType()).name != "Assembly" do
 		(
 			source = "using System;
"
 			source += "using System.Runtime.InteropServices;
"
 			source += "using System.Text;
"
 			source += "class Win32
"
 			source += "{
"
 			source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]
"
 			source += "		public static extern Int32 SetFocus(Int32 hWnd);
"
 			source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]
"
 			source += "		internal static extern int GetWindowTextLength(Int32 hWnd);
"
 			source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]
"
 			source += "		internal static extern int GetWindowText(Int32 hWnd, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpString, int nMaxCount);
"
 			source += "		public static string GetWindowText(Int32 hWnd)
"
 			source += "		{
"
 			source += "			int length = GetWindowTextLength(hWnd);
"
 			source += "			StringBuilder sb = new StringBuilder(length + 1);
"
 			source += "			GetWindowText(hWnd, sb, sb.Capacity);
"
 			source += "			return sb.ToString();
"
 			source += "		}
"
 			source += "}
"
 
 			csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
 			compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
 
 			compilerParams.ReferencedAssemblies.Add "System.dll"
 			compilerParams.ReferencedAssemblies.Add "System.Drawing.dll"
 
 			compilerParams.GenerateInMemory = true
 			compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)
 
 			Win32Assembly = compilerResults.CompiledAssembly
 			Win32Assembly.CreateInstance "Win32"
 		)
 	)
 	global Win32 = CreateWin32Assembly()
 
 	fn isStopChar s =
 	(
 		local valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"
 		local i =  findstring valid s
 		if i == undefined then true else false
 	)
 	
 	fn GetWord txt pos =
 	(
 		local start = for i = pos to 1 by -1 do if (isStopChar txt[i]) do exit with (i+1)
 		local end = for i = pos to txt.count do if (isStopChar txt[i]) do exit with i
 		trimright(substring txt start (end-start))
 	)
 
 	fn LaunchHelp str =
 	(
 		url="file:///"+MXS_HELP_DIR+"index.html?query=" + str
 		format "URL:%
" url
 		ShellLaunch url ""
 	)
 	
 	fn GetWordatCarretPos =
 	(
 		fn _mxs_Textbox =
 		(
 			tb = for c in (windows.getchildrenhwnd 0) where c[4] == "MXS_SciTEWindow" do exit with
 			(
 				for t in (windows.getchildrenhwnd c[1]) where t[4] == "MXS_Scintilla" do exit with t[1]
 			)
 			if tb != ok then tb else undefined
 		)
 		
 		val=0
 		EM_GETSEL = 0x00B0
 		tb = _mxs_Textbox()
 		tx = Win32.GetWindowText tb
 		CarretPos = (windows.sendmessage tb EM_GETSEL val val)/65535
 		--print CarretPos
 		--Win32.SetFocus tb
 		GetWord tx CarretPos
 	)
 	LaunchHelp (GetWordatCarretPos())
 )

OK,
I have this kind of working…
but I cannot assign a shortcut that will trigger it while in the MXS editor
Otherwise if you comment out the macroscript definition, you can test it on the script itself

/*
	MXS_Help.ms
	MaxScript Local Help Launcher
	dotnet User32 magic  vastely inspired by DenisT
*/

macroscript MXS_HELP
category:"MAX Script"
toolTip:"Context Help"
(
	
	on execute do
	(
		fn CreateWin32Assembly forceRecompile:off =
		(
			if forceRecompile or not iskindof ::Win32Assembly dotnetobject or (::Win32Assembly.GetType()).name != "Assembly" do
			(
				source = "using System;
"
				source += "using System.Runtime.InteropServices;
"
				source += "using System.Text;
"
				source += "class Win32
"
				source += "{
"
				source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]
"
				source += "		public static extern Int32 SetFocus(Int32 hWnd);
"
				source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]
"
				source += "		internal static extern int GetWindowTextLength(Int32 hWnd);
"
				source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]
"
				source += "		internal static extern int GetWindowText(Int32 hWnd, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpString, int nMaxCount);
"
				source += "		public static string GetWindowText(Int32 hWnd)
"
				source += "		{
"
				source += "			int length = GetWindowTextLength(hWnd);
"
				source += "			StringBuilder sb = new StringBuilder(length + 1);
"
				source += "			GetWindowText(hWnd, sb, sb.Capacity);
"
				source += "			return sb.ToString();
"
				source += "		}
"
				source += "}
"

				csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
				
				compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
				compilerParams.ReferencedAssemblies.Add "System.dll"
				compilerParams.ReferencedAssemblies.Add "System.Drawing.dll"
				compilerParams.GenerateInMemory = true
				
				compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)

				Win32Assembly = compilerResults.CompiledAssembly
				Win32Assembly.CreateInstance "Win32"
			)
		)
		
		global Win32 = CreateWin32Assembly()

		/* Launches IE
		*/
		fn LaunchHelp str =
		(
			MXS_HELP_DIR="D:/3D/3ds Max 2012/help/maxscript-doc-2012/"
			IE32 = "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe"
			IE = "C:\\Program Files\\Internet Explorer\\iexplore.exe"
			url="file:///"+MXS_HELP_DIR+"index.html"
			if str.count>0 do url += ("?query=" + str)
			--ShellLaunch url "" -- :( :( :( DOES NOT PLAY WITH FIREFOX...
			-- This Works wIth x64 Windows
			if doesFileExist IE32 then ShellLaunch IE32 url
			else if doesFileExist IE then ShellLaunch IE url
			else ShellLaunch url ""
		)
		
		fn GetWordatCarretPos =
		(
			/* Retreives a complete Word (made of valid chars) at a given position in a string
			*/
			fn GetWord str pos =
			(
				fn isStopChar s =
				(
					local valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"
					local i =  findstring valid s
					if i == undefined or i == 0 then true else false
				)
				
				local start=pos, end=pos, res=""
				start = if isStopChar str[pos] then (pos+1)
				else if isStopChar str[pos-1] then pos else (for i = pos to 1 by -1 do if isStopChar str[i] do exit with (i+1))
				end = if isStopChar str[pos+1] then (pos+1) else (for i = (pos+1) to str.count do if isStopChar str[i] do exit with (i))
				res = substring str start (end-start)
				res
			)
			
			fn _mxs_Textbox =
			(
				tb = for c in (windows.getchildrenhwnd 0) where c[4] == "MXS_SciTEWindow" do exit with
				(
					for t in (windows.getchildrenhwnd c[1]) where t[4] == "MXS_Scintilla" do exit with t[1]
				)
				if tb != ok then tb else undefined
			)
			
			EM_GETSEL = 0x00B0
			tb = _mxs_Textbox()
			tx = Win32.GetWindowText tb
			Win32.SetFocus tb
			CarretPos = (windows.sendmessage tb EM_GETSEL 0 0)/65535
			GetWord tx CarretPos
		)
		LaunchHelp (GetWordatCarretPos())
	)
)

My method uses the default methods available in the maxscript editor. You can add your own keyboard shortcuts for some actions in the scintilla editor. One of these actions opens a predefined file: the scintilla helpfile.

http://www.scriptspot.com/3ds-max/tutorials/maxscript-help-for-3dsmax-2012

There are not mentioned, but in
Tools -> Open Global Options File
You can find

# SciTE help
command.scite.help="file://$(SciteDefaultHome)\Help\SciTEDoc.html"
command.scite.help.subsystem=2

Put this code to Tools -> Open User Options File

command.name.12.*=Find in Help
command.12.*=C:\-blah-blah-blah-\opera\opera.exe "file://C:\-blah-blah-blah-\3ds Max 2012\Help\maxscript\index.html?query= $(CurrentSelection)"
command.subsystem.12.*=2
command.mode.12.*=savebefore:no
command.shortcut.12.*=Ctrl+F1

You can remove:
command.name.12.*=Find in Help
Replace
C:-blah-blah-blah-\opera\opera.exe
With any string/browser You wanted.
And
C:-blah-blah-blah-\3ds Max 2012\Help\maxscript\index.html
To path of Maxscript Help File.

Nice Alex Mak,
this was missing from my solution. The ability to have the help point directly to the item you want help for. I’ll update my article to incorporate your solution.
Klaas

Page 1 / 2