PDA

View Full Version : XML Transformation Script (PowerShell)


EightBitz
January 15th, 2017, 02:49 AM
New version as of August 14th
Version: 1.6

Fixes:
• Changed the method of loading the XML data so it allows for loading larger files.
• Fixed an issue with smart images where the script generated an error if the image was revealed, nothing was unmasked, and the export included only revealed content. Now, instead of generating an error, the script ignores the lack of image data.
• Fixed an issue with the GUI script where the Destination file dialog was not filtering for the proper extensions according to the selected output format (Word vs. HTML).


Please read the release notes.

https://github.com/EightBitz/RWExport

Bidmaron
January 15th, 2017, 04:53 AM
We are going to need a new sticky somewhere or an entirely new sub forum with user-donated tools, as I am sure this is just the first of the useful things that folks will generate to handle morphing exports.

Eightbitz, congrats on paving the way, and I pray you find a job.

rob
January 15th, 2017, 05:04 AM
Absolutely stick with Compact format. That's exactly what you should be using for stuff like this.

And I echo @Bidmaron's sentiments about best wishes for finding gainful employment quickly!

I'll need to talk to BJ about what we're going to do about user-created tools. That's something that I'd always expected once we got the export/import stuff into place, but it's also something I neglected give any serious thought to how we can facilitate. <sigh>

mazzy
January 15th, 2017, 07:24 AM
I love that you are choosing to share this with the community and appreciate the time and knowledge you spent coming up with a solution, thanks so much Eightbitz!

If you'd like a hand with the HTML and CSS portion, I'm willing to give it a go. Mind you, I'm out of practice, it's been about 5'ish years since I last did anything with HTML/CSS, so if you'd rather take up someone else's offer or do it yourself, I completely understand :)

I second Bidmaron's suggestion of a repository for these type of posts, I'm sure there will be plenty of users that come up with clever solutions for doing different things with our newly found powers ;) Github would be a fantastic way for users to contribute under the Lone Wolf umbrella, would allow for versioning control, not to mention a way to review and approve submissions. Just a suggestion, of course, I'm sure you guys will come up with a solution that works :)

daplunk
January 15th, 2017, 08:49 AM
Eventually... Does the content market have a category for things like this? Keep the forums clean.

AEIOU
January 15th, 2017, 10:55 AM
I think we'll need a forum for general user reviews. While I think the Grey Whatsits will be helpful, they could be overwhelmed. And it would be nice to have Grey Whatsits and community reviews all collected in the same place so we don't run all over looking for information. It may be that reviews and tools can live happily together to reduce the number of forums? And I could be totally offbase and the ability to do reviews will be tied directly to the files in the Marketplace. I'm just throwing noodles at the fridge to see what might stick.... ;)

rob
January 16th, 2017, 01:24 AM
Eventually... Does the content market have a category for things like this? Keep the forums clean.

Not really. Nor does the Content Market current design model allow us to READILY integrate something like this. So it will require some thought. Which means it probably won't get the attention it deserves for a few more weeks, since the immediate focus is on fixing bugs in export/import/conversion and then delivering content to everyone. That's not the answer I want to be giving here, but it looks to be the reality of the situation. So, at least in the interim, the forums will have to suffice.

EightBitz
January 16th, 2017, 02:03 AM
Not really. Nor does the Content Market current design model allow us to READILY integrate something like this. So it will require some thought. Which means it probably won't get the attention it deserves for a few more weeks, since the immediate focus is on fixing bugs in export/import/conversion and then delivering content to everyone. That's not the answer I want to be giving here, but it looks to be the reality of the situation. So, at least in the interim, the forums will have to suffice.

Thank you, thank you, thank you for the export! I can't say that enough. This is the one reason I've been holding off on really using RW.

Also, no offense, but I'm taking your name in vain while improving my PowerShell script. The fact that a plain-text snippet can have multiple ordered lists, multiple unordered lists, multiple tables, and multiple instances of unformatted text, in any order, has made my life difficult. :-p

As a user, of course, I love that flexibility. But dealing with that with the script has been challenging. I think I'm there, though. I've been able to parse out all the different blocks, in order, and now I'm parsing the blocks themselves.

I'm done with the plain text, the ordered lists, and the unordered lists, and just have to deal with the tables.

Mind you, this is all for the plain text transformation. When I'm done with that, I'll work on an HTML one which, I gather, would be easier in this regard as I can leave more of the HTML tags in place instead of tearing it apart like I am now for plain text.

Now YOU can laugh at MY pain.

Seriously and sincerely, though, thank you for this. And don't forget to take care of yourself! You're going to need your strength to deal with the angry mob outside who are just waiting to bust your chops about custom calendars. ;-D

davidp
January 16th, 2017, 06:21 AM
Also, no offense, but I'm taking your name in vain while improving my PowerShell script. The fact that a plain-text snippet can have multiple ordered lists, multiple unordered lists, multiple tables, and multiple instances of unformatted text, in any order, has made my life difficult. :-p

The <contents> of a <snippet> should all be HTML and that would be the only place that the lists, tables, etc. would be present. You should be able to take the <contents> and just treat it as HTML and be done with it. Any more and you are making life hard on yourself. :)

The only slight gotcha is that we use encoding of the contents so that it isn't interpreted as XML tags, but that should be straight-forward to deal with.

Vargr
January 16th, 2017, 07:06 AM
@EightBitz:

Notice how we have been civil and not turned into an angry mob complete with touches and pitchforks - yet...

Nah, just kidding. :-)

EightBitz
January 16th, 2017, 07:13 AM
The <contents> of a <snippet> should all be HTML and that would be the only place that the lists, tables, etc. would be present. You should be able to take the <contents> and just treat it as HTML and be done with it. Any more and you are making life hard on yourself. :)

The only slight gotcha is that we use encoding of the contents so that it isn't interpreted as XML tags, but that should be straight-forward to deal with.

Yep. For the HTML version, I'll be taking advantage of that. Right now, I just wanted a plain text version. No HTML or anything.

EightBitz
January 16th, 2017, 07:21 AM
OK, I'm not going to keep cluttering up the forum, but here's a much better version of the plain text export. No HTML or anything yet, just plain text.

I'll set up a DropBox or something soon.

I sorted out a few bugs and oversights, and added some functionality:

Version 0.5a
Added a -Prefix switch to optionally include a topic's prefix.
Added a -Suffix switch to optionally include a topic's suffix.
Added a -Sort option to sort topics by:
1 = Name
2 = Prefix, Name **Default**
3 = Category, Name
4 = Category, Prefix, Name

Choosing options 2 or 4 will sort by prefix, regardless of whether or not
the -Prefix switch is specified. Likewise, choosing options 1 or 3 will
sort by name, regardless of whether or not the -Prefix switch is specified.

Added parentage for topics.
Made the topic suffix parenthetical so it's consistent with the display in RW.

Better (I hope) parsing of snippets, and support for more types.

Supported snippet types include:
Text (Including lists and tables, but NOT including any formatting such as bold, italic, highlights, etc.)
GM Directions
Labeled Text
Tags
Calendar Date
Calendar Date Range
Numeric Value
Tags (MultiDomain)

Unsupported snippet types include:
Picture (Simple)
Smart Image (Map)
Statblock
Hero Lab Portfolio
Foreign Object
Any snippet types listed under "Documents and Media"

It now responds to the Get-Help cmdlet.

Get-Help RWExport-To-Text.ps1

Have fun!


# RWExport-To-Text.ps1 (formerly Format-RWExport.ps1)
# by EightBitz
# Version 0.5a
# 1/16/2017, 10:10 AM CST
#
# Copy this full length of code into a text file, and save it as Format-RWExport.ps1
#
# Open a Powershell window, and CD to where you saved it.
# For example, if you saved in C:\Users\EightBitz\Desktop, then in the Powershell window, you would type:
# CD \Users\EightBitz\Desktop
#
# Then run the powershell script, specifying the source file (the compact export you created)
# and the new destination file you wish to create or overwrite. Example:
# .\Format-RWExport.ps1 -Source "C:\Users\EightBitz\desktop\Export test.rwoutput" -Destination C:\Users\EightBitz\desktop\TransformedExportTest.t xt
#
#
# CSS categories:
# <title>
# <topic>
# <section>
# <snippet>
#
# Track parentage and levels of topics and sections
#
# Sort topics
#

<#
.SYNOPSIS
RWExport-To-Text.ps1 transforms a RealmWorks export file into a plain text file.

By: EightBitz
Date: 1/16/2017
Version 0.5a

.DESCRIPTION
RWExport-To-Text.ps1 loads the XML file exported from Realm Works and transforms it into plain text so it can be printed or imported/pasted into other programs. The export from Realm Works must done with the Compact Output option.
.PARAMETER Source
Enter the full path and filename for the source file (the Realm Works export file).
.PARAMETER Destination
Enter the full path and filename for the destination file (the plain text output).
.PARAMETER Sort
Choose your preferred sort order for exported topics.
1 = Name
2 = Prefix, Name **Default**
3 = Category, Name
4 = Category, Prefix, Name
.PARAMETER Prefix
Include this parameter to display the prefix for each topic.
.PARAMETER Suffix
Include this parameter to display the suffix for each topic.
.EXAMPLE
RWExport-To-Text.ps1 -Source MyExport.rwoutput -Destination MyPlainTextFile.txt
.EXAMPLE
RWExport-To-Text.ps1 -Source MyExport.rwoutput -Destination MyPlainTextFile.txt -Sort 1
.EXAMPLE
RWExport-To-Text.ps1 -Source MyExport.rwoutput -Destination MyPlainTextFile.txt -Prefix -Suffix
.NOTES
The specified sort order will occur regardless of whether or not prefixes are included.
If you sort by prefix, but do not include the -Prefix parameter, your topics will still be sorted by prefix, even though the prefix won't be displayed.
Likewise, if you sort by Name, but do include the -Prefix parameter, your topics will still be sorted by name, even though the prefix will be displayed.

It appears that topics will always be sorted under their containers. In other words, topics that are not in containers will be sorted relative to each other. Contained topics will be sorted relative to their peers within that container.

Everything outputs in plain text. I do want to work on an HTML/CSS version, but first I had to get all of this done. This is my foundation for building a version with formatted output.
#>

param (
# Source file path and name.
[Parameter(Mandatory,Position=1)]
[string]$Source,

# Destination file path and name.
[Parameter(Mandatory,Position=2)]
[string]$Destination,

# Sort topics by:
# 1 = Name
# 2 = Prefix, Name **Default**
# 3 = Category, Name
# 4 = Category, Prefix, Name
#
# Choosing options 2 or 4 will sort by prefix, regardless of whether or not
# the -Prefix switch is specified. Likewise, choosing options 1 or 3 will
# sort by name, regardless of whether or not the -Prefix switch is specified.
[Parameter()]
[int]$Sort = 2,

# Include prefix in topic name ($true or $false)
[switch]$Prefix,

# Include suffix in topic name ($true or $false)
[switch]$Suffix

) # param

Function ParseTopic($PassedTopic,$Outputfile,$Sort,$Prefix, $Suffix,$Parent) {
$TopicName = $PassedTopic.public_name
if ($Prefix -and $PassedTopic.Prefix) {$TopicName = $PassedTopic.Prefix + " - " + $TopicName}
if ($Suffix -and $PassedTopic.Suffix) {$TopicName = $TopicName + " (" + $PassedTopic.Suffix + ")"}
$TopicName = "Topic: $TopicName"
$ParentName = "Parent Topic: $Parent"
$CategoryName = "Category: " + $PassedTopic.category_name

Add-Content -Path $outputfile -Value $TopicName
Add-Content -Path $outputfile -Value $ParentName
Add-Content -Path $outputfile -Value $CategoryName
If ($PassedTopic.tag_assign) {ParseTags $PassedTopic $Outputfile}
If ($PassedTopic.linkage) {ParseLinkage $PassedTopic $outputfile}
Add-Content -Path $outputfile -Value ""

foreach ($Section in $PassedTopic.section) {
ParseSection $Section $Outputfile
} # foreach ($Section in $PassedTopic.section)

Switch ($Sort) {
1 {$TopicList = $PassedTopic.topic | Sort-Object public_name}
2 {$TopicList = $PassedTopic.topic | Sort-Object prefix,public_name}
3 {$TopicList = $PassedTopic.topic | Sort-Object category_name,public_name}
4 {$TopicList = $PassedTopic.topic | Sort-Object category_name,prefix,public_name}
default {$TopicList = $PassedTopic.topic}
}

$Parent = $Parent + $PassedTopic.Public_Name + "/"
foreach ($Topic in $TopicList) {
ParseTopic $Topic $Outputfile $Sort $Prefix $Suffix $Parent
} # foreach ($Topic in $PassedTopic.topic)
} # Function ParseTopic($PassedTopic)

