Maxscript local Help ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2011   #1
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
 
Old 10 October 2011   #2
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 ?
__________________
Portfolio
 
Old 10 October 2011   #3
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
__________________

PowerPreview: High Quality Nitrous Previews for 3ds Max 2012|2013|2014

[ Free Download (ScriptSpot) ]

Home of The Frogs | Online Portfolio
 
Old 10 October 2011   #4
Originally Posted by Zbuffer: 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

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.
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram

 
Old 10 October 2011   #5
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 ?
 
Old 01 January 2012   #6
Helps a little

Maxscript 2012 help launcher
But F1 still not working...
__________________
RTFM
 
Old 01 January 2012   #7
Need Help

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;\n"
 			source += "using System.Runtime.InteropServices;\n"
 			source += "using System.Text;\n"
 			source += "class Win32\n"
 			source += "{\n"
 			source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]\n"
 			source += "		public static extern Int32 SetFocus(Int32 hWnd);\n"
 			source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]\n"
 			source += "		internal static extern int GetWindowTextLength(Int32 hWnd);\n"
 			source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]\n"
 			source += "		internal static extern int GetWindowText(Int32 hWnd, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpString, int nMaxCount);\n"
 			source += "		public static string GetWindowText(Int32 hWnd)\n"
 			source += "		{\n"
 			source += "			int length = GetWindowTextLength(hWnd);\n"
 			source += "			StringBuilder sb = new StringBuilder(length + 1);\n"
 			source += "			GetWindowText(hWnd, sb, sb.Capacity);\n"
 			source += "			return sb.ToString();\n"
 			source += "		}\n"
 			source += "}\n"
 
 			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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx  yz_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:%\n" 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())
 )
 
Old 01 January 2012   #8
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;\n"
				source += "using System.Runtime.InteropServices;\n"
				source += "using System.Text;\n"
				source += "class Win32\n"
				source += "{\n"
				source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]\n"
				source += "		public static extern Int32 SetFocus(Int32 hWnd);\n"
				source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]\n"
				source += "		internal static extern int GetWindowTextLength(Int32 hWnd);\n"
				source += "		[DllImport(\"user32\", CharSet = CharSet.Auto, SetLastError = true)]\n"
				source += "		internal static extern int GetWindowText(Int32 hWnd, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpString, int nMaxCount);\n"
				source += "		public static string GetWindowText(Int32 hWnd)\n"
				source += "		{\n"
				source += "			int length = GetWindowTextLength(hWnd);\n"
				source += "			StringBuilder sb = new StringBuilder(length + 1);\n"
				source += "			GetWindowText(hWnd, sb, sb.Capacity);\n"
				source += "			return sb.ToString();\n"
				source += "		}\n"
				source += "}\n"

				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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx  yz_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())
	)
)
 
Old 01 January 2012   #9
Quote: 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/t...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
__________________
RTFM

Last edited by S-ed : 01 January 2012 at 04:07 PM.
 
Old 01 January 2012   #10
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.
__________________
RTFM
 
Old 02 February 2012   #11
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
 
Old 02 February 2012   #12
grabjacket
Thanks to Your info about SciTe.

I'm disappointed about this "decision" to make help online. Legacy .chm was times faster.
Same thing with Adobe.
Seems like Lua disabled in Max's SciTe. =(

Zbuffer
Looks like a lot of work to me.
And most interesting, that maxscript can embed other language, looks fearsome...
__________________
RTFM
 
Old 02 February 2012   #13
Very interesting,
The drawback with the global Options is that it only takes a selection, that's vcery cool
I like the fact to only click on the word and send this to the help file to get a 'real' context help.
(as it was worling previously with .chm)
 
Old 02 February 2012   #14
Quote: to only click on the word
oh, sure...
replace
CurrentSelection
with
CurrentWord
__________________
RTFM
 
Old 02 February 2012   #15
Hey Alex,

I've had to edit the lines of code you posted a little bit, but it really works for me: actual contextual, local maxscript help: yay!
# point maxscript to a local helpfile
command.name.12.*=Find in local Help
command.12.*="C:\Program Files (x86)\_web\Firefox\firefox.exe" "file:///C:/Users/klaas/Dropbox/Documentation/maxscript-doc-2012/index.html?query= $(CurrentWord)"
command.subsystem.12.*=0
command.mode.12.*=savebefore:no
command.shortcut.12.*=Ctrl+F1

I had to set the subsystem to 0 to make it work for me.

I've updated my blog-article and added your solution to it.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:19 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.