Search This Blog

Wednesday, February 22, 2017

Drowning

There was a post in the RoboHelp forums about an ExtendScript that will remove inline formatting. I asked the author, Marino Den Baes, if he could share the script and he did.

Let me just say that if I become an "ExtendScript Guru" in the future, it was today, 2/22/2017, when I began that journey.
Object.prototype.isTag = function(Tag) {
//This function check if the token (object) is the specified XML/HTML tag. (Or is one of the specified tags in an array.)
//Attributes are stripped from both the token as the tag to check.
//Works only on tokens from the RoboHelp TokenManager.
var Token = this;

//Check for RoboHelp and check that the object is a token from the RH tokenmanager
if(typeof(RoboHelp) == "undefined")
{
alert("Please start RoboHelp to use the isTag function.");
return false;
}
else if(Token.parent != "[object TokenManager]")
{
alert("You can only use the isTag functions on tokens from the TokenManager.");
return false;
}

if(Token.tokenType != RoboHelp.TokenType.TOKENTAG)//It's not a tag at all
return false;

if(!Tag)//No tag specified and this is a tag so return true
return true;

var isTagCleanTag = function(tag) {
if(tag.match(" "))
tag = tag.split(" ")[0];//Remove attributes the lazy way

return tag.replace(/[<>]/g, "").toLowerCase();
}

var isTag = false;
var fullTag = Token.name;
var TagName = isTagCleanTag(fullTag);//Get the tag name without brackets

if(Tag.constructor.toString().indexOf("Array") == -1)
{
var TagArray = new Array;
TagArray[0] = Tag;
} else {
var TagArray = Tag;
}

for(var i =0; i.)
//Requires isTag function

var Token = this;

if(typeof(isTag) == "undefined")
{
alert("The function balancedDelete requires the function isTag().");
return false;
}
else if(typeof(RoboHelp) == "undefined")
{
alert("Please start RoboHelp to use the balancedDelete function.");
return false;
}
else if(Token.parent != "[object TokenManager]")
{
alert("You can only use the balancedDelete function on tokens from the TokenManager.");
return false;
}

var SingleDelete = function(token) {
var Single = false;

if(token.tokenType == RoboHelp.TokenType.TOKENTEXT)
{
Single = true;
}
else if(token.tokenType == RoboHelp.TokenType.TOKENTAG)
{
if(token.name.match(/(<\/)/g) || token.name.match(/(\/>)/g))//End tags or shorthand tags
Single = true;
else
{
//If no match of yet, make sure that the tag is not a known html shorthand tag. HTML 4.01 allows shorthand tags like

var ShortTags = new Array("area","base","basefont","br","col","frame","img","input","link","meta","param");
for(var i = 0; i
]/g, "").toLowerCase();
}

if(SingleDelete(Token))
Token.delete();
else
{
var TokenDelete = new Array(Token);
var tag = balancedDeleteCleanTag(Token.name);
var endTag = "/"+tag;
var i = 0;
var RetreivedAll = false;
var sToken = Token.next;
while(RetreivedAll == false)
{
if(sToken.isTag(tag))
{
i++;
if(contentdelete)
TokenDelete.push(sToken);
}
else if(sToken.isTag(endTag) && i != 0)
{
i--;
if(contentdelete)
TokenDelete.push(sToken);
}
else if(sToken.isTag(endTag) && i == 0)
{
TokenDelete.push(sToken);
RetreivedAll = true;
}
else if(contentdelete)
TokenDelete.push(sToken);

sToken = sToken.next;
}

for(var j = 0;j
0)
{
var Save = false;
var token = tknmngr.item(1);
while(typeof(token)!='undefined') {

//Style head
if(token.isTag("style"))
{
token.balancedDelete(true);
Save = true;
}

//Inline js
//if(token.isTag("script") && !token.hasAttribute("src"))
//{
//token.balancedDelete(true);
//Save = true
//}

//External js
//if(token.isTag("script") && token.hasAttribute("src"))
//{
//token.balancedDelete(true);
//Save = true;
//}

//Image dimensions
if(token.isTag("img"))
{
token.removeAttribute('width');
token.removeAttribute('height');
Save = true;
}

//Correct URL
var hrefelems = new Array("link", "a");
var srcelems = new Array("script", "img");
if(token.isTag(hrefelems))
{
var url = FixURL(token.getAttribute("href"));
if(url != token.getAttribute("href"))
{
token.setAttribute("href", url);
Save = true;
}
}
else if (token.isTag(srcelems))
{
var url = FixURL(token.getAttribute("src"));
if(url != token.getAttribute("src"))
{
token.setAttribute("src", url);
Save = true;
}
}

//Inline styling tags
var tags = new Array("b","big","center","i","s","small","strike","strong","tt","u");
if(token.isTag(tags))
{
token.balancedDelete(false);
}

//Overrides
if(token.getAttribute("style") != "")
{
if(DHTML(token))
{
var style = "display: none;";
if(token.getAttribute("style") != style)
{
token.setAttribute("style", style);
Save = true;
}
}
else
{
token.removeAttribute("style");
Save = true;
}
}

//Remove empty span -> Housekeeping
if(token.name == "
")
{
token.balancedDelete(false);
Save = true;
}

//Next token
token = token.next;
}
if(Save)//Save file
{
tknmngr.save();
}
//else if(backup)//No save and backup present. Remove backup
//{
//RemoveBackup();
//}

tknmngr.close();

}
//alert('File '+pFile+' processed');
}

function DHTML(token)
{
var CheckPotentialSafeTags = new Array("div", "span");//Potential safe elements
var SafeClasses = new Array("droptext", "expandtext");//Safe classes

var isDHTML = false;

if(token.isTag(CheckPotentialSafeTags))
{
if(in_array(token.getAttribute("class"),SafeClasses))
isDHTML = true;
}
return isDHTML;
}

function Backup()
{
var FileToBackup = new File(file);
BckFileName = file+backupext;
var BckFile = new File(BckFileName);

//If file exists, loop until unique backup filename is created
if(BckFile.exists)
{
var i = 0;
while(BckFile.exists)
{
i++;
BckFile = new File(BckFileName+i);
}
BckFileName = BckFile.fsName;
}
FileToBackup.copy(BckFileName);
}

function RemoveBackup()
{
var BckFile = new File(BckFileName);
BckFile.remove();
}

function FixURL(oldURL) {
var WrongPathDelimiter = /\\/g;
var CorrectPathDelimiter = '/';
var newUrl = oldURL.replace(WrongPathDelimiter, CorrectPathDelimiter);
return newUrl;
}

function in_array(needle,haystack,strict) {
if(!strict)
var strict = false;

var in_array = false;
for(var i=0;i

Title Doesn't Match Result

How To Save an Old Laptop By Installing This Free OS started out promising until I read this:
Right now the Pixel OS can’t be installed on your laptop, only run from a USB stick or DVD, though this might change in the future.
Wait. The title says you can install the free OS.
But you can't.
Blech.
I still may look into if it supports ripping CDs to MP3 and, if it does, I suppose running it on the same box that has Ubuntu on it would be an option. I haven't returned to that tower to figure out how to get around being asked for a password I don't remember. I have the instructions printed and sitting on my desk.

Tuesday, February 21, 2017

Laying it Out For Success

Nothing can be discussed about the Iowa Hawkeyes' men's basketball post-season schedule until there is a victory tonight.

As the article points out, the NIT is hard for Hawkeyes to reach. This is because Iowa needs three more wins, perhaps more. The Hawkeyes are 14-13 with games left at home against Indiana, at Maryland and Wisconsin, at home against Penn State. Then, they play at least once in the Big Ten tournament in Washington, DC.

If I were coaching, I'd be stressing the 'one game at a time' mentality. The Hawkeyes confront Indiana tonight @ 8 PM. I would stress that before you can even look at Maryland or WI, or PSU or the Big Ten tournament, you must focus on Indiana and win that game.

Then, we will focus on Maryland.

Then, we will focus on WI.

Then, we will focus on PSU.

Then, we will focus on our Big Ten opponent.

Editor's Note: Success on 2/22! Iowa defeats Indiana in overtime! Read more here.

Join Us



Editor's Note: The above video was embedded after reading this article: You'll Need to Rewatch This Walking Dead Scene After Hearing This

Revenge!


5 Simple Ways

5 Simple Ways to Strengthen the Friendship in Your Marriage

Monday, February 20, 2017

Sighing as I'm Missing Sting




Once Upon Consistency

These sentences are from the same website with the same type of page-level table of contents following the text. I include them here because it sure would have been easier to create a snippet with one of the three versions and then simply refer to that snippet on the three different pages. I favor that strategy over writing the same sentence 3 different times.



FOUR HOURS REQUIRED!!! if you watch "Metallica's 30th Anniversary (2011) [Compilation]"

Holy Sh!t Holy Sh!t Holy Sh!t - Vol 13

Awesome Episode

Cobain Would be 50 Today

Instead of having Nirvana tunes playing in the background, there is some weird & annoying crap. You probably will want to mute this video.

Life at Another Employer was like THIS

At a previous employer (10/2010 - 4/2011), I was in the same type of position as Zev Levi, the originator of the thread below, except that I wasn't about working in a different country. In my situation, it was about:
  • explaining to product managers and developers and a co-worker why their documentation ideas [were] troublesome 
  • defending my 15 years, 8 months, 5 days of experience against terrible technical writing practices, chief among them being to manually type a table of contents for a ~150 page user guide, printing it, verifying the page number in the table of contents matches the actual page, fixing, reprinting, and repeating that process. 
  • biting my tongue when, after showing my co-worker that an automatic table of contents could be generated from headings in the Adobe InDesign file (just like Microsoft Word), doing so was dismissed as "too complicated."
Thus, when Peter Neilson wrote "Attitude Adjustment being inappropriate, the solution devolves to doing an end run, never showing the final version to the SME until it is too late for enemy action. If the SME outranks you substantially, be ready to take a job elsewhere, preferably in an entirely different profession", I smiled and replaced the word "profession" with "industry" as that's exactly what I ended up doing.

In fact, 5 years, 10 months ago today, I left the medical devices industry. An incredibly long 1 month, 2 weeks, 4 days later, I began working in the education industry. I worked in that industry for 4 years, 7 months, 3 weeks, 5 days, which is when I had to begin Job Search 2016. Ultimately, though, I landed up.

And that is ALL that matters today. Below is the thread on Techwr-L that instigated the brief trip down memory lane.

-----Original Message-----
From: Peter Neilson
Sent: Monday, February 20, 2017 8:15 AM
To: techwr-l@lists.techwr-l.com
Subject: Re: Nightmare Library

I've answered this at incredible length in a private note to Zev.
Basically it is attitude and audience. I think that Zev's colleagues believe they are themselves the audience. I also suspect that they are possessed of Ample Attitude.

The problem is akin to writing a popular article about some aspect of mathematics, and showing it to a mathematician. He (the mathematician) will find plenty of things "totally wrong" about what you wrote, as well as finding things wrong with YOU and with your dreadful lack of understanding in mathematics. And that's just for starters. (Done there, been that!)

Attitude Adjustment being inappropriate, the solution devolves to doing an end run, never showing the final version to the SME until it is too late for enemy action. If the SME outranks you substantially, be ready to take a job elsewhere, preferably in an entirely different profession.
> -----Original Message-----
> From: techwr-l-bounces+lynne.wright=kronos.com@lists.techwr-l.com
> [mailto:techwr-l-bounces+lynne.wright=kronos.com@lists.techwr-l.com]
> On Behalf Of Zev Levi
> Sent: February-20-17 2:24 AM
> To: techwr-l
> Subject: Nightmare Library
>
> Hi all,
>
> I work in a country where English is spoken as a second language (if
> at
> all) and I often find myself explaining to product managers and
> developers why their documentation ideas are troublesome. ("Yes, the
> sentence you changed is clear to you but, as it's now five lines long,
> it is confusing to readers. We must explain ideas using shorter
> sentences.")
>
> Is anyone aware of a virtual library of bad-documentation examples (a
> library of tech-doc nightmares)? I'd like to search for *long
> sentences* and find examples of unclear documentation.
>
> It would be easier to convince PMs of writing guidelines if they tried
> reading a doc that didn't follow them.
>
> I haven't had any luck googling these terms; I'm looking for
> documentation examples and google generally returns links to forums.
>
> Cheers
>
> Zev

Amazing!

http://www.msofficeforums.com/word-vba/12803-find-replace.html#post34254
This is going to help me some day!

Question: 

Is it possible to have MS Word 2003 find and replace text between a certain text? For instance, my document has many lines with text like:

"Warehouse: city 1, Store: Area 1, Address: Avenue 1, PIPE: 15412."
"Warehouse: city 3, Store: Area 5, Address: Avenue 5, IT: 15412."
"Warehouse: city 8, Store: Area 2, Address: Street 4, GATE: 15412."

Notice that first word (Warehouse) and the last text (15412) remain identical in all the lines.
I want to replace everything between 'Warehouse' and '15412' in every line so the end result may look like:
"Warehouse: Village 31, Store: Zone DC, Address: Part 1, CIR: 15412."
"Warehouse: Town 4, Chain: Zone D2C, email: Blvd 5, CIK: 15412."
"Warehouse: Locality A, Grocer: County 7E, snailmail: Building 4, DIMD: 15412."

Answer: 

Given that you want to process multiple documents, try the following macro. Basically, all you need to do is to create an Excel workbook with the Find & Replace strings in columns A & B, respectively, then run the macro and point it to the folder containing the files to be processed. All documents in that folder will be searched and updated. You will need to:
  1. supply your own workbook name for the 'StrWkBkNm' variable, 
  2. your own worksheet name for the 'StrWkSht' variable 
  3. some or all of the path

Sub BulkFindReplace()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
Dim xlApp As Object, xlWkBk As Object, StrWkBkNm As String, StrWkSht As String
Dim iDataRow As Long, xlFList As String, xlRList As String, i As Long
StrWkBkNm = "C:\Users\" & Environ("Username") & "\Downloads\BulkFindReplace.xlsx"
StrWkSht = "Sheet1": strDocNm = ActiveDocument.FullName
If Dir(StrWkBkNm) = "" Then
MsgBox "Cannot find the designated workbook: " & StrWkBkNm, vbExclamation
Exit Sub
End If
On Error Resume Next
'Start Excel
Set xlApp = CreateObject("Excel.Application")
If xlApp Is Nothing Then
MsgBox "Can't start Excel.", vbExclamation
Exit Sub
End If
On Error GoTo 0
With xlApp
'Hide our Excel session
.Visible = False
' The file is available, so open it.
Set xlWkBk = .Workbooks.Open(FileName:=StrWkBkNm, ReadOnly:=True, AddToMru:=False)
If xlWkBk Is Nothing Then
MsgBox "Cannot open:" & vbCr & StrWkBkNm, vbExclamation
.Quit: Set xlApp = Nothing: Exit Sub
End If
' Process the workbook.
With xlWkBk
'Ensure the worksheet exists
If SheetExists(xlWkBk, StrWkSht) = True Then
With .Worksheets(StrWkSht)
' Find the last-used row in column A.
iDataRow = .Cells(.Rows.Count, 1).End(-4162).Row ' -4162 = xlUp
' Capture the F/R data.
For i = 1 To iDataRow
' Skip over empty fields to preserve the underlying cell contents.
If Trim(.Range("A" & i)) <> vbNullString Then
xlFList = xlFList & "|" & Trim(.Range("A" & i))
xlRList = xlRList & "|" & Trim(.Range("B" & i))
End If
Next
End With
Else
MsgBox "Cannot find the designated worksheet: " & StrWkSht, vbExclamation
End If
.Close False
End With
.Quit
End With
' Release Excel object memory
Set xlWkBk = Nothing: Set xlApp = Nothing
'Exit if there are no data
If xlFList = "" Then Exit Sub
'Get the folder to process
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
'Process each document in the folder
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
'Process each word from the F/R List
With wdDoc
With .Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWholeWord = True
.MatchCase = True
.Wrap = wdFindContinue
For i = 1 To UBound(Split(xlFList, "|"))
.Text = Split(xlFList, "|")(i)
.Replacement.Text = Split(xlRList, "|")(i)
.Execute Replace:=wdReplaceAll
Next
End With
'Close the document
.Close SaveChanges:=True
End With
End If
'Get the next document
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub

Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function

Function SheetExists(xlWkBk As Object, SheetName As String) As Boolean
Dim i As Long: SheetExists = False
With xlWkBk
For i = 1 To .Sheets.Count
If .Sheets(i).Name = SheetName Then
SheetExists = True: Exit For
End If
Next
End With
End Function

Not the Results Expected

We MUST defend our home court and that wasn't done on Saturday.


The next home game is Tuesday against Indiana.

Port-Haak-Smit

All of these videos could have been a standalone post on their own merits, but they're collected as one because there is a common thread that unites them. See below the 5th video for the reason these 3 drummers belong together.

As for the drummers themselves, two need no introduction: Mike Portnoy and Chad Smith. The third, Tomas Haake does. He is the drummer for Meshuggah, a band that is playing on the Friday night of Chicago Open Air 2017 in July 2017. There are many bands I need to bone up on prior to July 2017 and Meshuggah is one of those bands.






The reason these 3 drummers belong together is that they are all Sabian cymbal endorsers.
And here's another fun fact. If I had seen the video below, I likely would not have sought to hear any Meshuggah tunes.

Editor's Note: Because of embedding the two videos of Tomas Haake playing drums, the "Meshuggah" tag has been added to this blog. Because of embedding the video of Mike Portnoy playing an Adrenaline Mob tune, the "Adrenaline Mob" tag has been added to this blog.

I Need Help

Death Truly Sucks Dirt

On 2/19/2010, a family's life changed forever. I can never forget what I felt like when I heard that my co-worker's daughter had passed. She posted the following on her Facebook page yesterday:


Great Marketing Writing

I like the marketing angle for this ad:

"You can never have enough space, and 8 terabytes is really a lot of data, but if you need that much this hard drive is being offered for $40 off list price."

I agree with that!


Inspirational Monday Sayings

The challenge is to take a break from the busy live that consumes my dawn to dusk and remember things like the following:



Friday, February 17, 2017

Thinking about the Future

While I recently purchased CrashPlan as my backup solution, I still think about a solution like this one:


Tim, my co-worker, has this type of a backup solution instead of a service like CrashPlan. 4 x 2 TB is a lot of storage room and would certainly be able to handle my CDs to MP3 files. I also think that the files that result from my cassette to MP3 conversion as(I think), and my videos to digital (I think). Of course, maybe I'm going against the trend: Are consumers returning to non-digital technology?

Apology Accepted. Move Along.

http://www.foxnews.com/entertainment/2017/02/16/grammy-producer-apologizes-for-metallica-glitch.html

Must be Buried

Sepultura is another band that has members going their separate ways and waging war in the press. In this video, guitarist Andreas Kisser fires a shot at former bandmates Max and Igor Cavalera and their plans to perform the entire "Roots" album with the declaration that they 'are not doing anything new' in this article on Blabbermouth.net.

Sepultura is just like Kiss which is just like Ratt which is just like Metallica which is just like Megadeth which is just like Dream Theater. Instead of resolving differences in-person, each of these bands makes less than flattering comments to sites like Blabbermouth.net, thinking it will somehow resolve their issues. When a band member leaves a band, it's similar to a divorce where fans feel they have to pick a side. Are you on Andreas Kisser's side or Max Calavera's side? I mean, my God, it was 1996, the year Megan was born, when Max left Sepultura after the rest of the band fired his wife Gloria as their manager. That'll be 21 years in August and yet, the questions are asked of Kisser.

Life is too short. All these bands with former members still active in the music business need to adopt a code. The code is this. When you are asked by the media, "What do you think of your former member's current music?" you need to answer one of two ways:
  1. If you've heard the music, you say, "I think [name of former member] is doing what he/she needed to do and I'm happy they found an outlet. I respect their time in our band and I wish them nothing but the best."
  2. If you haven't heard the music, you say, "I haven't had a chance to check it out yet. I respect their time in our band and I wish them nothing but the best."
Here Kisser break that code in the video below.


Bladesaw

Thursday, February 16, 2017

Got on a CB Trip






New LP Released

Alex sent me a text to find the new Linkin Park tune "Heavy" and I found it on this page. To me, the word "heavy" means "heavy metal" and, as you will hear when you listen to it, the song is NOT heavy metal.


That said, I do like the tune.

Enter Information Development World

It was 2012 - nearly 5 years ago - when I attended WinWriters in Memphis. When I see conferences like this one - Information Development World (IDG), I can't help but be taken back to 2012. It was such an awesome time in Memphis with Karen, Mark, and Susie - we still refer to some of the funny things said and done on that trip.

Here's information about the IDG conference:

Information Development World (IDW) is the conference for technical, marketing, and product information managers—the folks responsible for managing the people, processes, and technologies involved in creating exceptional customer experiences with content. IDW takes place May 15-17 at the Quadrus Conference Center in Menlo Park, California, the heart of Silicon Valley venture-capital land.

To read more details about the conference, refer to the Schedule.

That's the Point

Censorship sucks and it sucks worse when it fails. Consider this panel from an article that was reviewing an issue of The Walking Dead comic book. The f-word is blurred out 4 times, which is great. Except there are five instances of the f-word:


It made me laugh.

Goals? Of course I Have Goals

These are the goals I submitted to Bob to discuss for the next year.
What is your specific goal? (typically 3-5 goals, may include a professional development goal)
  1. Enhance existing relationships and establish additional relationship with all teams that are responsible for the 16 critical HCIS systems
  2. Establish additional processes related to how I do my work such as automating the compilation of the RoboHelp project to generate the required 3 deliverables (CHM file, PDF, and browser-based) and setting up how these deliverables would be available when a disaster happens. This also includes advanced MS Word practices related to templates and updating boilerplate text across the 16 critical HCIS system Word docs by updating the template.
  3. Integrate all relevant knowledge I learn by working on the disaster recovery documentation with the Cherwell project.
  4. provide editorial and writing guidance for HCIS co-workers
  5. provide guidance for HCIS co-workers who have questions about how to use the tools I use on a daily basis

Wednesday, February 15, 2017

Styles in Text

I have been fighting with Microsoft Word styles for what feels like an eternity. In each of my files that are linked to my Disaster Recovery project in RoboHelp, I started running Macmillan Tools > Style Report, which generates a text file but to better analyze what I have, I wanted to combine the text files into a single file, but I also wanted to know the file name and have some sort of a divider between the files.

Enter google. I entered


which led to this page:


I read this, which, yes, it is hard to read:


which has this answer:


Because I may want to use the commands within the DOS batch file in the answer, here it is:

@echo off
for /r %%i in (*.txt) do (
if not %%~nxi == output.txt (
echo %%~nxi >> output.txt
type "%%i" >> output.txt
echo. >> output.txt
echo =================================================================== >> output.txt
)
)

I also downloaded the mentioned text file merging tool - txtcollector because I have a lot of text files on my external hard drive that I would like to combine using it.

But not right now.

Right now, I need to focus. My status review meeting with my manager is at 1 today and I need to get some work done with some of the Word documents so I can show him my progress.