Function ParseSection ($PassedSection,$Outputfile) {
$SectionName = "Section: " + $PassedSection.name
Add-Content -Path $outputfile -Value $SectionName
Add-Content -Path $outputfile -Value ""
foreach ($Snippet in $PassedSection.snippet) {
ParseSnippet $Snippet $Outputfile
} # foreach ($Snippet in $PassedSection.snippet)

foreach ($Section in $PassedSection.section) {
ParseSection $Section $Outputfile
} # foreach ($Section in $PassedSection.section)
} # Function ParseSection ($PassedSection)

Function ParseSnippet ($PassedSnippet,$Outputfile) {
switch ($PassedSnippet.type) {
"Multi_Line" {
if ($PassedSnippet.purpose -eq "directions_only") {
$Text = ParseSnippetText $PassedSnippet.gm_directions
$Text = "GM Directions: " + $Text
Add-Content -Path $outputfile -Value $Text
} elseif (($PassedSnippet.contents.contains("<ul")) -or ($PassedSnippet.contents.contains("<ol")) -or ($PassedSnippet.contents.contains("<table"))) {
$Text = ParseFormattedStuff $PassedSnippet.contents
Add-Content -Path $outputfile -Value $Text
} else {
$Text = ParseSnippetText $PassedSnippet.contents
Add-Content -Path $outputfile -Value $Text
} # if ($PassedSnippet.purpose -eq "directions_only")
Add-Content -Path $outputfile -Value ""
} # "Multi_Line"

"Labeled_Text" {
$Text = ParseSnippetText $PassedSnippet.contents
$LabeledText = $PassedSnippet.Label + ": $Text"
Add-Content -Path $outputfile -Value $LabeledText
Add-Content -Path $outputfile -Value ""
} # "Labeled_Text"

"Tag_Standard" {
ParseTags $PassedSnippet $outputfile
Add-Content -Path $outputfile -Value ""
} # "Tag_Standard"

"Numeric" {
$annotation = ParseSnippetText $PassedSnippet.annotation
$Numeric = $PassedSnippet.contents + ", $annotation"
Add-Content -Path $outputfile -Value $Numeric
Add-Content -Path $outputfile -Value ""
} # "Numeric"

"Tag_Multi_Domain" {
ParseTags $PassedSnippet $outputfile
Add-Content -Path $outputfile -Value ""
} # "Tag_Multi_Domain"

"Date_Game" {
$DateText = ParseSnippetText $PassedSnippet.annotation
$DateText = $PassedSnippet.game_date.display + ", " + $DateText
Add-Content -Path $outputfile -Value $DateText
Add-Content -Path $outputfile -Value ""
} # Date_Game

"Date_Range" {
$DateRange = $PassedSnippet.date_range.display_start + " to " + $PassedSnippet.date_range.display_end
$annotation = ParseSnippetText $PassedSnippet.annotation
$DateText = "$DateRange, $annotation"
Add-Content -Path $outputfile -Value $DateText
Add-Content -Path $outputfile -Value ""
} # Date_Range

default {
# Do nothing here.
} # default
} # switch ($PassedSnippet.type)
} # Function ParseSnippet

Function ParseSnippetText ($PassedText) {
if ($PassedText -ne $null) {
$gt = $PassedText.Indexof('>')
} else {
$gt = -1
} # if ($PassedText -ne $null)
$Text = $null
While ($gt -ge 0) {
# $gt = $PassedText.Indexof(">",$RWSnippet)
$lt = $PassedText.Indexof("<",$gt)
$length = $lt-$gt
if ($length -gt 1) {$Text = $Text + $PassedText.substring($gt+1,$length-1)}
if ($lt -lt $gt) {
$gt = -1
} else {
$PassedText = $PassedText.substring($lt,$PassedText.length-$lt)
$gt = $PassedText.Indexof('>')
} # if ($lt -lt $gt)
} # While ($gt -ge 0)
if ($Text.contains("&nbsp;")) {$Text = $Text.replace("&nbsp;","`r`n`r`n")}
Return $Text
} # Function ParseSnippetText

Function ParseTags ($PassedTags,$OuptutFile) {
# This block of code assumes that tags of the same domain will always be grouped together.
$domain = 0
$tagdomains = $PassedTags.tag_assign.domain_name
$tagdomain = $tagdomains[$domain]
$tagline = ""

foreach ($tag in $PassedTags.tag_assign) {
if ($tag.domain_name -eq $tagdomain) {
if ($tagline -eq "") {$tagline = $tagdomain + ": " + $tag.tag_name} else {$tagline = $tagline + ", " + $tag.tag_name}
$domain++
} else {
$tagdomain = $tag.domain_name
$tagline = $tagline + "`r`n" + $tagdomain + ": " + $tag.tag_name
$domain++
} # if ($tag.domain_name -eq $tagdomain)
} # foreach ($tag in $PassedSnippet.tag_assign)

Add-Content -Path $outputfile -Value $tagline
if ($PassedTags.annotation) {
$annotation = ParseSnippetText $PassedTags.annotation
Add-Content -Path $outputfile -Value "Annotation: $annotation"
} # foreach ($tag in $PassedTags.tag_assign)
} # Function ParseTags

Function ParseLinkage ($PassedTopic,$OutputFile) {
$Linkage = $PassedTopic.linkage
$LinkList = ""
foreach ($link in $linkage) {
if ($linklist -eq "") {$linklist = "Linkage: " + $link.target_name} else {$linklist = $linklist + ", " + $link.target_name}
} # foreach ($link in $linkage)
Add-Content -Path $OutputFile -Value $Linklist

} # Function ParseLinkage

Function ParseFormattedStuff ($PassedSnippet) {
$TagLocations = GetTagLocations $PassedSnippet
[array]$FullText = $null

foreach ($tag in $TagLocations) {
$tagtext = $PassedSnippet.substring($tag.start,$tag.end-$tag.start+1)
Switch ($tag.tag) {
"text" {
$Text = ParseSnippetText $tagtext
if ($Text) {
if ($Text.contains("&#xd;")) {$Text = $Text.Replace("&#xd;"," ")}
if ($Text.contains("&nbsp;")) {$Text = $Text.Replace("&nbsp;"," ")}
$Text = $Text.Trim()
Add-Content -Path $outputfile -Value $Text
}
} # "text"

"ul" {
$ordered = $false
$Text = ParseList $tagtext $ordered
Add-Content -Path $outputfile -Value $Text
} # "ul"

"ol" {
$ordered = $true
$Text = ParseList $tagtext $ordered
Add-Content -Path $outputfile -Value $Text
} # "ol"

"table" {
$table = ParseTable $tagtext
$Text = $table | Out-String
$Text = $Text.TrimEnd()
Add-Content -Path $outputfile -Value $Text
} # "table"

} # Switch ($tag.tag)
} # foreach ($tag in $TagLocations)
Add-Content -Path $outputfile -Value ""
} # Function ParseFormattedStuff

Function GetTagLocations ($PassedSnippet) {
$taglist = $null
# Get the locations of all the start tags.
$ul = $PassedSnippet.IndexOf("<ul")
$ol = $PassedSnippet.IndexOf("<ol")
$table = $PassedSnippet.IndexOf("<table")

While (($ul -ge 0) -or ($ol -ge 0) -or ($table -ge 0)) {
if ($ul -ge 0) {
$properties = @{
'Tag'='ul';
'Start'=$ul;
'End'=0
} # $properties

$TagLocation = New-Object –TypeName PSObject –Prop $properties
[array]$Taglist = $Taglist + $TagLocation
} # if ($ul -ge 0)

if ($ol -ge 0) {
$properties = @{
'Tag'='ol';
'Start'=$ol;
'End'=0
} # $properties

$TagLocation = New-Object –TypeName PSObject –Prop $properties
[array]$Taglist = $Taglist + $TagLocation
} # if ($ol -ge 0)

if ($table -ge 0) {
$properties = @{
'Tag'='table';
'Start'=$table;
'End'=0
} # $properties

$TagLocation = New-Object –TypeName PSObject –Prop $properties
[array]$Taglist = $Taglist + $TagLocation
} # if ($table -ge 0)

$Taglist = $Taglist | Sort-Object Start
$HighTag = $Taglist.Count-1
$StartPosition = $Taglist[$HighTag].Start + 1

$ul = $PassedSnippet.IndexOf("<ul",$StartPosition)
$ol = $PassedSnippet.IndexOf("<ol",$StartPosition)
$table = $PassedSnippet.IndexOf("<table",$StartPosition)
} # While (($ul -ge 0) -or ($ol -ge 0) -or ($table -ge 0))

# Get all the end tags.
foreach ($tag in $Taglist) {
$endtag = "</" + $tag.tag
$endtag = $PassedSnippet.IndexOf($endtag,$tag.Start + 1)
$Tag.end = $endtag+4
} # foreach ($tag in $Taglist)

# Fill in the gaps, if there are any.
$firstitem = 0
$firstpos = 0
$lastitem = $Taglist.count -1
for ($item=$firstitem; $item -le $lastitem; $item++) {
if (($firstpos -lt $Taglist[$item].start)) {
$endpos = $Taglist[$item].start - 1

$properties = @{
'Tag'='text';
'Start'=$firstpos;
'End'=$endpos
} # $properties

$TagLocation = New-Object –TypeName PSObject –Prop $properties
[array]$gaplist = $gaplist + $TagLocation

} # if (($firstpos -lt $Taglist[$item].start))

if ($item -eq $lastitem) {
$firstpos = $Taglist[$item].end + 1
$endpos = $PassedSnippet.length - 1

$properties = @{
'Tag'='text';
'Start'=$firstpos;
'End'=$endpos
} # $properties

$TagLocation = New-Object –TypeName PSObject –Prop $properties
[array]$gaplist = $gaplist + $TagLocation
} # if ($item -eq $lastitem)
$firstpos = $taglist[$item].end+1
} # for ($item=$firstitem; $item -le $lastitem; $item++)

$Taglist = $Taglist + $gaplist
$Taglist = $Taglist | Sort-Object start
Return $Taglist
} # GetTagLocations

Function ParseList ($PassedText,$Ordered) {
if ($PassedText -ne $null) {
$openli = $PassedText.Indexof('<li')
} else {
$openli = -1
}
[array]$List = $null
$ItemNumber = 1
While ($openli -ge 0) {
$closeli = $PassedText.Indexof("</li",$openli)
$length = $closeli-$openli
if ($length -gt 1) {
$LineItem = $PassedText.substring($openli+1,$length-1)
$LineItem = ParseSnippetText $LineItem
if ($Ordered) {$LineItem = $ItemNumber.ToString() + ". " + $LineItem} else {$LineItem = "* $LineItem"}
[array]$List = [array]$List + $LineItem
} # if ($length -gt 1)

if ($closeli -lt $openli) {
$openli = -1
} else {
$PassedText = $PassedText.substring($closeli,$PassedText.length-$closeli)
$openli = $PassedText.Indexof('<li')
} # if ($closeli -lt $openli)
$ItemNumber++
} # While ($openli -ge 0)
Return $List
} # Funcion ParseList

Function ParseTable ($PassedText) {
if ($PassedText -ne $null) {
$opentr = $PassedText.Indexof('<tr')
} else {
$opentr = -1
}
[array]$RowList = $null
While ($opentr -ge 0) {
$closetr = $PassedText.Indexof("</tr",$opentr)
$length = $closetr-$opentr
if ($length -gt 1) {
$Row = $PassedText.substring($opentr+1,$length-1)
$Row = $Row.Replace("tr>&#xd;","")
$Row = $Row.Trim()
[array]$RowList = [array]$RowList + $Row
}

if ($closetr -lt $opentr) {
$opentr = -1
} else {
$PassedText = $PassedText.substring($closetr,$PassedText.length-$closetr)
$opentr = $PassedText.Indexof('<tr')
}
} # While ($opentr -ge 0)

[array]$Table = $null
foreach ($Row in $RowList) {
if ($Row -ne $null) {
$opentd = $Row.Indexof('<td')
} else {
$opentd = -1
}
$ItemList = new-object psobject
$ItemNumber = 1
While ($opentd -ge 0) {
$closetd = $Row.Indexof("</td",$opentd)
$length = $closetd-$opentd
if ($length -gt 1) {
$Item = $Row.substring($opentd+1,$length-1)
$Item = ParseSnippetText $Item
$ItemList | Add-Member -Name "Item $ItemNumber" -Type noteproperty -value $Item
}

if ($closetd -lt $opentd) {
$opentd = -1
} else {
$Row = $Row.substring($closetd,$Row.length-$closetd)
$opentd = $Row.Indexof('<td')
}
$ItemNumber++
} # While ($opentd -ge 0)
[array]$Table = [array]$Table + $ItemList
} # foreach ($Row in $RowList)
$Text = $Table | Format-Table -HideTableHeaders -AutoSize -Wrap
Return $Text
} # Function ParseTable

