[scribus] Script to reverse all numeric in text frames

adam7171 adam7171 at gmail.com
Sun Jan 20 18:05:54 UTC 2013

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.



    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 =
",", ""), "!", ""), "?", ""), ":", ""), "-", ""), "~", ""), "(", ""), ")",
""), "[", ""), "]", ""), "{", ""), "}", ""), "/", "")
    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

Ivan Winters | 30 Dec 2012 20:49
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.

More information about the scribus mailing list