[scribus] Script to reverse all numeric in text frames

adam7171 adam7171 at gmail.com
Wed Jan 23 13:22:33 UTC 2013


Thanks 'JL',

Yes, I do agree with you on the extension with the 'Numeric Too' parameter.
But could this be possible soon; I'm off schedule with some huge works and
would appreciate it very much if there's a 'patch' or script for this so
that I could get most of my headaches gone with the numerous reversing of
text manually. (Although I've attained the solution on MS Access, I still
have to work on Python with my algorithm - so can't directly work on
Scribus.) 

Right now am working on my database and export the text with the numeric
reversed and keeping the rest intact. But my workflow doesn't always get
started from the database and have to key-in directly into Scribus too. You
can imagine the headaches - I guess.

Adam


jluc-2 wrote:
> 
> 'o
> Best for your idea and for your script
> is to post a request on http://bug.scribus.net
> 
> Beside (or rather than scripting), that (mysterious to me) 'R' function
> could usefully be extended with a new 'numerictoo' parameter,
> to be specified through a dialog.
> When true, 'R' behaves as now,
> when false, numerics escape being reversed by 'R'.
> 
> 
> 'JL'
> 
> -------- Message original --------
> Sujet: Re: Script to reverse all numeric in text frames
> Date : Sun, 20 Jan 2013 10:05:54 -0800 (PST)
> De : adam7171 <adam7171 at gmail.com>
> Répondre à : Scribus User Mailing List <scribus at lists.scribus.net>
> Pour : scribus at lists.scribus.info
> Groupes de discussion: gmane.comp.graphics.scribus
> Références : <loom.20121229T162914-463 at post.gmane.org>
> 
> 
> Dear all,
> 
> I've solved the problem in MS Access (my CMS for a newsletter) and it does
> reverse all numeric and also replace them in reversed order. After that I
> could export that text to Scribus and use the Reverse font to get all the
> text in the Right-To-Left in correct order.
> 
> 
> I've listed my codes below. I just am not so familiar with Python and
> would
> really like to convert these codes to Python scripts for Scribus. If we
> can
> achieve this, it means a TOTAL SOLUTION for Arabic, Hebrew and other
> Right-To-Left languages. I can already see a lot of irritated Scribus
> users
> from the Hebrew and Arabic communities.Le 20/01/2013 19:05, adam7171 a
> écrit :>
>  > Dear all,
>  >
>  > I've solved the problem in MS Access (my CMS for a newsletter) and it
> does
>  > reverse all numeric and also replace them in reversed order. After that
> I
>  > could export that text to Scribus and use the Reverse font to get all
> the
>  > text in the Right-To-Left in correct order.
>  >
>  >
>  > I've listed my codes below. I just am not so familiar with Python and
> would
>  > really like to convert these codes to Python scripts for Scribus. If we
> can
>  > achieve this, it means a TOTAL SOLUTION for Arabic, Hebrew and other
>  > Right-To-Left languages. I can already see a lot of irritated Scribus
> users
>  > from the Hebrew and Arabic communities.
>  >
>  > These codes works fine. Any more suggestion you're most welcome to let
> me
>  > know. Also you could share this with your Python buddies.
>  > Also I can explain my ideas on algorithms regarding the subject.
>  >
>  > Rgds,
>  >
>  > Adam
>  >
>  > '===
>  >      Dim strString  As String
>  >      Dim strParts() As String
>  >      Dim i          As Integer
>  >      Dim strResult  As String
>  >      Dim boo_IsNumeric As Boolean
>  >      Dim strWord As String
>  >      Dim boo_IsAlphaNum As Boolean
>  >
>  >      strString = TextBoxDescription.Value
>  >      strParts = Split(strString, " ")
>  >      For i = 1 To UBound(strParts)
>  >          strWord = strParts(i)
>  >          boo_IsNumeric = IsNumeric(strParts(i))
>  >          If boo_IsNumeric = True Then
>  >              strResult = strResult & "|" & strParts(i)
>  >          End If
>  >          If boo_IsNumeric = False Then
>  >          boo_IsAlphaNum = boo_IsAlphaWithNumeric(strWord)
>  >             If boo_IsAlphaNum = True Then
>  > '                strResult = strResult & ", " & strParts(i)
>  >              End If
>  >          End If
>  >      Next i
>  >      strResult =
>  >
> Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(strResult,
>  > ",", ""), "!", ""), "?", ""), ":", ""), "-", ""), "~", ""), "(", ""),
> ")",
>  > ""), "[", ""), "]", ""), "{", ""), "}", ""), "/", "")
>  >      MsgBox strResult
>  >      MsgBox StrReverse(strResult)
>  >      strString = strResult
>  >      strParts = Split(strString, "|")
>  >      For i = 1 To UBound(strParts)
>  >          Me.TextBoxDescription.Value =
> Replace(Me.TextBoxDescription.Value,
>  > strParts(i), StrReverse(strParts(i)))
>  >      Next i
>  > '====
>  > Public Function boo_IsAlphaWithNumeric(strText As String) As Boolean
>  >      Dim i As Long
>  >      For i = 1 To Len(strText)
>  >          Select Case Mid(strText, i, 1)
>  >              Case Chr(48) To Chr(57)
>  >                  boo_IsAlphaWithNumeric = True
>  >                  Exit Function
>  >          End Select
>  >      Next i
>  >      boo_IsAlphaWithNumeric = False
>  > End Function
>  >
>  > 'xx*xx END of Codes
>  >
>  > RESPONSE By:-
>  > ============
>  > Ivan Winters | 30 Dec 2012 20:49
>  > (http://comments.gmane.org/gmane.comp.graphics.scribus/42787)
>  >
>  > Script to reverse all numeric in text frames
>  >
>  > Assuming ADAM's problem is with rtl text then a workaround with a
> script
>  > could presumably check each character using an 'is numeric' test (or
>  > similar test which scripting languages should support). If the Is
> Numeric =
>  > 1 then the character is looped out of the 'reverse text' function and
> kept
>  > (or returned depending in which sequence the script performs the
> commands
>  > in) to it's original order.
>  >
>  > Just a suggestion from someone who only occasionally plays with
> scripts.
>  >
>  > Ivan Winters
>  >
>  > -----
>  >
>  > adam7171 wrote:
>  >>
>  >> I've got a font in UTF-8 reversed in Scribus text frames but the
> numeric
>  >> are
>  >> displayed flipped too. I need to keep everything else reversed (which
>  >> can be done on Scribus) but the numeric to be intact.
>  >>
>  >>
>  >> ___
>  >> Scribus Mailing List: scribus at lists.scribus.net
>  >> Edit your options or unsubscribe:
>  >> http://lists.scribus.net/mailman/listinfo/scribus
>  >> See also:
>  >> http://wiki.scribus.net
>  >> http://forums.scribus.net
>  >>
>  >>
> 
> 
> 
> These codes works fine. Any more suggestion you're most welcome to let me
> know. Also you could share this with your Python buddies.
> Also I can explain my ideas on algorithms regarding the subject.
> 
> Rgds,
> 
> Adam
> 
> '===
>      Dim strString  As String
>      Dim strParts() As String
>      Dim i          As Integer
>      Dim strResult  As String
>      Dim boo_IsNumeric As Boolean
>      Dim strWord As String
>      Dim boo_IsAlphaNum As Boolean
> 
>      strString = TextBoxDescription.Value
>      strParts = Split(strString, " ")
>      For i = 1 To UBound(strParts)
>          strWord = strParts(i)
>          boo_IsNumeric = IsNumeric(strParts(i))
>          If boo_IsNumeric = True Then
>              strResult = strResult & "|" & strParts(i)
>          End If
>          If boo_IsNumeric = False Then
>          boo_IsAlphaNum = boo_IsAlphaWithNumeric(strWord)
>             If boo_IsAlphaNum = True Then
> '                strResult = strResult & ", " & strParts(i)
>              End If
>          End If
>      Next i
>      strResult =
> Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(strResult,
> ",", ""), "!", ""), "?", ""), ":", ""), "-", ""), "~", ""), "(", ""), ")",
> ""), "[", ""), "]", ""), "{", ""), "}", ""), "/", "")
>      MsgBox strResult
>      MsgBox StrReverse(strResult)
>      strString = strResult
>      strParts = Split(strString, "|")
>      For i = 1 To UBound(strParts)
>          Me.TextBoxDescription.Value =
> Replace(Me.TextBoxDescription.Value,
> strParts(i), StrReverse(strParts(i)))
>      Next i
> '====
> Public Function boo_IsAlphaWithNumeric(strText As String) As Boolean
>      Dim i As Long
>      For i = 1 To Len(strText)
>          Select Case Mid(strText, i, 1)
>              Case Chr(48) To Chr(57)
>                  boo_IsAlphaWithNumeric = True
>                  Exit Function
>          End Select
>      Next i
>      boo_IsAlphaWithNumeric = False
> End Function
> 
> 'xx*xx END of Codes
> 
> RESPONSE By:-
> ============
> Ivan Winters | 30 Dec 2012 20:49
> (http://comments.gmane.org/gmane.comp.graphics.scribus/42787)
> 
> Script to reverse all numeric in text frames
> 
> Assuming ADAM's problem is with rtl text then a workaround with a script
> could presumably check each character using an 'is numeric' test (or
> similar test which scripting languages should support). If the Is Numeric
> =
> 1 then the character is looped out of the 'reverse text' function and kept
> (or returned depending in which sequence the script performs the commands
> in) to it's original order.
> 
> Just a suggestion from someone who only occasionally plays with scripts.
> 
> Ivan Winters
> 
> -----
> 
> adam7171 wrote:
>  >
>  > I've got a font in UTF-8 reversed in Scribus text frames but the
> numeric
>  > are
>  > displayed flipped too. I need to keep everything else reversed (which
>  > can be done on Scribus) but the numeric to be intact.
>  >
>  >
>  > ___
>  > Scribus Mailing List: scribus at lists.scribus.net
>  > Edit your options or unsubscribe:
>  > http://lists.scribus.net/mailman/listinfo/scribus
>  > See also:
>  > http://wiki.scribus.net
>  > http://forums.scribus.net
>  >
>  >
> -- 
> View this message in context:
> http://old.nabble.com/Script-to-reverse-all-numeric-in-text-frames-tp34842352p34923722.html
> Sent from the Scribus New mailing list archive at Nabble.com.
> 
> 
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
> 
> 
> 
> 
> 
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
> 
> 

-- 
View this message in context: http://old.nabble.com/Script-to-reverse-all-numeric-in-text-frames-tp34842352p34935237.html
Sent from the Scribus New mailing list archive at Nabble.com.




More information about the scribus mailing list