# Main {
$inputfile = $Source
$outputfile = $Destination
[xml]$Export = Get-Content -Path $inputfile
$Title = "Title: " + $Export.Output.definition.details.name
Set-Content -Path $outputfile -Value $Title
Add-Content -Path $outputfile -Value ""
$Contents = $Export.output.contents

Switch ($Sort) {
1 {$TopicList = $Contents.topic | Sort-Object public_name}
2 {$TopicList = $Contents.topic | Sort-Object prefix,public_name}
3 {$TopicList = $Contents.topic | Sort-Object category_name,public_name}
4 {$TopicList = $Contents.topic | Sort-Object category_name,prefix,public_name}
default {$TopicList = $Contents.topic}
}

$Parent = "/"
foreach ($Topic in $TopicList) {
ParseTopic $Topic $outputfile $Sort $Prefix $Suffix $Parent
} # foreach ($Topic in $Contents.topic)
# } Main

AEIOU
January 16th, 2017, 09:46 AM
You aren't cluttering. This is really interesting to see the project develop and it's a critical need for the community. Thank you for tackling this huge need.

And all the best in your job searching.

davidp
January 16th, 2017, 09:52 AM
As far as a place to store code, github or gitlab could be good options. You can create free accounts on either and then check in code, getting versioning as part of it. git client is free. If someone wants to grab code but not install git, they can do so from the web interface. Anyone who wants to contribute to it can also submit changes that you could review and incorporate into your code base pretty easily.

rob
January 16th, 2017, 12:06 PM
@EightBitz:

Notice how we have been civil and not turned into an angry mob complete with touches and pitchforks - yet...

Nah, just kidding. :-)

I'm onto you guys. This is just the calm before the storm, when the pitchforks and torches are properly gathered and the villagers summoned from their homes to be properly equipped and whipped into a frenzy in the days ahead. Right? :)

kbs666
January 16th, 2017, 03:30 PM
I'm way too old school D&D for simple pitchforks. Guisarmes and Glaives for the peasants or there will be no mob.

rob
January 16th, 2017, 03:51 PM
OK, I'm not going to keep cluttering up the forum, but here's a much better version of the plain text export. No HTML or anything yet, just plain text.

This is NOT clutter. Please keep posting updates as you evolve this tool. There are going to be plenty of users who will find it valuable. :)

ShadowChemosh
January 16th, 2017, 03:55 PM
My only suggestion would be to keep the "First" page updated with the latest script. As this thread grows it can be hard for someone new to find the "latest" script. :)

This forum lets you edit any post you have ever done no matter how long ago.

Silveras
January 16th, 2017, 03:58 PM
I'm way too old school D&D for simple pitchforks. Guisarmes and Glaives for the peasants or there will be no mob.

Be careful of the Speed Factor on those...

daplunk
January 16th, 2017, 04:18 PM
Put the script in a GitHub. It's worth it as you can track changes and people can submit bug reports etc. Update the front page with a link to the GitHub.

AEIOU
January 16th, 2017, 05:14 PM
Hey! I had a pitchfork LAST time. You promised me I could have a torch!!!

Oh, and github is beautiful. Even for us non-coders. The 5e HL community stuff is there and it's easy to download and provide edits.

EightBitz
January 17th, 2017, 06:02 AM
The <contents> of a <snippet> should all be HTML and that would be the only place that the lists, tables, etc. would be present. You should be able to take the <contents> and just treat it as HTML and be done with it. Any more and you are making life hard on yourself. :)

The only slight gotcha is that we use encoding of the contents so that it isn't interpreted as XML tags, but that should be straight-forward to deal with.

Nope, I still have to tear things apart for HTML. There's another gotcha.

I'm adding an option to indent nested topics and sections. And it works great for everything except tables. Mind you, I'm still very much an amateur coder, but here's basically what's happening.

In order to indent blocks of text, and not just the first line, I'm using margin-left. For pre-formatted HTML text in the contents node, I'm inserting it right after the "<p " tag. And I add it to every instance, otherwise only some parts of some snippets will indent, and the rest will not.

Adding it to every instance of <p means it's also adding the margin to the table cells.

I could just write code that says if this snippet includes a table tag, then don't insert a margin, but if I have a combo snippet with text and lists and tables, that's not going to work.

So I have to divide things up into components again so I can have better control of where I insert the margins.

The GOOD news is that I already have that code. :-)

The bad news is that I've been up all night, and I'm tired.

But the GOOD news is that everything else is looking good, and this is hopefully the last thing I have to tackle.

The bad news is that I can't do it right now.

But the GOOD news is that ... uhhh ... oh, never mind.

Vargr
January 17th, 2017, 10:57 AM
I'm onto you guys. This is just the calm before the storm, when the pitchforks and torches are properly gathered and the villagers summoned from their homes to be properly equipped and whipped into a frenzy in the days ahead. Right? :)

Darn! Well, seems we will have to switch to plan B

EightBitz
January 17th, 2017, 02:12 PM
New version up. Handles HTML. See the first message in this thread or go here:

https://gist.github.com/EightBitz/c25fa287eefe03b5d752ba593a9735a1

daplunk
January 18th, 2017, 04:15 AM
Bloody nice work EightBitz! I tried it tonight and managed it with little to no issues. Had to modify the security settings on my PC to enable the script to run and I had removed the full stop from the start of the script thinking that was just to break any auto-formatting (I do that in Excel alot).

To make this a bit easier for new users to pick up here's a video on the process of setting up and running the script.

Realm Works - How To Print Your Realm (https://youtu.be/rDfwWKZ9cGI)

EightBitz
January 18th, 2017, 04:55 AM
Doh! I forgot about the security issue.
The Powershell command you need is:
Set-ExecutionPolicy RemoteSigned

That SHOULD do the trick.

EightBitz
January 18th, 2017, 05:07 AM
Bloody nice work EightBitz! I tried it tonight and managed it with little to no issues. Had to modify the security settings on my PC to enable the script to run and I had removed the full stop from the start of the script thinking that was just to break any auto-formatting (I do that in Excel alot).

To make this a bit easier for new users to pick up here's a video on the process of setting up and running the script.

Realm Works - How To Print Your Realm (https://youtu.be/rDfwWKZ9cGI)

OK, that was an awesome video, but you overlooked one very important detail.

There's a file called "main.css" that should have been included in the zip download. Put the HTML file in the same folder as the main.css file, and you will see a world of difference.

EightBitz
January 18th, 2017, 05:12 AM
And if you want nested topics and sections indented, you can add -Indent to the end of the command line.

If you type:
Get-Help .\RWExport-To-HTML.ps1 -full

You will see all the options available, with examples of how to use them on the command line.

EightBitz
January 18th, 2017, 06:21 AM
I just wanted to show people what the output SHOULD look like in your web browser, if you have the html and css files together, and if you use the -Indent option.

Playground1.pdf is the way I have things setup by default.
In Playground2.pdf, I just made a few changes to the css file to change the formatting, but it's the exact same HTML file.

EDIT: Note this is also from a newer version of the script that now displays images inline, and has links for statblocks. I want to smooth a few things out before I put this new version up, but the key here is to showcase the formatting.

daplunk
January 18th, 2017, 10:30 AM
Excellent! Have to admit... I was excited that I figured out how to get it working at all.... Will put a full video together showing this next step.

ShadowChemosh
January 18th, 2017, 11:16 AM
Nice EightBitz. Very nice! :)

tmilktoast
January 18th, 2017, 12:17 PM
First of all, thank you EightBitz, for the great script.

I figure you would want a report of any errors, so here goes. I've done some testing and believe I have it narrowed down to it choking on bullet lists (which I use heavily, unfortunately).

Interestingly, it works fine if I change the Snippet Type to Labeled Text and leave the bullet lists as-is. It also seems to work if I use the bullet list under "Styles" rather than under "Paragraphs". (Does anyone know why we have two sets of bullets, and other, lists?)


New-Object : Cannot find type [â€TypeName PSObject â€Prop]: verify that the assembly containing this type is loaded.
At D:\owncloud\rpg\utilities\rwexport\RWExport-To-HTML.ps1:388 char:25
+ ... $TagLocation = New-Object –TypeName PSObject –Prop $properties
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObje ctCommand

Cannot index into a null array.
At D:\owncloud\rpg\utilities\rwexport\RWExport-To-HTML.ps1:416 char:7
+ $StartPosition = $Taglist[$HighTag].Start + 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray


Edit: To expand on this, it looks like it hits a bullet list then gets stuck and just continually spits out these errors. The HTML file is still created, but ends at the snippet above the one with the bullet list.

EightBitz
January 18th, 2017, 12:23 PM
First of all, thank you EightBitz, for the great script.

I figure you would want a report of any errors, so here goes. I've done some testing and believe I have it narrowed down to it choking on bullet lists (which I use heavily, unfortunately).

Interestingly, it works fine if I change the Snippet Type to Labeled Text and leave the bullet lists as-is. It also seems to work if I use the bullet list under "Styles" rather than under "Paragraphs". (Does anyone know why we have two sets of bullets, and other, lists?)


New-Object : Cannot find type [â€TypeName PSObject â€Prop]: verify that the assembly containing this type is loaded.
At D:\owncloud\rpg\utilities\rwexport\RWExport-To-HTML.ps1:388 char:25
+ ... $TagLocation = New-Object –TypeName PSObject –Prop $properties
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObje ctCommand

Cannot index into a null array.
At D:\owncloud\rpg\utilities\rwexport\RWExport-To-HTML.ps1:416 char:7
+ $StartPosition = $Taglist[$HighTag].Start + 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray


Edit: To expand on this, it looks like it hits a bullet list then gets stuck and just continually spits out these errors. The HTML file is still created, but ends at the snippet above the one with the bullet list.

Would you be able to export just that one topic and copy and and paste the xml code in a private message to me?

tmilktoast
January 18th, 2017, 12:41 PM
Email sent.

EightBitz
January 18th, 2017, 12:46 PM
Email sent.

Thanks! I will take a look.

EightBitz
January 18th, 2017, 08:15 PM
To Rob, Davidp, daplunk, ShadowChemosh, and everyone else, I want to thank you for the kind words and moral support.

And daplunk, thank you for a mostly awesome video ... until the very end where you pulled up the unformatted HTML and said, "Well that's it!" And my jaw dropped with incredulity as I mentally screamed, "No, that is certainly NOT it!"

But still, you seem to have a very good method in making your videos. When I gear up to start entering my own data, I plan to watch more of them.

Right now, though, yes I am still updating the script. As you've seen in the PDF files that I posted, I'm adding support for stat blocks and images, and I've going to see what I can do with other snippet types. No guarantees on anything at this point.

daplunk
January 18th, 2017, 08:25 PM
:D Will update it tonight.

EightBitz
January 19th, 2017, 04:00 AM
New version up. See the first post in this thread.

daplunk
January 20th, 2017, 12:16 AM
Just thinking out loud here...

Powershell scripts can be run via .net applications right?

Which means it should be relatively simple to build a UI into this thing...

kbs666
January 20th, 2017, 02:09 AM
Just thinking out loud here...

Powershell scripts can be run via .net applications right?

Which means it should be relatively simple to build a UI into this thing...
LOL

Can be and relatively simple not same thing.

daplunk
January 20th, 2017, 02:12 AM
VB.Net just finished installing... I'll let you know lol

EightBitz
January 20th, 2017, 02:46 AM
Two very important things:

1) During my last update to GitHub, I carelessly pasted the wrong things in the wrong places, so the script wasn't properly updated with the latest version.

That is fixed now. (I hope.)

2) I have made a rather large oversight regarding snippets that contain both GM directions AND text. Up until now, I was making certain incorrect assumptions about how that case was handled in the XML code. I just now found out I was wrong. These snippets are not being handled correctly. They are not currently being included in the conversion.

I will have a fix for this later today or early tomorrow (which means definitely no later than Sunday).

daplunk
January 20th, 2017, 03:37 AM
As soon as you caught Bob something started to happen... I'm excited. This output file is growing in size very quickly.

daplunk
January 20th, 2017, 03:47 AM
WoW o.0

EightBitz
January 20th, 2017, 04:11 AM
WoW o.0

Is that a good wow or a bad wow? O.o

daplunk
January 20th, 2017, 04:12 AM
Its brilliant. I can't post the output... because well it's huge and not my content but it looks really good!

AEIOU
January 20th, 2017, 01:45 PM
@EightBitz: I too am impressed. When the survey was taken, printing didn't rank high enough but Rob gave it an honorable mention due to some very vocal advocates (no names mentioned but I guess we were pretty vocal). As a result it got tagged on to the higher priority list along with calendars. When I saw the shift to HTML I knew that this might become possible when the webview was released. This is amazing and well before I thought it would be possible. The community owes you a great deal for taking the plunge down the XML hole.

