OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Screenplay format: writing, importing & exporting(Founta

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
tin2tin
General User
General User


Joined: 27 Nov 2008
Posts: 11

PostPosted: Sat Feb 18, 2012 4:13 pm    Post subject: Screenplay format: writing, importing & exporting(Founta Reply with quote

I would like to code up a script, which is able to format a screenplay and import and export in this plain text format: http://fountain.io/syntax

I know about the ScriptRight template, but I would prefer that an extension would handle the whole thing. A couple of years back I've coded an OO extension so DVD slideshow GUI could use OO to extract images out of ppt files. In other words a Impress to DVD or any other kind of video slideshow solution, however I'm not too familiar with coding in OO basic. Here's what I'm thinking so far:

The writing part:
Code up a number of Paragraph Styles for ex. sluglines, characters names, dialogue etc. like the existing template formatting. Those styles should be accessible by short-cut keys and the formatting handled unintrusively.

The importing part:
A import parser should be coded to convert lines to the correct Paragraph styles according to the rules of the Fountain format. Maybe Final Draft format(XML) can be added too?

The exporting part:
Export to .fountain and maybe Final Draft format?

Not knowing about the details of OO Basic, do you think this is possible at all? What functions, paths or scriptlets would you recommend me to look into?


Last edited by tin2tin on Sat Feb 18, 2012 4:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
tin2tin
General User
General User


Joined: 27 Nov 2008
Posts: 11

PostPosted: Sat Feb 18, 2012 4:20 pm    Post subject: Reply with quote

On coding the the paragraph styles I came across the following example in Andrew Pitonyak's great doc. However it errors out on this function: FMT_ConfigAccessStyles(False). Is it thanks to API changes and if so where can I find a list of the API changes?

Code:
Sub CreateParStyles
  Dim oProps()
  Dim tabStopLoc%
  Dim sNextStyle$
  Dim sFontName$
  Dim fParSmallCharHeight As double
  Dim fParNormalCharHeight As double
  Dim oDoc
  Dim oConfigAccess
  Dim i%
 
  oDoc = FMT_FindTextDoc()
  oConfigAccess = FMT_ConfigAccessStyles(False)
  sNextStyle = getNextStyleName(oConfigAccess)
  If NOT DocHasParStyle(oDoc, sNextStyle) Then
    i = MsgBox("Current document does not have paragraph style '" & _
         sNextStyle & "' would you like to configure the formatter?", _
         35
    If i <> 6 Then
      Exit Sub
    End If
    RunCfgFmtDlg()
    sNextStyle = getNextStyleName(oConfigAccess)
    If NOT DocHasParStyle(oDoc, sNextStyle) Then
      MsgBox("Current document does not have paragraph style '" & _
         sNextStyle & "' Exiting now."
      Exit Sub
    End If
  End If
 
  fParSmallCharHeight = getSmallCharHeight(oConfigAccess)
  fParNormalCharHeight = getNormalCharHeight(oConfigAccess)
 
  sFontName = getFontName(oConfigAccess)
  If NOT DocHasFontName(oDoc, sFontName) Then
    i = MsgBox("Document does not have font name '" & _
         sName & "' would you like to configure the formatter?", _
         35
    If i = 7 Then
      Exit Sub
    End If
    If i = 6 Then
      RunCfgFmtDlg()
      sFontName = getFontName(oConfigAccess)
    End If
    RunCfgFmtDlg()
    sFontName = getFontName(oConfigAccess)
    If NOT DocHasFontName(oDoc, sFontName) Then
      i = MsgBox("Document still does not have font name '" & _
           sName & "' would you like to continue?", _
           35
      If i <> 6 Then
        Exit Sub
      End If
    End If
  End If

  REM Tab stops are set in the paragraph style
  ' 1/4 of an inch
  'tabStopLoc% = 2540 / 4
  tabStopLoc% = getTabWidth(oConfigAccess)
 
  REM Main paragraph stle for "small" text.
  REM There is no space above or below the stlye.
  REM The first line of code uses _code_first_line
  REM The last line of code uses _code_last_line.
  oProps() = Array(CreateProperty("ParaTopMargin", CLng(0)), _
    CreateProperty("ParaBottomMargin", CLng(0)), _
    CreateProperty("ParaLeftMargin", CLng(0)), _
    CreateProperty("ParaRightMargin", CLng(0)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("FollowStyle", "_code"), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("CharFontStyleName", "Bold"), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharWeight", 150.0), _
    CreateProperty("CharHeight", fParSmallCharHeight) )
  CreateParStyle("_code", oProps())
 
  oProps() = Array(CreateProperty("ParentStyle", "_code"), _
    CreateProperty("ParaTopMargin", CLng(2540 * 0.05)), _
    CreateProperty("ParaBottomMargin", CLng(0)), _
    CreateProperty("ParaLeftMargin", CLng(0)), _
    CreateProperty("ParaRightMargin", CLng(0)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("CharFontStyleName", "Bold"), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharWeight", 150.0), _
    CreateProperty("CharHeight", fParSmallCharHeight), _
    CreateProperty("FollowStyle", "_code") )
  CreateParStyle("_code_first_line", oProps())

  oProps() = Array(CreateProperty("ParentStyle", "_code"), _
    CreateProperty("ParaTopMargin", CLng(0)), _
    CreateProperty("ParaBottomMargin", CLng(2540 * 0.05)), _
    CreateProperty("ParaLeftMargin", CLng(0)), _
    CreateProperty("ParaRightMargin", CLng(0)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("CharFontStyleName", "Bold"), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharWeight", 150.0), _
    CreateProperty("CharHeight", fParSmallCharHeight), _
    CreateProperty("FollowStyle", sNextStyle) )
  CreateParStyle("_code_last_line", oProps())

  oProps() = Array(CreateProperty("ParaTopMargin", CLng(0)), _
    CreateProperty("ParaBottomMargin", CLng(2540 * 0.03)), _
    CreateProperty("ParaLeftMargin", CLng(2540 * 0.20)), _
    CreateProperty("ParaRightMargin", CLng(0)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharHeight", fParNormalCharHeight) )
  CreateParStyle("_OOoComputerCode", oProps())

  oProps() = Array(CreateProperty("ParentStyle", "_OOoComputerCode"), _
    CreateProperty("ParaTopMargin", CLng(0)), _
    CreateProperty("ParaBottomMargin", CLng(2540 * 0.10)), _
    CreateProperty("ParaLeftMargin", CLng(2540 * 0.20)), _
    CreateProperty("ParaRightMargin", CLng(0)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharHeight", fParNormalCharHeight), _
    CreateProperty("FollowStyle", sNextStyle) )
  CreateParStyle("_OOoComputerCodeLastLine", oProps())

  oProps() = Array(CreateProperty("ParentStyle", "_OOoComputerCode"), _
    CreateProperty("ParaTopMargin", CLng(0)), _
    CreateProperty("ParaBottomMargin", CLng(2540 * 0.03)), _
    CreateProperty("ParaLeftMargin", CLng(2540 * 0.10)), _
    CreateProperty("ParaRightMargin", CLng(2540 * 0.10)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharHeight", fParNormalCharHeight), _
    CreateProperty("FollowStyle", "_OOoComputerCodeInTable") )
  CreateParStyle("_OOoComputerCodeInTable", oProps())

  oProps() = Array(CreateProperty("ParentStyle", "_OOoComputerCode"), _
    CreateProperty("ParaTopMargin", CLng(0)), _
    CreateProperty("ParaBottomMargin", CLng(2540 * 0.08)), _
    CreateProperty("ParaLeftMargin", CLng(2540 * 0.10)), _
    CreateProperty("ParaRightMargin", CLng(2540 * 0.10)), _
    CreateProperty("ParaFirstLineIndent", CLng(0)), _
    CreateProperty("CharFontName",sFontName), _
    CreateProperty("ParaTabStops", tabStopLoc), _
    CreateProperty("ParaLineNumberCount", False), _
    CreateProperty("WritingMode", com.sun.star.text.WritingMode.LR_TB), _
    CreateProperty("CharAutoKerning", False), _
    CreateProperty("CharHeight", fParNormalCharHeight), _
    CreateProperty("FollowStyle", sNextStyle) )
  CreateParStyle("_OOoComputerCodeLastLineInTable", oProps())
End Sub
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Sat Feb 18, 2012 5:08 pm    Post subject: Reply with quote

This is old but may help you.
http://www.oooforum.org/forum/viewtopic.phtml?t=989&highlight=screen+play
Back to top
View user's profile Send private message
tin2tin
General User
General User


Joined: 27 Nov 2008
Posts: 11

PostPosted: Sun Feb 19, 2012 12:33 am    Post subject: Reply with quote

Thank you. I remember looking into that thread a couple of years back, however is seems that the macro code is gone: http://www.ooomacros.org/files.php?type=macro#ScreenplayTemplate and so is http://www.ooomacros.org.

Are there any mirrors of ooomacros or that macro script around? Would be really helpful. When I search around the oo-scripting world, it seems to be full of too old code, info and broken links. What are the most current and up to date "waterholes"? Where is the most up-to-date version of the OO Basic API?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group