String event

I am trying to take a string and place it in the text field to save a blend file. Could this be done using a python script? Kind of like an auto-complete. I have the api reference, but I am a beginner to python and would appreciate any links/help. Thank you

What text field? I don’t think that this is possible at the moment, it might be after the event refactor, but most likely not.

sure, its no big deal in python.


name= “/home/me/some.blend”
def save(f): Blender.Save(f)
Blender.Window.FileSelector(save, name)

read the docs for help on Save overwriting etc.

Thank you for your help. I will try it.

Thank you again cambo! So, basically I can use this for anything. Here is the result. It is a button which puts the letter “z” in the text window. It looks useless, but I can expand its use for the pocket pc version of Blender.

import Blender 
from Blender import Window, Text, Draw, BGL 
txt = Text.Get("Text") 
vtext = Window.GetScreenInfo(Window.Types.TEXT) 
id = vtext[1]['id'] # get the (second) TEXT id 
def event(evt, val):
  global mystring 
  if evt == Draw.ESCKEY: 
  else: return # no need to redraw if nothing changed 
def draw(): 
   BGL.glClearColor(0.753, 0.753, 0.753, 0.0) 
   Draw.Button('The letter \"z\"', 1, 0, 0, 103, 55, '') 
def bevent(evt): 
   if evt == 1: #Button1 
      mystring = 'z' 
Draw.Register(draw, event, bevent)