@EightBitz: Please also take care of yourself. I just want to say that I think of you and wish you all the best in your job search whenever I fire up RW nowadays or see the printing posts. May you be successful soon!

EightBitz
January 20th, 2017, 06:59 PM
@EightBitz: I too am impressed. When the survey was taken, printing didn't rank high enough but Rob gave it an honorable mention due to some very vocal advocates (no names mentioned but I guess we were pretty vocal). As a result it got tagged on to the higher priority list along with calendars. When I saw the shift to HTML I knew that this might become possible when the webview was released. This is amazing and well before I thought it would be possible. The community owes you a great deal for taking the plunge down the XML hole.

@EightBitz: Please also take care of yourself. I just want to say that I think of you and wish you all the best in your job search whenever I fire up RW nowadays or see the printing posts. May you be successful soon!

Thanks! I appreciate your kind words and your well wishes. :-)

I very much appreciate the work that Shadow and others put in to the Community packs, and the data sets that other people here have worked on and made available.

And though I haven't watched many of them yet, I'm going to start digging more into the videos people have been making. I know that type of thing takes a lot of time and patience. I could have made a video showing how to use this, but I think daplunk did a much better job with it than I would have.

I'm happy to share with a community where other people share, and it's really nice to hear that people are finding this not only useful, but impressive. It makes me realize that this is maybe something I can mention in job interviews. "Why should we hire you instead of anyone else?"

"Technology isn't just my career choice, it's a hobby and a passion. In fact, I wrote this XML conversion script for this application I use. I even shared it with the online community, and you'll be amazed at what happened next!"

MaxSupernova
January 20th, 2017, 08:24 PM
Brilliant. Thanks for your work.

Do you have anywhere we can buy you a coffee?

EightBitz
January 20th, 2017, 10:09 PM
If LWD has no objections, then for anyone who's willing to make a donation, I can privately share my PayPal info.

However, I want to make very clear that this is neither an expectation nor a condition.

You are welcome to use the script for free.

Pending Rob's approval, and assuming this does not violate the Realm Works license, I'm going to license this under the Creative Commons Attribution + Non-Commercial license.

-You are free to share and adapt the script.
-When sharing the script, you must give appropriate credit and indicate if changes were made.
-You may not use the material for commercial purposes.

Summary: https://creativecommons.org/licenses/by-nc/4.0/
Legalese: https://creativecommons.org/licenses/by-nc/4.0/legalcode

rob
January 21st, 2017, 01:53 AM
No problems here!

EightBitz
January 21st, 2017, 04:29 AM
New version up as of this morning. Please see the first post in this thread.

EightBitz
January 21st, 2017, 04:51 AM
Oops. Accidentally left the text for numbered lists as red instead of black. I just updated the main.css file on github. If you've already downloaded it you, can redownload it or just edit the main.css file, look for the "Numbered Lists" section, and change the color from "red" to "black".

EightBitz
January 21st, 2017, 01:37 PM
Just had a really cool idea. The organizational abilities of Realm Works + my conversion script = the ability to write and organize documentation that can be instantly converted to HTML, ready to print or publish on a web site. You can even include screenshots as simple pictures (just make sure to use the ScaleSimpleImages option to scale them up to 100%.

I don't have time to finish this right now as I have to get ready for game night, but see the attached for an example.

Congratulations, Rob. RealmWorks is now a productivity tool. :-D

This is making me reconsider the non-commercial license. I'd have to read up on how that works, exactly before I do. It might be worth it if people start convincing their bosses to let them expense the cost of purchase.

EDIT: Regarding the non-commercial bit, I have no objection to people using the script for something like this. I just don't want someone monetizing it.

daplunk
January 21st, 2017, 03:46 PM
Ok to build upon EightBitz amazing effort and make it simpler for the masses...

Alpha V0.1: Generate XML Transformation Script (https://drive.google.com/file/d/0B_6BXlzLTlj8YnctM05QWEd0ZHc/view?usp=sharing)

This is an application that will allow you to auto-generate the script that needs to be pasted into PowerShell. It still requires you to access PowerShell manually but should take the challenge out of creating the script.

I'm working on taking it to the next level and running the script itself. I'm not a programmer though so don't hold your breath. It's all dependant on my Googlefu.

Yes it's an executable. No it doesn't contain a virus. No it doesn't contain any error checking. No idea if it will work on all OS. No idea if you need to install anything to make it work. Yes I'm hungover so no there won't be any support provided today.

Good luck and EightBitz... thanks!

https://s24.postimg.org/l9b5stdut/2017_01_22_11_43_51_Generate_XML_Transformation.jp g

kbs666
January 21st, 2017, 04:20 PM
You wrote the above in VB? My VB is ancient. I could give you a function to run that script in C# but you'd have to translate it into VB or create a VB module, which isn't that hard IIRC, and call it from your VB program.

daplunk
January 21st, 2017, 04:31 PM
Yeah it's VB.net. I have the script running already. Trying to figure out how to handle where the script is running from atm. It's close.

AEIOU
January 21st, 2017, 06:12 PM
The Googlefu is very strong in this one.

Nice job, Daplunk. Just think what'll roll out over the next few months when the programmers in the community dive in. Pretty impressive start!

Farling
January 22nd, 2017, 02:37 AM
It should be possible to have that dialog window pop up directly from the powershell script to fill in missing questions (perhaps by invoking the script with a "-prompt" argument?).

I have a file selection dialog popup from my obsidian portal migration script, all done with powershell commands.

EightBitz
January 23rd, 2017, 02:17 AM
It should be possible to have that dialog window pop up directly from the powershell script to fill in missing questions (perhaps by invoking the script with a "-prompt" argument?).

I have a file selection dialog popup from my obsidian portal migration script, all done with powershell commands.

I don't think it's as easy -prompt. You have to procedurally define the form and its components, including event scripting. It's possible for sure. I've just been focusing on the script itself.

I still want to do logging so people with large realms can tell if the script is working or stuck. But maybe I'll look into this first.

EightBitz
January 24th, 2017, 01:16 AM
OK, I've got a working version of a PowerShell-built GUI. I need to polish some things up before I post it, and how long that takes depends on a few real-life things I have to do.

Why can't I just win the lottery? :-(

daplunk
January 24th, 2017, 01:22 AM
Because we need you... right here... doing this... for us :D

EightBitz
January 24th, 2017, 02:38 AM
New version up! See the first post in this thread.

EDIT: Yeah, yeah, I know what I said. But it was too late to go to sleep and too early to start making business calls.

EightBitz
January 24th, 2017, 02:52 AM
Actually, I was just going to post that there was a quirk in the GUI script, but then I realized, "No, wait, I can fix that!"

So I did. And the new version is up.

There. I'm done for the day. No more scripting stuff today. Gotta do real-life stuff.

daplunk
January 24th, 2017, 02:58 AM
Testing has commenced :D

EightBitz
January 24th, 2017, 03:59 AM
Updated the github link in the first post, because apparently, this whole time, I've been doin' it wrong.

https://github.com/EightBitz/RWExport

EightBitz
January 26th, 2017, 09:02 AM
New version up.

https://github.com/EightBitz/RWExport/tree/Version-0.9a

EightBitz
January 26th, 2017, 10:18 AM
OK, another quick update. I accidentally left a line commented out that I commented out for testing. I took out the comment so that line is active now.

I also changed the CSS settings so things look much nicer. I learned about gradients today. :-)

Since I updated the CSS file, I reprinted the documentation and releasenotes to PDF to reflect the new CSS formatting.

MaxSupernova
January 26th, 2017, 12:51 PM
So I asked (via bug report because I thought it was) about some of the XML that is kind of pointless/ugly/annoying, and got a nice developer response.

My issue was with a text snippet with links in it. (You might have seen my suggestion post as well).

In the following example, "AMC", "Aldolore Station" and "Rone Varan" are links within the sentence.

"The Aldolore Mining Cartel, also known as the AMC, is a corporation that controls Aldolore Station, Rone Varan and the surrounding asteroid fields."

The XML is:
<contents>
<p class=\"RWDefault\">
<span class=\"RWSnippet\">The Aldolore Mining Cartel, also known as the </span>
<span class=\"RWSnippet\">AMC</span>
<span class=\"RWSnippet\">, is a corporation that controls </span>
<span class=\"RWSnippet\">Aldolore Station</span>
<span class=\"RWSnippet\">, </span>
<span class=\"RWSnippet\">Rone Varan</span>
<span class=\"RWSnippet\">and the surrounding asteroid fields.
</span>
</p>
</contents>

That means that if I want to use CSS to pretty up my snippets, my only option is to use the larger RWDEFAULT class rather than just the RWSnippet class that's immeidately around the text. If I use the RWSnippet class and do any positioning or margins, it will mess up individual words in the line.

Depending on how RWSnippet is used in other use-cases (I just have really simple images-and-text realms) it might be worth your while to simply filter out the RWSnippet spans, because they do little but add a lot of extra characters to the text (nearly doubling the size in this example).

There doesn't seem to be a way that they can change the class of links to a different class to denote a link, according to David, the dev who replied in pretty cool detail to my question.

What you propose would be ideal, but a part of what we have is based on the control we use for showing snippets within Realm Works. This control is an RTF control that happens to support HTML import and export. What we store is pretty close to what we get out of that control and probably more closely mimics RTF as translated to HTML rather than fully hand-craft HTML.

We actually do not depend on any indication of links being stored in the HTML. It is all pulled out and stored separately within the link data itself. So if you wanted to recreate links as we have inside of Realm Works, you would need to use the information in links as well as the HTML contents to properly set it all up.

EightBitz
January 26th, 2017, 01:49 PM
So I asked (via bug report because I thought it was) about some of the XML that is kind of pointless/ugly/annoying, and got a nice developer response.

My issue was with a text snippet with links in it. (You might have seen my suggestion post as well).

In the following example, "AMC", "Aldolore Station" and "Rone Varan" are links within the sentence.

"The Aldolore Mining Cartel, also known as the AMC, is a corporation that controls Aldolore Station, Rone Varan and the surrounding asteroid fields."

The XML is:
<contents>
<p class=\"RWDefault\">
<span class=\"RWSnippet\">The Aldolore Mining Cartel, also known as the </span>
<span class=\"RWSnippet\">AMC</span>
<span class=\"RWSnippet\">, is a corporation that controls </span>
<span class=\"RWSnippet\">Aldolore Station</span>
<span class=\"RWSnippet\">, </span>
<span class=\"RWSnippet\">Rone Varan</span>
<span class=\"RWSnippet\">and the surrounding asteroid fields.
</span>
</p>
</contents>

That means that if I want to use CSS to pretty up my snippets, my only option is to use the larger RWDEFAULT class rather than just the RWSnippet class that's immeidately around the text. If I use the RWSnippet class and do any positioning or margins, it will mess up individual words in the line.

Depending on how RWSnippet is used in other use-cases (I just have really simple images-and-text realms) it might be worth your while to simply filter out the RWSnippet spans, because they do little but add a lot of extra characters to the text (nearly doubling the size in this example).

There doesn't seem to be a way that they can change the class of links to a different class to denote a link, according to David, the dev who replied in pretty cool detail to my question.

I use the P tag. I strip out some inline formatting first, though. It seems to work. Are you having issues?

MaxSupernova
January 26th, 2017, 03:15 PM
I use the P tag. I strip out some inline formatting first, though. It seems to work. Are you having issues?

Nope. I was just digging in to the html to do some custom styling and was appalled at the number of RWSnippet spans.

My first thought was that it was deliberate, and just a bug that the RWSnippet span was also applied to links (they should be RWLink or something), which is why I reported it.

If they aren't there to delineate links, there's no point except to make the HTML much less readable.

But nope, that's the way it's supposed to be.

Looking at it makes me twitch, but that's the way it is and I'll deal. :-D

tmilktoast
January 26th, 2017, 07:40 PM
Just thought I would report in. I am no longer having the problem I reported earlier. I'm not sure what changed, whether it was something on my system (perhaps likely since I'm the only one who reported it), but it is now working well.

Other good news: those funky Star Wars: Edge of the Empire dice fonts get exported correctly and show up in the HTML, but only if you check Preserve Original Text Formatting. I'm not sure what else this setting might affect.

I do have a couple minor formatting issues in HTML output. My troublesome bullet lists are about five spaces further left than the paragraphs around them. And the table formatting is off-kilter. I have added background colors to the tables, changed the fonts, and some other stuff that may have confused it.

Here's an example showing those issues: http://moon.gibbous.org/export-test.html

I did notice that the table formatting weirdness is related to the CSS code because when I first uploaded the HTML file to my site I forgot to upload the CSS file and the tables looked okay then.

If I have time, I might mess around with some CSS.

So, again, I'm just posting this because I figured you'd want to know. Your script is great and I'm happy we have it.

