ScriptSpotter

201 votes


This is a little tool to get the scripspot rss feed directly in max, displayed on the viewport. It of course only shows max related stuff, updates every 7 minutes and thats about it for descriptions.
have phun

AttachmentSize
ScriptSpotter.mse8.15 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Graph's picture

yep, doesnt show it when

yep, doesnt show it when there is no connection
you gotta have a connection with max. dont block it witha firewall.. or the port(s) its using.

use
internet.CheckConnection url:"http://www.scriptspot.com" force:true
to check if you got a connection with max.

Raphael 'Insanto' Steves
http://Graph.Net84.Net

pbiswal's picture

no internet connection

It says "ScriptSpotter not updated, no Connection".Even though i am currently browsing from the same machine.

It doesn't show the viewport text also.:(

Graph's picture

well certainly, its actually

well certainly, its actually quite simple do have a look

	/*
		Shift & click the main button to open the list
 
		then simply click something
	*/
(
 
	global scriptSpotter, scriptSpottertimerRO
 
	if scriptSpottertimerRO != undefined do destroydialog scriptSpottertimerRO
	if scriptSpotter != undefined do 
	(
		if scriptSpotter.redrawFN != undefined do unRegisterRedrawViewsCallback scriptSpotter.redrawFN
	)
 
 
	struct scriptSpotte
	(
		var = 0 ,
		onscreenMenuSettings = #(false, (gw.gettextextent"[ + ] [ Perspective ] [SMooth  +  Highlights ]")+ [10,5] ) ,
		folders,
		helpBrowserRO,
		helpBrowserWB,
		feedAddy = @"http://www.scriptspot.com/3ds-max/all/sort-modified/feed/sort-modified/feed/index.xml",
		/*
			http://www.scriptspot.com/frontpage/feed/index.xml
			http://www.scriptspot.com/3ds-max/all/sort-created/feed
			http://www.scriptspot.com/3ds-max/scripts/sort-created/feed
			sort-submitted
		*/
		fn drawtext text:"" pos:[0,0] mPos:mouse.pos = --function to draw the screenText and check if mouse is hovering
		(
			local mouseOverText = false
			local te = gw.getTextExtent text
			local b1 = Box2 pos.x pos.y te.x te.y
			local b2 = Box2 pos.x (pos.y-te.y) te.x te.y
 
			gw.setTransform(Matrix3 1)
 
			if contains b2 mouse.pos do
			(
				mouseOverText = true
			)
 
			gw.wText [pos.x, pos.y, 0] text color:(if not mouseOverText then color 150 180 210 else color 177 88 22)
			gw.enlargeUpdateRect b1 --b1 --#whole
 
			return mouseOverText
		)--END drawtext FN
		,
 
		fn modSTR str length = 
		(
			local res = ""
 
			for i = 1 to length do
			(
				res+= if str[i] == undefined then " " else str[i]
			)
			res
		)--END modSTR FN
		,
 
		fn getPropText str startTag endTag = 
		(
			local start = (findString str startTag) + startTag.count
			local end = (findString str endTag) --+ endTag.count
			local item = substring str start (end-start)
		)--END getPropText FN
		,
 
		fn updateItems =
		(
			local rss = try((dotNetObject "System.Net.WebClient").downloadString feedAddy)catch(undefined)
			--print rss
			if rss != undefined do
			(
				local items = #()
				for i = 1 to 10 do 
				(
					local start = (findString rss "<item>")
					local end = (findString rss "</item>") + 7
					local item = substring rss start (end-start)
					append items item
					rss = replace rss start (end-start) "" 
				)
 
				if items != undefined do
				(
					folders = (for i = 1 to items.count collect (
						local item = items[i]
 
						local title 			= getPropText item "<title>" 				"</title>"
						local author 		= getPropText item  "<dc:creator>" 		"</dc:creator>"
						local link 			= getPropText item  "<link>" 				"</link>"
						local description	= getPropText item  "<description>" 		"</description>"
 
						--format "Item NR:% Title:% Author: % Link:% \nDescription:%\n\n" i title author link description
						#(title, link, author)
					))
				)
			)
			OK
		)--END updateItems FN
		,
 
		fn browser URL:"http://www.scriptspot.com/frontpage/feed/index.xml" title:"[ ScriptSpot ] Browser" taskBar:true = 
		(
			try( helpBrowserRO.Hide() )catch() --if the form is allready defined and shown, hide it
 
			--Create a DotNet Form
			helpBrowserRO = dotNetObject "MaxCustomControls.MaxForm"
			helpBrowserRO.size = dotNetObject "System.Drawing.Size" ((getMAXWindowSize())[1]/1.5) ((getMAXWindowSize())[2]/1.5)
			helpBrowserRO.name = dotNetObject "System.String" title
			helpBrowserRO.text = dotNetObject "System.String" title
 
			helpBrowserRO.ShowInTaskbar = taskBar
			helpBrowserRO.ShowIcon = true
			helpBrowserRO.topmost = false
 
			helpBrowserRO.MinimizeBox = true
			helpBrowserRO.MaximizeBox = true
 
			helpBrowserRO.FormBorderStyle = (dotNetClass "System.Windows.Forms.FormBorderStyle").Sizable
			helpBrowserRO.SizeGripStyle = (dotNetClass "System.Windows.Forms.SizeGripStyle").Show
 
-- 			local ipath = ((symbolicPaths.getPathValue "$Max") + "\\scripts\\" + INTools.Name + "\\images\\icon_info.ico")
-- 			icon = dotNetObject "System.Drawing.Icon" ipath
 
 
			--Create a DotNet browser
			helpBrowserWB = dotNetObject "System.Windows.forms.WebBrowser"
			helpBrowserWB.url = dotNetObject "System.Uri" URL
			helpBrowserWB.size = helpBrowserRO.size --dotNetObject "System.Drawing.Size" 160 160
			helpBrowserWB.location = dotNetObject "System.Drawing.Point" -1 -1
 
			helpBrowserRO.controls.add helpBrowserWB --add the Button to the Form
 
 
			--Add an Event Handler for the resize event:
			fn whenButtonIsPressed a b = (	helpBrowserWB.size = a.size ) --resize the browser when the window is resized
			dotNet.addEventHandler helpBrowserRO "Resize" whenButtonIsPressed
 
			helpBrowserRO.show() --show the Form with the Button
 
		)--END browser FN
		,
 
		fn redrawFN display:true =
		(
			if scriptSpotter != undefined do
			(
				local parentName = "[ ScriptSpot ]"
 
				local startPos = onscreenMenuSettings[2]
				local showStartMenu = (drawtext text:parentName pos:startPos) AND keyboard.shiftpressed 
 
				if onscreenMenuSettings[1] OR showStartMenu do
				(
					onscreenMenuSettings[1] = not onscreenMenuSettings[1] 
 
					local te = gw.getTextExtent parentName
					--startPos += [te.x + 10, 0]
					startPos += [0, te.y+2]
					local changePos 		= drawtext text:"Change Pos " 			pos:startPos
					local closeUI 			= drawtext text:"x" 							pos:(startPos + 	[(gw.getTextExtent "Change Pos xxxxxx").x, 0])	
					startPos.y +=  te.y
 
					if folders != undefined AND folders.count > 0 do
					(
						drawtext text:"- - - - - - - - - - - - - - - - -" 								pos:startPos	;	startPos.y +=  te.y
						drawtext text:"3ds Max - Latest" 													pos:startPos	;	startPos.y +=  te.y
						local teL = gw.getTextExtent "HHHHHHHHHHHHHHHHHHHHH"
						local teC = gw.getTextExtent "HHHHHHHHHHHHHHHH"
						for i = 1 to folders.count do
						(
							local folder = folders[i]
 
							local textLeft = modSTR ("- "+ folder[1] ) 30
							local dtL=drawtext text:textLeft pos:startPos
 
							local textCenter = modSTR ("|| by: " + folder[3]) 25
							local dtC=drawtext text:textCenter pos:(startPos	+ [teL.x,0])
 
	-- 						local textRIght = "|| " + folder[5]
	-- 						local dtR=drawtext text:textRIght pos:(startPos	+ [teL.x+teC.x,0])
 
							startPos.y +=  te.y
							if dtL OR dtC do 
							(
								onscreenMenuSettings[1] = false
								--shellLaunch folder[2] ""
								browser url:folder[2] title:(parentName + " - " + folder[1] )
							)
						)
					)
 
 
					if closeUI do 
					(
						onscreenMenuSettings[1] = false	
					)
 
					if changePos do
					(
						pickpoint()
						onscreenMenuSettings[2] = mouse.pos
					)
 
				)
				gw.updatescreen()
				OK
			)
		)--END redrawFN FN
 
	)--END Struct
	global scriptSpotter = scriptSpotte var:1
 
 
 
	rollout timerRO "" width:70 height:70
	(
		timer clock interval:(1000*60*7) active:true
 
		on timerRO open do
		(
			if internet.CheckConnection url:"http://www.scriptspot.com" force:true == true then
			(
				registerRedrawViewsCallback scriptSpotter.redrawFN
				scriptSpotter.updateItems()
				format "%\n" "ScriptSpotter Loaded"
			)
			else
			(
				format "%\n" "ScriptSpotter not updated, no Connection"
			)
		)
		on clock tick do
		(
			if internet.CheckConnection url:"http://www.scriptspot.com" force:true == true then
			(
				scriptSpotter.updateItems()
				--format "%\n" "ScriptSpotter Updated"
			)
			else
			(
				format "%\n" "ScriptSpotter not updated, no Connection"
			)
		)
 
	)--END timerRO
	global scriptSpottertimerRO = timerRO
 
	createDialog scriptSpottertimerRO pos:[-4444,-4444]
	OK
)

just remember to give credit ;)

Raphael 'Insanto' Steves
http://Graph.Net84.Net

razz's picture

How to do the RSS reading part

Hi Raphael,

Great script. Would you mind sharing how you did the RSS-reading part?

thanks in advance.

Rasmus Eilertsen
Orbitstudio.eu

Graph's picture

you can drop it in your

you can drop it in your max/scripts/startUp folder if you'd like it to start with max

Raphael 'Insanto' Steves
http://Graph.Net84.Net

A.K.Gandhi's picture

where to copy the .ms file in

where to copy the .ms file in max2010 32bit

A.K.Gandhi

Graph's picture

thx everyone :) harumscarum,

thx everyone :)
harumscarum, i suggest http://www.scriptspot.com/3ds-max/scripts/auto-loader :P
kurson, paste a link and ill see if its using the same item structure as the scriptSpot feed

Raphael 'Insanto' Steves
http://Graph.Net84.Net

Michele71's picture

Thank for this nice Script

Thank for this nice Script Insanto! ;) on point to you :) :)

kurson's picture

Great script, can it Rss for

Great script, can it Rss for another site?
cheers

harumscarum's picture

cool! how to make it

cool! how to make it autostart?
thanks

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.