Pasting a script/text into blender, the quick way

Just had to paste some code into blender and thought of a much nicer way to do it. Should work on most terminals, only tested on Windows.

Make sure you have the default text window Text and another called Paste. In Text enter the following:

import Blender
from Blender import Text
t = Text.Get('Paste')
s = raw_input()
while s != 'END':
    t.write(s + '
')
    s = raw_input()

Do Alt+P to run and blender will stop working while you paste text into the console. Press Enter, type END and press Enter again. Return to Blender and it’s there in Paste.

Note: If your text contains the word END on its own on a line… i’m sure you can see where this would cause problems. Edit as needed.

Why not use standar copy/paste? :confused:

ya like on windows
ctrl+c and ctrl+v copy’s in blender

but shift+ctrl+c and shift+ctrl+v copy’s and pastes using the system clipboard

LOL !

Leave it to a programmer to find the “easier” way. :smiley:

The easy way, as others here have already said is to use SHIFT-CTRL-v

But before I discovered that, I would have just copied / pasted from the web browser into my text editor and then saved it / opened the file in Blender :slight_smile:

Still it was interesting to try your code anyway :smiley:

Mike

I feel silly.

Thanks for the shortcut. I think I got a little Python-happy. Just started using it.

dont feel so silly, Non Win32 Blenders dosent have Ctrl+Shift+C/V