EightBitz
January 26th, 2017, 11:36 PM
I'm glad your original bug is gone. If I had to guess, I would attribute that to the way I was originally using github. I was copying and pasting the script into gists instead of uploading files, and I think it was changing some character encoding.

The reason I'm guessing this is what happened is that I could never reproduce your original error, even with the exact same rwoutput file that you were using.

In regards to preserving the original formatting, what script strips out is the font type, size, and colors (font color and background color). It makes complete sense to me that using this options preserves your Star Wars dice characters.

In regards to tables and lists, there could be a few different things going on here. I've noticed that between IE, Chrome and Firefox, there are notable differences between how tables are displayed. IE doesn't seem to indent tables at all (at least with my script's output) where as Firefox does. I forget what the quirks were with Chrome.

I should have mentioned this in the release notes. But again, that's just one possibility. The only formatting I strip from tables is what I've mentioned above, and if you preserve formatting, I don't even strip that.

My understanding is that inline formatting overrides external CSS files, so if you preserve formatting, the table formatting in the CSS file should have ... no ... effect? (Famous last words, right?)

I'm no expert here. I'm still learning. So don't take that as an authoritative statement (hence the question marks).

The lists are what have me most confused, at least in the aspect that lists are much simpler than tables, so their behavior should be more straightforward.

That being said, I did change the way I was managing indents, because the old way I was doing it was causing a conflict with existing inline formatting. It seemed to work OK, but I could have missed something. Or, again, it could come down to browser interpretation.

What I would suggest is that you export at least this one topic, if not two or three that are having the same issues, and I'll see what I can figure out. Also, send the me the specific command line that you're using (this can be copied and pasted from the GUI), the HTML output you're getting, which browser you're using, and screenshots of how your browser is rendering the output.

Parody
January 27th, 2017, 01:34 AM
In regards to tables and lists, there could be a few different things going on here. I've noticed that between IE, Chrome and Firefox, there are notable differences between how tables are displayed.
One thing that might help is specifying a DOCTYPE. The sample outputs I've seen don't have one, leaving the browsers to make more guesses about how to display your HTML+CSS. (It's called "rendering in Quirks Mode" if you want more info.)

The DOCTYPE needs to be the first line of your HTML file. The one for HTML 5 is pretty simple:
<!DOCTYPE html>
Adding that won't make the different browsers (and versions of browsers) create identical output, but they should end up a lot closer than before.

My understanding is that inline formatting overrides external CSS files, so if you preserve formatting, the table formatting in the CSS file should have ... no ... effect? (Famous last words, right?)
The style attribute does override earlier styling, but only for the things specified within. Anything not included in the style attribute will be determined by whatever other rules exist. The rules in your external CSS file will only have no effect if the style attribute overrides everything within those rules.

The lists are what have me most confused, at least in the aspect that lists are much simpler than tables, so their behavior should be more straightforward.
Looking at the part of tmilktoast's sample where there's a list, the surrounding <p> elements' style attributes have a margin-left but the <ul> does not. HTML lists should be treated the same as paragraphs and tables for most styling purposes.

FWIW, I think you'd be better off putting a <div> around the things you want to indent and adding padding or margin to the <div>. (I threw a quick example up at JSBin (https://jsbin.com/rujarivemo/edit?html,output).)

EightBitz
January 27th, 2017, 02:22 AM
One thing that might help is specifying a DOCTYPE. The sample outputs I've seen don't have one, leaving the browsers to make more guesses about how to display your HTML+CSS. (It's called "rendering in Quirks Mode" if you want more info.)

The DOCTYPE needs to be the first line of your HTML file. The one for HTML 5 is pretty simple:
<!DOCTYPE html>
Adding that won't make the different browsers (and versions of browsers) create identical output, but they should end up a lot closer than before.


The style attribute does override earlier styling, but only for the things specified within. Anything not included in the style attribute will be determined by whatever other rules exist. The rules in your external CSS file will only have no effect if the style attribute overrides everything within those rules.


Looking at the part of tmilktoast's sample where there's a list, the surrounding <p> elements' style attributes have a margin-left but the <ul> does not. HTML lists should be treated the same as paragraphs and tables for most styling purposes.

FWIW, I think you'd be better off putting a <div> around the things you want to indent and adding padding or margin to the <div>. (I threw a quick example up at JSBin (https://jsbin.com/rujarivemo/edit?html,output).)

The thing that confuses me is that in my own testing, there IS a margin-left in the UL tag. My lists, ordered and unordered, are properly indented along their respective topics and sections.

One thing I noticed though, is that my UL tags have two style declarations.

<ul style="margin-left:105px;" start="1" style="margin-top:0;margin-bottom:0;">

I fixed this in other parts of the code to incorporate everything into one style declaration. I missed doing that for lists.

I'm wondering if maybe in the process of uploading his html file, something in that process detected the two style statements, determined that as invalid, and deleted one of them?

Or maybe he manually edited something? I have no idea. I don't understand why I would have the margin-left statements in my output, and he wouldn't.

EightBitz
January 27th, 2017, 02:27 AM
The thing that confuses me is that in my own testing, there IS a margin-left in the UL tag. My lists, ordered and unordered, are properly indented along their respective topics and sections.

One thing I noticed though, is that my UL tags have two style declarations.

<ul style="margin-left:105px;" start="1" style="margin-top:0;margin-bottom:0;">

I fixed this in other parts of the code to incorporate everything into one style declaration. I missed doing that for lists.

I'm wondering if maybe in the process of uploading his html file, something in that process detected the two style statements, determined that as invalid, and deleted one of them?

Or maybe he manually edited something? I have no idea. I don't understand why I would have the margin-left statements in my output, and he wouldn't.

Or maybe there's something in his XML source that doesn't fit with how I'm parsing the different tags, so his lists go undetected as such. To determine that, though, I'd need his XML source.

EightBitz
January 27th, 2017, 02:54 AM
One thing that might help is specifying a DOCTYPE. The sample outputs I've seen don't have one, leaving the browsers to make more guesses about how to display your HTML+CSS. (It's called "rendering in Quirks Mode" if you want more info.)

The DOCTYPE needs to be the first line of your HTML file. The one for HTML 5 is pretty simple:
<!DOCTYPE html>
Adding that won't make the different browsers (and versions of browsers) create identical output, but they should end up a lot closer than before.


The style attribute does override earlier styling, but only for the things specified within. Anything not included in the style attribute will be determined by whatever other rules exist. The rules in your external CSS file will only have no effect if the style attribute overrides everything within those rules.


Looking at the part of tmilktoast's sample where there's a list, the surrounding <p> elements' style attributes have a margin-left but the <ul> does not. HTML lists should be treated the same as paragraphs and tables for most styling purposes.

FWIW, I think you'd be better off putting a <div> around the things you want to indent and adding padding or margin to the <div>. (I threw a quick example up at JSBin (https://jsbin.com/rujarivemo/edit?html,output).)

Also, thanks for the tips. I've added the doctype for the next release.

I'll play around with <div> and see what I can do.

EightBitz
January 27th, 2017, 03:36 AM
Definitely love the div tag. This is going to take a little bit of work, but in the end, the code will be streamlined, and this will fix a few things that have been annoying me.

tmilktoast
January 27th, 2017, 06:34 AM
Regarding those Edge of the Empire fonts, I imagine none of you are seeing them in your browser because you probably don't have them installed on your PC.

EightBitz, do you still want me to send you those things you asked for, or were you just going to work on Parody's suggestions?

EightBitz
January 27th, 2017, 06:50 AM
Regarding those Edge of the Empire fonts, I imagine none of you are seeing them in your browser because you probably don't have them installed on your PC.

EightBitz, do you still want me to send you those things you asked for, or were you just going to work on Parody's suggestions?

I'm working on Parody's suggestion, and I'm pretty far along with the div tags. Had a few hiccups along the way, but things are going well now.

EightBitz
January 27th, 2017, 07:02 AM
Regarding those Edge of the Empire fonts, I imagine none of you are seeing them in your browser because you probably don't have them installed on your PC.

EightBitz, do you still want me to send you those things you asked for, or were you just going to work on Parody's suggestions?

Hey, here's something you might find interesting. Remember how there are two types of bulleted lists? One of them isn't actually formatted as a bulleted list. It just throws in a wingdings bullet followed by text.

*Shakes finger at Rob*

tmilktoast
January 27th, 2017, 07:14 AM
I've been meaning to make a post asking about these somewhat competing formatting options under Paragraph and Styles.

tmilktoast
January 27th, 2017, 07:15 AM
I'm working on Parody's suggestion, and I'm pretty far along with the div tags. Had a few hiccups along the way, but things are going well now.

Good to hear.

EightBitz
January 27th, 2017, 07:34 AM
CSS question for Parody or anyone who's willing to answer. Regarding the following divisions, is there, generally speaking, a preferred order they should be listed in the CSS file, or does it not matter?

.snippet TABLE {}
.snippet TABLE TR {}
.snippet TABLE TR TD {}
.snippet TABLE TR TD P {}

Parody
January 27th, 2017, 09:44 AM
Practically: the order doesn't matter for what you're doing here. I generally do the same thing as your example for those sorts of selectors.

Technically: there's an order of precedence and specificity that determines what order CSS rules are applied to matching elements; rules with higher precedence and/or more specificity override earlier ones. Order of appearance in an external CSS file only matters if two selectors have identical precedence and specificity.

EightBitz
January 27th, 2017, 10:31 AM
Practically: the order doesn't matter for what you're doing here. I generally do the same thing as your example for those sorts of selectors.

Technically: there's an order of precedence and specificity that determines what order CSS rules are applied to matching elements; rules with higher precedence and/or more specificity override earlier ones. Order of appearance in an external CSS file only matters if two selectors have identical precedence and specificity.

I thought that in that order of precedence, inline formatting always took precedence. But that doesn't seem to be the case. With tmilktoast's output, it has the following line (just including the relevant portion):

<td class="RWSnippet" style="background-color:#8B0000;...

That's kind of a rusty, reddish color. In my CSS file, I have the following elements (again, just including the relevant portions):

.snippet {--main-background-color:white;}
.snippet P {background-color:var(--main-background-color);}
.snippet TABLE {background-color:var(--main-background-color);}
.snippet TABLE TR {background-color:var(--main-background-color);}
.snippet TABLE TR TD {background-color:var(--main-background-color);}
.snippet TABLE TR TD P {background-color:var(--main-background-color);}


When I opened the html file, the background for the text in the table was white. Working my way up from TABLE TR TD P, I commented out each background-color in turn, and when I commented out the one for .snippet P, I saw the proper color in the table.

In the TABLE TR TD P section, I had him change the background-color to transparent, and that worked.

So that was unexpected ... to me anyway. Like I said, I'm still learning. :-)

kbs666
January 27th, 2017, 12:59 PM
Was the it rendered white or was the code fore the element color white? If it was just rendered white that could be a browser thing. Different browsers handle CSS differently.

Parody
January 27th, 2017, 02:21 PM
There's a <p> inside of an element with "snippet" as one of its classes, which matches your ".snippet p" selector. It doesn't matter how deep the containment hierarchy goes:
<div class="snippet">
<p>This matches.</p>
<div class="whatever">
<p>As does this.</p>
<table><tr><td><p>And this too.</p></td></tr></table>
</div>
</div>
<p>But not this.</p>

That particular <p> should also match ".snippet table tr td p". ".snippet table tr td p" is more specific than ".snippet p", so ".snippet p" should be applied first, then ".snippet table tr td p". The inline style would have precedence if it was on the <p>, but it's not; it's on a <td> that happens to contain a <p>, and both of the selectors that match the <p> also set the background-color.

Let's take a step back. Your goal is to not have a background-color for the text in the cell and let the cell's background-color show through. The term for that for background-colors is "transparent". It's also the default, which is usually specified in CSS with "initial". Something like this might work for you:


.snippet {
background-color: white;
}

.snippet p { /* default formatting for regular paragraphs */ }

.snippet table { /* default table formatting */ }

.snippet table p {
/* reset the background color */
background-color: transparent;
}

This doesn't do much by itself, but if you do specify a different background-color for a <table> or <tr> or <td> or whatever and they happen to contain <p>s, then hopefully this will make it do what you actually want.

Note that this is only needed because something is overriding the default. If your ".snippet p" selector doesn't include a background-color, then you don't need to override it for tables containing <p>s. The less you specify, the better. :)

FWIW, if you want a selector that means "only <p>s directly contained inside an element with the 'snippet' class", you could try try ".snippet + p". Also you don't need to use <p>s inside of <td>s or <th>s, so if there's only one <p> in a cell or header you could strip it.

EightBitz
January 27th, 2017, 04:06 PM
There's a <p> inside of an element with "snippet" as one of its classes, which matches your ".snippet p" selector. It doesn't matter how deep the containment hierarchy goes:
<div class="snippet">
<p>This matches.</p>
<div class="whatever">
<p>As does this.</p>
<table><tr><td><p>And this too.</p></td></tr></table>
</div>
</div>
<p>But not this.</p>

That particular <p> should also match ".snippet table tr td p". ".snippet table tr td p" is more specific than ".snippet p", so ".snippet p" should be applied first, then ".snippet table tr td p". The inline style would have precedence if it was on the <p>, but it's not; it's on a <td> that happens to contain a <p>, and both of the selectors that match the <p> also set the background-color.

Let's take a step back. Your goal is to not have a background-color for the text in the cell and let the cell's background-color show through. The term for that for background-colors is "transparent". It's also the default, which is usually specified in CSS with "initial". Something like this might work for you:


.snippet {
background-color: white;
}

.snippet p { /* default formatting for regular paragraphs */ }

.snippet table { /* default table formatting */ }

.snippet table p {
/* reset the background color */
background-color: transparent;
}

This doesn't do much by itself, but if you do specify a different background-color for a <table> or <tr> or <td> or whatever and they happen to contain <p>s, then hopefully this will make it do what you actually want.

Note that this is only needed because something is overriding the default. If your ".snippet p" selector doesn't include a background-color, then you don't need to override it for tables containing <p>s. The less you specify, the better. :)

FWIW, if you want a selector that means "only <p>s directly contained inside an element with the 'snippet' class", you could try try ".snippet + p". Also you don't need to use <p>s inside of <td>s or <th>s, so if there's only one <p> in a cell or header you could strip it.

Yep, that's exactly how I fixed it for him. Then he has to go and ask if it's possible to extract the images and such instead of leaving them embedded.

So guess what I've been working on... That's the thanks I get for helping him out. Jerk. ;-p

Parody
January 27th, 2017, 06:43 PM
Yeah, that's a little bit more of a pain. I've been working on a tool to unpack MHT files (think "web site saved as an email with attachments") which has to deal with the same thing.

EightBitz
January 27th, 2017, 06:56 PM
Yeah, that's a little bit more of a pain. I've been working on a tool to unpack MHT files (think "web site saved as an email with attachments") which has to deal with the same thing.

With PowerShell, the deed itself is just two lines of script.

$bytes = [Convert]::FromBase64String($Contents)
[IO.File]::WriteAllBytes($FilePath,$bytes)


The painful part is integrating it with everything around it.

Parody
January 27th, 2017, 07:03 PM
Well, yeah. Also you have to know you don't mind spending the RAM for it. (RW's 30MB limit helps there.)

I keep wanting to make a more fully fleshed out tool instead of just a quick-and-dirty thing that does what I'm actually trying to accomplish. :)

EightBitz
January 27th, 2017, 07:46 PM
Well, yeah. Also you have to know you don't mind spending the RAM for it. (RW's 30MB limit helps there.)

