Building a string

Share your macros, knowledge, solutions, services, ...
Post Reply
jfusco
Posts: 6
Joined: Tue Apr 11, 2017 3:49 pm

Building a string

Post by jfusco » Wed Dec 06, 2017 5:57 pm

I recently upgraded from PK 7.x to PK 8.4.0. I have a macro that calls a vbs script that opens a new email using a template which is determined at the start of the run. I grab a screen of text to the clipboard. Line 33 is the case title but it contains a | character which I was unable to get my macro to ignore. The vbs would not open an email if I had to select which part of the line to use. I decided to parse the line and build my subject out of the first 5 words.

Code: Select all

<#> Retrieve case title
<varset>("wordCount=1","") <#> set word number to grab at 1
<varset>("grabWord=_vStrEmpty","") <#> initialize word holder variable
<varset>("gm_caseTitle=_vStrEmpty","") <#> initialize case title
<var_oper>(vFullTitle,"%clipText%",TEXT_GET_LINE,"33","", "0") <#> Get the line from the clipboard data that contains the title
<begloop>(5)
	<var_oper>(grabWord,"%vFullTitle%",TEXT_GET_WORD,"%wordCount%",":", "0") <#> grab the next word in the line
	<var_oper>(gm_caseTitle,"%gm_caseTitle%",STR_APPEND,"%grabWord% ","", "0") <#> add it to the end of the title string
	<var_oper>(wordCount,"%wordCount%+1",CALC_EXPRESSION,"0","", "0") <#> increment the word counter
<endloop>
<var_oper>(gm_caseTitle,"%gm_caseTitle%",STR_APPEND,"...","", "0") <#> add ... to the end of the title string
Let's assume the case title is: failed physical disk slot 3 array 4 | no warranty

Under 7.x %gm_caseTitle% came out: failed physical disk slot 3...

Under 8.4.0, the variable builds as: failed failed physical failed failed physical disk failed failed physical disk slot failed failed physical disk slot 3 failed failed physical disk slot 3...

I put in a message to show me how it was building the string.
Pass 1 - grabWord = failed, Title = failed
Pass 2 - grabWord = physical, Title = failed failed physical
Pass 3 - grabWord = disk, Title = failed failed physical failed failed physical disk

So, in 7.x, PK was appending the new word onto the end of the string. In 8.4.0, it's appending the full contents of the string plus the new word onto the end of the string. This is freaking out my vbs and it's not creating the email.

Do I need to change the code to something like

Code: Select all

<var_oper>(gm_caseTitle,"%grabWord% ",STR_APPEND,"","", "0") 
Or do I need to do something entirely different?

Thanks

Post Reply