[texworks] Auto-completion - Document Jumps

Paul A Norman paul.a.norman at gmail.com
Wed Jun 15 09:26:41 CEST 2011


Dear Alain,

Good to see you on the list lately - been back in Africa at all?

Python is not yet a strength of mine--on a long to do list, I really
like the look of it :)

Head looks great...

# TeXworksScript
# Title:  Make Bullet
# Description: Inserts a bullet for autocompletion
# Author:  Paul Norman
# Version: 0.1
# Date: 2011-06-15
# Script-Type: standalone
# Context: TeXDocument
# Shortcut: Alt+M, Alt+B

TW.target.insertText(u"\u2022")

Indentation and spacing is everything in Python from what I recall.
This works, note the u in-front of the quote mark for Python encoding
needs here.

Here is a link to a script for writing new scripts :) helps get the
head consistently in order.

http://code.google.com/p/texworks/issues/detail?id=261#c41

re the QtScript version ...

Have you got Alt+M, Alt+B  assigned to any other Script at all?

Does the Script appear in Script manager? Or on the Script menu?

.js is  one of the standard QtScript  extensions.

Or did I misunderstand and you just want to do it in python anyway?

paul


On 15 June 2011 18:44, Alain Delmotte <esperanto at swing.be> wrote:
> Hi Paul,
>
> This is a .js script, how to make it Python?
>
> ------------------------
> # TeXworksScript
> # Title:  Make Bullet
> # Description: Inserts a bullet for autocompletion
> # Author:  Paul Norman
> # Version: 0.1
> # Date: 2011-03-05
> # Script-Type: standalone
> # Context: TeXDocument
> # Shortcut: Alt+M, Alt+B
>

The header look right

Python is not my strength in scripting but ...

For python try this, note the leading u

 TW.target.insertText(u"\u2022")

or perhaps

  mybullet = str(u"\u2022")

 TW.target.insertText(mybullet)




> ------------------------
> doesn't work for me.
>
> Thanks,
>
> Alain
>
> Le 15/06/2011 01:10, Paul A Norman a écrit :
>>
>> P.S. a simple script for inserting bullets if keyboard is too difficult
>>
>> // TeXworksScript
>> // Title:  Make Bullet
>> // Description: Inserts a bullet for autocompletion
>> // Author:  Paul Norman
>> // Version: 0.1
>> // Date: 2011-03-05
>> // Script-Type: standalone
>> // Context: TeXDocument
>> // Shortcut: Alt+M, Alt+B
>>
>>  TW.target.insertText("\u2022");
>>
>>
>
>
>



More information about the texworks mailing list