I keep wanting to make a more fully fleshed out tool instead of just a quick-and-dirty thing that does what I'm actually trying to accomplish. :)

Meh, these days everyone as an extra jigawatt or two of RAM.

tmilktoast
January 28th, 2017, 04:21 AM
Yep, that's exactly how I fixed it for him. Then he has to go and ask if it's possible to extract the images and such instead of leaving them embedded.

So guess what I've been working on... That's the thanks I get for helping him out. Jerk. ;-p

You're very welcome.

I mean, thank you. :D

daplunk
January 28th, 2017, 05:55 PM
Anyone else seeing this go non-responsive when it runs the script? It works don't get me wrong. And it looks great. But the GUI freezes up and I need to close it out manually.

EightBitz
January 28th, 2017, 06:30 PM
Anyone else seeing this go non-responsive when it runs the script? It works don't get me wrong. And it looks great. But the GUI freezes up and I need to close it out manually.

The GUI disables itself while the script is running. When the script completes, the GUI reactivates itself. This happens to indicate when the script starts and when it completes, so you're not left wondering. There are probably better ways to manage this, and I can work on that later, but for now, that's how it works.

If the GUI remains greyed out and non-responsive, there's an issue with the script, or at least with that particular run of it. I'd need more details, of course, to determine exactly what's happening here.

Maybe something is getting caught in a loop, or maybe something is happening to prevent the form from reactivating itself. Maybe the script is taking longer to run than you realize. Various possibilities exist.

EightBitz
January 28th, 2017, 06:39 PM
In the next release, I'll just disable the run button instead. That will still offer an indicator that the script is active without disabling the whole form.

daplunk
January 28th, 2017, 06:40 PM
I did the same export twice and it appears to have completed but just stays disabled. Ill try it with a different file and see if the export is the cause.

EightBitz
January 29th, 2017, 11:11 AM
New version up.

https://github.com/EightBitz/RWExport/tree/Version-0.9.1b

EightBitz
January 29th, 2017, 11:00 PM
I just updated the GUI. I got the "Load" button working, and I added a "Save Defaults" button. The Load button will only work properly with scripts saved by the GUI.

I figure these two changes will make life immensely easier for anyone using the GUI.

EDIT: Click the link in the first post. I didn't change version numbers or anything. This one's just a quickie with no changes to the primary script.

EightBitz
January 31st, 2017, 10:38 AM
You can look forward to linked topics in the next version. Not in the body text, but in the topic details, where the linkage currently appears.

Putting the links in the body text invokes various issues I'm not sure how to deal with right now. It may sound simple and straightforward, but when one considers the potential for duplicate topic names and alias names, it becomes much more problematic. I don't see any clear indication of how to deal with this in the XML, so that would leave me to make my best guesses when writing the code, and that's probably not going to be good enough.

So for now, at least, it'll all be in the section with topic details.

I should have that ready by the end of the week. I want to test and tighten up some other things before I post it.

ShadowChemosh
January 31st, 2017, 01:15 PM
It may sound simple and straightforward, but when one considers the potential for duplicate topic names and alias names, it becomes much more problematic. I don't see any clear indication of how to deal with this in the XML, so that would leave me to make my best guesses when writing the code, and that's probably not going to be good enough.
Its so weird. Your almost starting to sound like Rob! :D :eek: :)

Update: Adding that the above is 100% meant as a "complement" not a insult at all. Rob is awesome and sounding like him in my world is a "GOOD" thing!

EightBitz
January 31st, 2017, 01:49 PM
Its so weird. Your almost starting to sound like Rob! :D :eek: :)

Rob is obviously much better at this than I am.

Farling
January 31st, 2017, 03:14 PM
Putting the links in the body text invokes various issues I'm not sure how to deal with right now. It may sound simple and straightforward, but when one considers the potential for duplicate topic names and alias names, it becomes much more problematic. I don't see any clear indication of how to deal with this in the XML, so that would leave me to make my best guesses when writing the code, and that's probably not going to be good enough.

Links seem to be stored in the XML export as <link target_id="Topic_24"...

where "Topic_24" is the name given to a <topic topic_Id="Topic_24"...

so with enough mapping information in your script, you might be able to map back from the link to the originating topic. (Another issue would be mapping the "span_info/span_List/span" information to the correct position within the contents element.)

EightBitz
January 31st, 2017, 03:55 PM
Links seem to be stored in the XML export as <link target_id="Topic_24"...

where "Topic_24" is the name given to a <topic topic_Id="Topic_24"...

so with enough mapping information in your script, you might be able to map back from the link to the originating topic. (Another issue would be mapping the "span_info/span_List/span" information to the correct position within the contents element.)

Right. I figured out the link targets and topic IDs, as well as the direction, which is how I got the links working in the topic details section of my output.

I haven't figured out how to apply that information to the content. For instance, I have one topic that has three links to two other topics. The third link is to an alias of one of the other two topics. There are only two "linkage" properties. The both reference the topic's public_name (neither of them reference the alias name).

The alias is the third link the content, and it refers to the first topic. So when I look at the content, there's a link for topic 1, then a link for topic 2, then a link to the alias of topic 1.

When I look at the XML, there's one linkage entry for topic 1 and one linkage entry for topic 2. There is nothing obvious in the content section of the XML (at least, not obvious to me) that indicates which text refers to which linkage entry.

This leads me to believe (I'm not stating a fact here, just a summary conclusion based on what I've been able to reverse engineer so far) that the extra linkage information is stored in the full export, but not the compact one.

Or, there's always the very real possibility that I'm missing something.

EightBitz
January 31st, 2017, 04:38 PM
The linkage info in the full export is indeed more detailed. There are "start" and "length" attributes that direct them the proper points in the content.

Farling
January 31st, 2017, 11:56 PM
The linkage info in the full export is indeed more detailed. There are "start" and "length" attributes that direct them the proper points in the content.

Ah, sorry about that. I've always been looking at the full export XML data format. I'd forgotten that you were working with the simpler export format.

EightBitz
February 1st, 2017, 01:40 AM
I was trying to add in some input validation, but what I had in mind just doesn't want to work. :-(

You guys seem OK so far. I just wanted to add it for some polish. But I'm very frustrated, and I'm giving up on it ... at least for now. I swear, input validation has vexed me more than everything else I've done with the script, and it's time to just let it go, I think.

So I'll make sure everything else still works and post the update.

Bidmaron
February 1st, 2017, 03:21 AM
What do you mean input validation?

EightBitz
February 1st, 2017, 03:31 AM
What do you mean input validation?

Making sure the folders and filenames provided are good, asking for overwrite confirmation, making sure the sort and image scale values are in range ... things like that.

Also, new version is up.

https://github.com/EightBitz/RWExport/tree/Version-0.95b

Bidmaron
February 1st, 2017, 04:47 AM
Great work again, EightBitz!

EightBitz
February 1st, 2017, 06:19 AM
Great work again, EightBitz!

Thanks!

Shortly after I posted, I figured out why my input validation script wasn't working. So there will be a version 1.0. :-)

Have to tidy some things up before I post it. And I got some errands to run. So, not right now.

EightBitz
February 1st, 2017, 11:09 AM
Version 1.0 is up. It's like Chief O'Brien having his own asteroid. It's a Mile's stone!

https://github.com/EightBitz/RWExport/tree/Version-1.0

EightBitz
February 1st, 2017, 11:17 AM
Also, please don't examine the validation script. I'm a little embarrassed about it. :-o

I might clean it up later, but right now, I just wanted the darn thing to work. :-)

EightBitz
February 6th, 2017, 03:02 AM
Didn't want to say anything earlier, but I'm close enough to done now where I think it's safe to say this ...

I've been working on an option to export to a word file i stead of HTML. Complete with collapsible headings and an automatically generated table of contents.

It's not retaining any formatting right now. That's going to be a task I'm not up to right now. Maybe later.

Topics, unfortunately, will not be nested, but sections will be.

Should be ready in a few days, unless I just jinxed myself by posting this prematurely.

Bidmaron
February 6th, 2017, 05:51 AM
Yo are a treasure to the community, Eight.

Zaphod Beebledoc
February 6th, 2017, 10:59 AM
Yo are a treasure to the community, Eight.

Hear, hear!

AEIOU
February 6th, 2017, 12:57 PM
@ Bidmaron, motion made.

@Zaphod Beebledoc, motion carried.

@EightBitz, by the power granted to this forum by the internet, you may officially add "Treasure to the Community" to your signature line. You are entitled to all the praise and encouragement it may bring. We appreciate the huge amount of work you have undertaken on our behalf. Thank you!

Acenoid
February 6th, 2017, 01:20 PM
Have not used the script yet, but surely will do so soon!
Thank you for the work and thanks again for sharing it with us.

EightBitz
February 8th, 2017, 08:12 AM
New version up! Please read the release notes, and please read the "Exporting to Word" section in the main doc.

https://github.com/EightBitz/RWExport/tree/Version-1.5

Bidmaron
February 8th, 2017, 08:19 AM
Dang, eight. Great work

EightBitz
February 8th, 2017, 08:32 AM
Dang, eight. Great work

Aww, shucks. Thanks, man. :-)

AEIOU
February 8th, 2017, 12:10 PM
Love the sig. :)

Love the work. :)

EightBitz
February 8th, 2017, 01:00 PM
I don't know if anyone here remembers, but a while back, I wrote a redaction script for people who wanted to author data sets for Hero Lab. The script would redact descriptions so you could have full descriptions in your own copy but remove them from the shared copy, so as to avoid illegal distribution of copyrighted content.

I figured since I now have a GitHub account and an official signature here, I may as well post the redaction script. I was revisiting that code, and I realized that with what I learned in writing the export script, I can rewrite the redaction script properly.

The way I wrote it originally, it read in the .user files as text files, searched (via plain text) for the Description tag, parsed for the substring of the actual description, and replaced it either with other text, or replaced it with a null value.

Now I can properly read it and handle it as an XML file. :-)

