Keystroke Access to Scripts

In Edit Mode/Object Mode… press NumPad 9 and it will pop a list with the scripts in you system. To use, open in a Text Window and then enable it in the “Space Handler Scripts” entry in the View menu. This features is in my hotspots set of tools but its a bit bloated if you just need this, so I post here for all the keyboard freaks out there :slight_smile:

If you need this , you can try it. Its really messy code but works :slight_smile:

I choose that KEY because it will more likely never be used in blender.

(Because of a bug in the blender code space handler scripts like this always crash in you perfom a global undo (Ctrl Z), Im sure that will be fixed soon)

http://www.webfilehost.com/index.php?mode=viewupload&id=1806


# SPACEHANDLER.VIEW3D.EVENT

# Keystroke access to Python Scripts v0.1
# (c) 2005 Mariano Hidalgo a.k.a uselessdreamer 
# released under Blender Artistic License
#
# Load this file into a Text Window, enable in Space Handlers menu
# Press NumPad 9 and there you have, Object/ Mesh scripts list.

import Blender
from Blender import Text,Window, Registry, Draw


# Retrieve and save user installed scriptss

scrip = (Blender.Get("homedir") + "/" + "bpymenus")
Text.Load(scrip)
a = Text.Get("bpymenus").asLines()

# Please don´t laught at me for the following :D
# I am terrible coder and I HATE parsing things ;)
meshNames = []
meshFiles = []
meshB = False
meshE = False
objectNames = []
objectFiles = []
obB = False
obE = False

for line in a:
	if line == "Mesh {": meshB = True
	if line == "Misc {": meshE = True
	if meshB == True and meshE == False and line != "Mesh {" and line !="}":
		til = line.find("'",2)
		meshNames.append(line[1:til])
		til2 = line.find("23")
		til3 = line.find(".py",til2+5)
		meshFiles.append(line[til2+4:til3+3])

for line in a:
	if line == "Object {": obB = True
	if line == "System {": obE = True
	if obB == True and obE == False and line != "Object {" and line !="}":
		til = line.find("'",2)
		if line[1:til] != "Add HotSpots to this .blend":
			objectNames.append(line[1:til])
		til2 = line.find("23")
		til3 = line.find(".py",til2+5)
		if line[til2+4:til3] != "hot_spots_init":
			objectFiles.append(line[til2+4:til3+3])
		
sm = {}
count = 0
for meshscript in meshNames:
	sm[meshscript] = meshFiles[count]
	count = count +1
Registry.SetKey("pykeysm",sm,True)		
sob = {}
count = 0
for obscript in objectNames:
	sob[obscript] = objectFiles[count]
	count = count +1
Registry.SetKey("pykeyOb",sob,True)	

evt = Blender.event	
if evt == Draw.PAD9:
	if Window.EditMode():
		sm = Registry.GetKey("pykeysm",1)
		scnames = []
		menutext = "Edit Mode Scripts%t1"
		for item in sm:
			scnames.append(item)
		scnames.sort()
		for item in scnames:
			menutext = menutext + "|" + item
		choice = Draw.PupMenu(menutext)
		if choice != -1:
			Blender.Run(Blender.Get("scriptsdir") + "/" + sm[(scnames[choice])])
	else:	
		so = Registry.GetKey("pykeyOb",1)
		scnames = []
		menutext = "Object Mode Scripts%t1"
		for item in so:
			scnames.append(item)
		scnames.sort()
		for item in scnames:
			menutext = menutext + "|" + item
		choice = Draw.PupMenu(menutext)
		if choice != -1:
			Blender.Run(Blender.Get("scriptsdir") + "/" + so[(scnames[choice])])
		
		Blender.event = None