ArgoForg
February 12th, 2017, 01:11 PM
Have not, as of yet, had any luck with this, although my Powershell (and coding on the whole) experience is pretty limited... so there's probably a reasonable explanation for it.

On the occasions I've tried it (using the GUI script), the script tends to balk early on (Line 207, right after Mandatory), where I assume that my source file might be incorrect. I've been trying to put everything in the same folder (script, export (compact export) file, css and use the same folder for export of the HTML or DOC) for ease of making sure I've got everything... in my case, C:\Users\Mark\Desktop\Folder. I basically copy and paste direct from Explorer. Should I be trying it as a relative folder instead?

The GUI script locks if I try to click on the buttons to locate, like I would most Windows GUIs, so I've made do by copying and pasting into the entry forms, instead. Attached is a screenshot of my GUI and the powershell reply. First time is running the script standard, second is bypassing entry validation.

Hate to ask, because I'm obviously no coding whiz, but any ideas what I might be doing wrong, just at a look?

EightBitz
February 12th, 2017, 01:46 PM
Have not, as of yet, had any luck with this, although my Powershell (and coding on the whole) experience is pretty limited... so there's probably a reasonable explanation for it.

On the occasions I've tried it (using the GUI script), the script tends to balk early on (Line 207, right after Mandatory), where I assume that my source file might be incorrect. I've been trying to put everything in the same folder (script, export (compact export) file, css and use the same folder for export of the HTML or DOC) for ease of making sure I've got everything... in my case, C:\Users\Mark\Desktop\Folder. I basically copy and paste direct from Explorer. Should I be trying it as a relative folder instead?

The GUI script locks if I try to click on the buttons to locate, like I would most Windows GUIs, so I've made do by copying and pasting into the entry forms, instead. Attached is a screenshot of my GUI and the powershell reply. First time is running the script standard, second is bypassing entry validation.

Hate to ask, because I'm obviously no coding whiz, but any ideas what I might be doing wrong, just at a look?

First, make sure you have the current version, which is 1.5.

Second, if you're selecting Word as the output format, change your destination file to have a .doc or .docx extension.

Other than that, I'm not sure. Is anyone else besides ArgoForg having these issues?

EightBitz
February 12th, 2017, 02:50 PM
Have not, as of yet, had any luck with this, although my Powershell (and coding on the whole) experience is pretty limited... so there's probably a reasonable explanation for it.

On the occasions I've tried it (using the GUI script), the script tends to balk early on (Line 207, right after Mandatory), where I assume that my source file might be incorrect. I've been trying to put everything in the same folder (script, export (compact export) file, css and use the same folder for export of the HTML or DOC) for ease of making sure I've got everything... in my case, C:\Users\Mark\Desktop\Folder. I basically copy and paste direct from Explorer. Should I be trying it as a relative folder instead?

The GUI script locks if I try to click on the buttons to locate, like I would most Windows GUIs, so I've made do by copying and pasting into the entry forms, instead. Attached is a screenshot of my GUI and the powershell reply. First time is running the script standard, second is bypassing entry validation.

Hate to ask, because I'm obviously no coding whiz, but any ideas what I might be doing wrong, just at a look?

I just downloaded the GitHub version to make sure that I didn't upload bad code, and it's working fine for me. I would be happy to join you on a Skype call or a Google Hangouts call and see what we can figure out together.

Happydevil43
February 12th, 2017, 08:22 PM
I just downloaded the GitHub version to make sure that I didn't upload bad code, and it's working fine for me. I would be happy to join you on a Skype call or a Google Hangouts call and see what we can figure out together.

Hi guys,
I just updated my version of the code, and now it doesn't seem to work for me any more, it just hangs and sits there (I left it for about and hour to see if it was something and my realm isn't that big), but after cancelling I could see that it only had about 4 lines in it...

I did the compact export but only selected player content, as this is the information I put into a HTML file for my players.

I have no idea what's different, and to be sure I found one of the older codes that exported to a text file and that seems to work...

Am I missing a step ? I even tried the GUI version with the same result. Any suggestions ?

I'll try and find an older html one to see which version it stopped for me on.

Happydevil43
February 12th, 2017, 08:30 PM
I'll try and find an older html one to see which version it stopped for me on.

Unfortunately I tried all the ones on GitHub with the same result.
the only one that works is:
RWExport-To-Text.ps1
# by EightBitz
# Version 0.5a
# 1/17/2017, 3:40 PM CST

I'll try doing a compact export (without turning on the player only flag and see what happens)

EightBitz
February 12th, 2017, 09:10 PM
Unfortunately I tried all the ones on GitHub with the same result.
the only one that works is:
RWExport-To-Text.ps1
# by EightBitz
# Version 0.5a
# 1/17/2017, 3:40 PM CST

I'll try doing a compact export (without turning on the player only flag and see what happens)

Was your previous export a compact export with the player flag turned on, or was it a full export?

Edit: Nevermind, you answered my question already. I'm reading on a tablet in the middle of a frustrating issue with one of my laptops, so my reading comprehension is a bit off right now.

I'll ask you the same question. Can you join me in Google Hangouts or Skype? Not right now, but can we coordinate a time?

Happydevil43
February 12th, 2017, 09:23 PM
I'll ask you the same question. Can you join me in Google Hangouts or Skype? Not right now, but can we coordinate a time?

Should be able to, I'll PM you.

daplunk
February 13th, 2017, 04:39 AM
I had another chance to use this tonight and was blown away by the improvements! Really like the export to Word since now I can spell check my work!

I put a video up covering it's use:

Realm Works - EightBitz's XML Transformation Script (now with GUI and Word support) - Print or Spell Check your realm! (https://youtu.be/PsJjkFnrNEw)

EightBitz
February 14th, 2017, 04:32 PM
There's an issue that Happydevil43 helped me discover. This issue happens if:

You reveal a smart image snippet.
Despite revealing the snippet, you reveal no part of the image.
You export only revealed content.


Given this combination of actions, the .rwoutput file will contain no image data for the smart image, and no filename for the smart image.

My script expects both, so the lack of either will cause my script to choke. I will address this issue in the next update, but for now, I just wanted to announce this as a known issue.

EightBitz
March 23rd, 2017, 03:53 AM
I'd like to take a poll, just for my own curiosity. This isn't going to affect any functional changes.

For those who use this script, which output method, if either, do you prefer?
a) I prefer HTML.
b) I prefer a Word document.
c) I'll use either or both, depending on circumstances.

daplunk
March 23rd, 2017, 04:08 AM
I used Word more. Spell checking. I have zero interest in printing though.

Merion
March 23rd, 2017, 04:52 AM
I must confess that I haven't used it yet, but prefered output would be html.

kbs666
March 23rd, 2017, 05:00 AM
HTML. I can convert HTML to pretty much anything. HTML also has the advantage, like XML, that the file is human readable. I like that if there is an issue in the output I can at least look at the file and try and figure out what happened.

DMjoe87
March 23rd, 2017, 08:44 AM
this may be a dumb question but i am not super tech savy so i was wondering if you could give a brief overview of what this program does? i know the orriginal was to convert obsidian portal stuff to realmworks but it seems you have done a lot more work to the program.

DMjoe87
March 23rd, 2017, 08:56 AM
hay. i am a little lost as to the full capabilities of this script. i know the original was to translate obsidian portal material to realmworks but i know you added a fair few things. would you be willing to post a brief overview of the capabilities

Mystic Lemur
March 23rd, 2017, 09:20 AM
I prefer HTML, although Word is a nice option to have.

ErinRigh
March 23rd, 2017, 09:51 AM
i, on the other hand, prefer Word, but html is a nice option

manchuwook
March 23rd, 2017, 10:20 AM
Word

Word would probably allow for smoother integration into PowerPoint presentations, Excel spreadsheets, and other office apps - I'd think. At the point, you can use the base functionality for dropbox/google drive/box.com/owncloud/etc.

Also, for the folks that want to use spell check and all of that - you can get Grammarly for free and it comes with its own standalone editor. I usually type my stuff into that before pasting it into RW.

Grey Mage
March 23rd, 2017, 10:21 AM
I can see situations where both would be of value, so put me down for option C.

Parody
March 23rd, 2017, 10:25 AM
I'd use both at times, though I'd be more likely to convert to text tagged properly for further processing and/or import into my desktop publishing system.

Farling
March 24th, 2017, 12:44 AM
i know the orriginal was to convert obsidian portal stuff to realmworks but it seems you have done a lot more work to the program.

Actually that was a different program, EightBitz was primarily dealing with export not import.

The OB import was my work, see http://forums.wolflair.com/showthread.php?t=57474

Acenoid
March 24th, 2017, 05:40 PM
Hello EightBlitz!

I have tried out finally the HTML export. Though the help commands did not work for some reason, the GUI was quite easy to use. Thanks for the great work.

I tried to export my realm for testing purposes. I was interested in the mechanics section and did a full "export" (Compact output) and chose a mechanics source file. Changed the policy settings correctly.

I encountered some issues:
1. Script did not finish the convension, due to an unexpected NULL value with a smart image:

Checked the topic in question. It has a smart image tag added which is unedfined, but has a Annotation text. This seems to be the issue. Removing the smart image snippet fixed it.


Command Line: &(".\RWExport-To-HTML.ps1") -Source 'H:\RWExport\Shadowrun 1.rwoutput' -Destination '.\MyRealm.html' -Sort 2 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.5.css' -Format 'HTML' -Prefix -Suffix -Details -Indent -SeparateSnippets -Force
Reason: InvalidOperation - Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.

Location: Line 1215, Character 17
Script Line: $SplitFileName = $FileName.split(".")

Topic: Bruderschafts Sektion
Section: Description
Snippet Type: Smart_Image


The same issue appeared in a second attempt with a picture snippet. No picture but annotation text. Removed the snippet to fix the issue.

2. The resulting HTML could be reviewed anyways: German umlaute and special characters don't appear correctly in the browser (äöüß), maybe there should be an option to choose a codepage (or use utf-8) also just a guess atm?

3. I also make extensive use of tables in my realm. The text from tables seems often to be garbled (overwrites itself, however the documentation states that tables are untested / not supported) Example image: http://i.imgur.com/mr4qIlD.png

I suppose that here the line breaks need to be triggered somehow, when an end of a cell has been reached.

4. Exporting to word did not work. Following error message was reported:

H:\RWExport\RWExport-To-HTML.ps1 : Das angeforderte Element ist nicht in der Sammlung vorhanden.
In Zeile:1 Zeichen:1
+ &(".\RWExport-To-HTML.ps1") -Source 'H:\RWExport\Shadowrun1.rwoutput' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [RWExport-To-HTML.ps1], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,RWExpo rt-To-HTML.ps1

It seems to claim that the input file is not present? However it starts when going for a html file:

----

That was all for the first export attempt. Thanks again for the effort and great documentation.

EightBitz
March 24th, 2017, 10:24 PM
Hello EightBlitz!

I have tried out finally the HTML export. Though the help commands did not work for some reason, the GUI was quite easy to use. Thanks for the great work.

I tried to export my realm for testing purposes. I was interested in the mechanics section and did a full "export" (Compact output) and chose a mechanics source file. Changed the policy settings correctly.

I encountered some issues:
1. Script did not finish the convension, due to an unexpected NULL value with a smart image:

Checked the topic in question. It has a smart image tag added which is unedfined, but has a Annotation text. This seems to be the issue. Removing the smart image snippet fixed it.


Command Line: &(".\RWExport-To-HTML.ps1") -Source 'H:\RWExport\Shadowrun 1.rwoutput' -Destination '.\MyRealm.html' -Sort 2 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.5.css' -Format 'HTML' -Prefix -Suffix -Details -Indent -SeparateSnippets -Force
Reason: InvalidOperation - Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.

Location: Line 1215, Character 17
Script Line: $SplitFileName = $FileName.split(".")

Topic: Bruderschafts Sektion
Section: Description
Snippet Type: Smart_Image


The same issue appeared in a second attempt with a picture snippet. No picture but annotation text. Removed the snippet to fix the issue.

2. The resulting HTML could be reviewed anyways: German umlaute and special characters don't appear correctly in the browser (äöüß), maybe there should be an option to choose a codepage (or use utf-8) also just a guess atm?

3. I also make extensive use of tables in my realm. The text from tables seems often to be garbled (overwrites itself, however the documentation states that tables are untested / not supported) Example image: http://i.imgur.com/mr4qIlD.png

I suppose that here the line breaks need to be triggered somehow, when an end of a cell has been reached.

4. Exporting to word did not work. Following error message was reported:

H:\RWExport\RWExport-To-HTML.ps1 : Das angeforderte Element ist nicht in der Sammlung vorhanden.
In Zeile:1 Zeichen:1
+ &(".\RWExport-To-HTML.ps1") -Source 'H:\RWExport\Shadowrun1.rwoutput' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [RWExport-To-HTML.ps1], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,RWExpo rt-To-HTML.ps1

It seems to claim that the input file is not present? However it starts when going for a html file:

----

That was all for the first export attempt. Thanks again for the effort and great documentation.

Oof. That's, ummm ... a lot to take in.

1. The issue with the smart images and pictures is a known issue, and thank you for reminding me. That should be easy to fix.

2. I must admit, I wasn't considering other languages when I wrote this script, nor am I well versed in them. This is something I will have to look into.

3. I have not seen that kind of output with tables, so I'm at a loss. In a simple sense, I have tested tables rather extensively. What I have not tested is all the different types of formatting people can and do apply to tables. Font colors, background colors, italics, things like that.

4. Whuh? I don't even ... I mean, I know what you're saying about not being able to find the input file, but as you say, if it can find it for html, it should be able to find it for Word.

At the very minimum here, I have to ask if you would be willing to share your export via dropbox, GoogleDrive, OneDrive, or some other similar service.

In a situation like this, I would also normally ask if you would be willing to share a remote session via skype or join.me or something, but you obviously have your language settings set for German, and I'm not sure how well I would be able to follow along or even navigate myself (under your watchful eye, of course).

But if we could at least start with you sharing your export, I'll see what I can do with that.

Just to tell you the same thing I'm telling others, my free time isn't what it used to be. I'm having to be more aggressive on job hunting, and I do actually have a phone interview on Monday (wish me luck), which if that goes well, they'll invite me for an on-site interview, and if that goes well, I will again be gainfully employed. (Here's hoping).

If that falls through, I have a couple of other possibilities in play. But nothing is guaranteed with any of these, so I have to keep hunting.

EDIT: I'm searching for systems admin role in the Chicago/NWI area. If anyone is willing to help me network, please send me a private message.

Acenoid
March 28th, 2017, 11:13 AM
Oh didn't know that you are seeking a position :) Don't forget to check with LWD maybe they need some dedicated persons :) Nowadays many of us need always to be watchful regarding jobs... things are certainly not getting better. Anyways all the best with your interview.

If you have time, we can share a remote session or I can upload an export, no problem. I can also check if I can make a recording of how to reproduce the error. I will set something up and write you a PM.

Tables:
I did not really make anything special with it. At first I used the LWD tables, later on I copied tables from word. Most of them are "simple" no shared cells ecetera. My wild guess is some kind of formatting option that (should) trigger "line breaks" :)

Word Export:
Well, maybe its not the input file missing no idea honestly. It says that that the requested element is not existing in the the collection. Maybe also an issue just with a "german" office? Does the version matter?

EightBitz
April 15th, 2017, 12:10 AM
Hey, guys. I haven't dropped off the face of the earth. I've just been busy. I know I promised some updates for some reported bugs. I haven't forgotten. I started getting an unusually (but very welcomed) high number of phone calls from recruiters and potential employers, and even had a face to face interview. (yay!)

The interview was mixed. They liked the experience I had, but had concerns about certain gaps that were very relevant to their business.

I was supposed to have heard back by now, one way or the other, but I haven't, which means I have to follow up with them on Monday. They stated very firmly that they always follow up, whatever the decision, so maybe it's a good thing I haven't heard back yet. That might mean I'm still in the running. Right? Right?!?!? (Just nod your heads and agree with me.)

I've had a couple of other people who have taken a more-than-trivial interest in my resume. So here's hoping.

In addition to all of that, it's tax season, and my taxes were ... complicated, and I had to go through several thousand emails for some missing documents. (Yeesh!) The good news is that I'm getting a nice refund.

I've also been taking care of my dear, old, elderly mum, and that's kept me busy, too.

So, anyway, yeah. Those updates are still coming.

Bidmaron
April 15th, 2017, 04:53 AM
Good luck on job search, Eight!

Acenoid
April 15th, 2017, 03:11 PM
All the best, trust me I can imagine in what situation youre in.
I'll send you a pm anyway,once you have time again just let me know :)

KaribouOfDoom
July 22nd, 2017, 11:16 PM
First, make sure you have the current version, which is 1.5.

Second, if you're selecting Word as the output format, change your destination file to have a .doc or .docx extension.

Other than that, I'm not sure. Is anyone else besides ArgoForg having these issues?

Hi. First post here, so please excuse any general lack of understanding that I might have. I've read this thread and documentation thoroughly and I'm having the same issue as ArgoForg. Did you decide that this issue is the known bug of having a blacked-out-but-revealed smart snippet? My world is still very small, so I went in and "un-revealed" any snippet that might have qualified as a trigger for the bug, and I'm getting the same error. I'd really love for this to work.

Help?

KaribouOfDoom
July 23rd, 2017, 08:16 PM
Found the problem. For anyone getting this issue with the "= operator missing" (as reported in ArgoForg's post (http://forums.wolflair.com/showpost.php?p=244050&postcount=125), the solution is to make sure you're running version 4.5 of the .Net framework and then download and install version 5.0 of Windows Management Framework. This will update PowerShell and the error will go away.

EightBitz
August 14th, 2017, 07:49 PM
Finally updated, folks. I know a couple of you have been waiting patiently for these fixes. I apologize for the long delay, and I appreciate your patience.

See the top post or read the release notes.

EightBitz
August 14th, 2017, 07:58 PM
Found the problem. For anyone getting this issue with the "= operator missing" (as reported in ArgoForg's post (http://forums.wolflair.com/showpost.php?p=244050&postcount=125), the solution is to make sure you're running version 4.5 of the .Net framework and then download and install version 5.0 of Windows Management Framework. This will update PowerShell and the error will go away.

Thank you for finding this solution.

tmilktoast
August 16th, 2017, 07:58 AM
Eightbitz,

There is a minor(ish) issue you may want to know about. The script errors out when confronted by an empty Labeled Text snippet. I have quite a few of those which I intend to fill in, of course, but right now they are sort of empty placeholders.

Ultimately, all that data will be filled in when I export this for real and the script will work properly, so it's not a big deal. I just thought you might want to know.

Here is the error code:


Command Line: &(".\RWExport-To-HTML.ps1") -Source 'D:\Owncloud\RPG\Utilities\RWExport\SWSkills 0.2.rwoutput' -Destination 'D:\Owncloud\RPG\Utilities\RWExport\skill02.html' -Sort 4 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.6.css' -Format 'HTML' -Prefix -Suffix -Details -Indent -KeepStyles -Force
Reason: InvalidOperation - You cannot call a method on a null-valued expression.

Location: Line 741, Character 17
Script Line: $InsertPoint = $Text.IndexOf($TagPreface) + $TagPreface.Length

Topic: Brawl
Section: Overview
Snippet Type: Labeled_Text

Rabit
September 12th, 2017, 04:49 PM
First, EightBitz, thank you SO much for creating this! :D

Question: Has anyone been able to get the ExtractFiles function to work? Is there a trick to it that I'm missing? I've tried everything I can think of, but it doesn't work. It just fails (no error or anything), and subsequent attempts (until I reboot) give me an error (see attached). :confused:

Any assistance is greatly appreciated!

If it helps/matters, here's what I'm using (and yes, that folder is empty except for the CSS and the "realm_files" subfolder):
-Source 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw.rwoutput' -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw' -Sort 4 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.6.css' -Format 'HTML' -Prefix -Suffix -Indent -KeepStyles -ExtractFiles -Force

I've also tried "... -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw\'..." but that hasn't worked, either.

EightBitz
September 13th, 2017, 12:50 AM
First, EightBitz, thank you SO much for creating this! :D

Question: Has anyone been able to get the ExtractFiles function to work? Is there a trick to it that I'm missing? I've tried everything I can think of, but it doesn't work. It just fails (no error or anything), and subsequent attempts (until I reboot) give me an error (see attached). :confused:

Any assistance is greatly appreciated!

If it helps/matters, here's what I'm using (and yes, that folder is empty except for the CSS and the "realm_files" subfolder):
-Source 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw.rwoutput' -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw' -Sort 4 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.6.css' -Format 'HTML' -Prefix -Suffix -Indent -KeepStyles -ExtractFiles -Force

I've also tried "... -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw\'..." but that hasn't worked, either.

Take off the -Force option, and add a -Log option. So, something like this:

-Source 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw.rwoutput' -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw' -Sort 4 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.6.css' -Format 'HTML' -Prefix -Suffix -Indent -KeepStyles -ExtractFiles -Log 'c:\users\russ\saltmarsh_export.log'

EightBitz
September 18th, 2017, 01:50 AM
First, EightBitz, thank you SO much for creating this! :D

Question: Has anyone been able to get the ExtractFiles function to work? Is there a trick to it that I'm missing? I've tried everything I can think of, but it doesn't work. It just fails (no error or anything), and subsequent attempts (until I reboot) give me an error (see attached). :confused:

Any assistance is greatly appreciated!

If it helps/matters, here's what I'm using (and yes, that folder is empty except for the CSS and the "realm_files" subfolder):
-Source 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw.rwoutput' -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw' -Sort 4 -SimpleImageScale 0 -SmartImageScale 0 -CSSFileName 'RWExport_091b_1.6.css' -Format 'HTML' -Prefix -Suffix -Indent -KeepStyles -ExtractFiles -Force

I've also tried "... -Destination 'C:\Users\russ\Documents\GAMING\Saltmarsh Campaign\_RW Info\saltmarsh_rw\'..." but that hasn't worked, either.

OK, no word back from Rabit. Is anyone else having this issue?

Acenoid
September 18th, 2017, 02:18 PM
The other issues prevent me from proceeding a bit. Still not certain were the problem lies :) Any news rgd. job?

Rabit
September 19th, 2017, 03:27 AM
Sorry for the slow response time -- sudden work... stuff. :rolleyes:

Greatly appreciate it! I'll try it ASAP. :D

Rabit
September 19th, 2017, 01:24 PM
Well that's disappointing. :(

Now it crashes without even an error message or a log file. I've tried everything I can think of, including using exactly what you shared in your response. They all have the same result: PowerShell crashes with nothing to show for it.

I'll try to mess with it some more and see what might be going on...

EightBitz
September 21st, 2017, 12:28 AM
Well that's disappointing. :(

Now it crashes without even an error message or a log file. I've tried everything I can think of, including using exactly what you shared in your response. They all have the same result: PowerShell crashes with nothing to show for it.

I'll try to mess with it some more and see what might be going on...

If it's crashing when you use exactly what I typed, then don't use exactly what I typed. :-p

Use the GUI, but make sure you have a the log option checked, make sure it's a valid file name pointing to a valid folder path, and make sure the force option is unchecked ... or at least unleashed.

https://www.youtube.com/watch?v=nj23dwWHukY

Rabit
September 30th, 2017, 05:38 AM
You are awesome, EightBitz -- greatly appreciate it! :) (And that video is impressive! :D )

Even thought I'd tried the GUI before, I was finally able to get it to work. I have no idea what I did differently. (I really should have kept better notes on the early attempts, and naturally I was being meticulous this time, so of course it worked. :rolleyes: )

The first time, one map with areas revealed with the reveal pen (instead of the reveal area) showed in the HTML as a message that the image wasn't available (not as a broken link), and there was no thumb or full image of that map included. I re-exported and re-ran, and it worked fine. (Probably an error in the export, in that situation.)

Thanks for the help (and patience :o)!

LadyDeimos
November 7th, 2017, 09:06 PM
First of all, thank you very much for making this tool!

I do have a slight issue that I didn't see in my skimming of the thread. When I run the script the output doesn't have the labels for labelled text.

skroo
December 15th, 2017, 06:28 AM
The git repository is gone and EightBitz has no public repositories.

Anyone got a copy of this stashed somewhere?

daplunk
December 15th, 2017, 12:14 PM
I've got v1.5.

https://drive.google.com/file/d/1w08XiMEctIAF7HJTaeZEdFI0fuiqT0Fp/view?usp=sharing

Bidmaron
December 15th, 2017, 05:36 PM
How can we get it now?

daplunk
December 15th, 2017, 09:57 PM
Using the link i provided above?

EightBitz
December 20th, 2017, 11:35 PM
When I originally wrote this script, I wrote it for my own purposes. One of the things I learned in releasing it to the wild is that people use Realm Works in ways that I did not foresee and did not account for.

I'm at a point where I can't keep up and have some issues I can't resolve. I also have a growing number of real-life issues I have to deal with.

If someone else wants to pick up where I left off, you can follow daplunk's link above to ver. 1.5, and roll with it. I also know that other people forked it on Github, so one of them can provide access as well.

For my part, I'd still like to see LWD provide a proper print function. They did it for Hero Lab. They even just did it for HLO. Why they still explicitly refuse to do it for RW is beyond me.

Bidmaron
December 21st, 2017, 12:24 AM
Hey, Eight, nice to see you around, buddy! Merry Christmas, and I pray your issues go as smoothly as possible. I have missed seeing you on the boards.