by jd776 » Tue Jun 05, 2007 12:24 am
Firstly, I would like to send out big thanks to W. Kyle White and the other posters for making these scripts available.
I found a problem with the RemoveCategoryFromCustom1 sub and I am posting the fix.
The problem: When you add three categories, then remove the second category the comma between the first category and the third category disappears, thereby fusing the first and third categories together.
I replaced
Code: Select all
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category&'','', ''''):"
Code: Select all
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category&'', '', '', ''):"
And now it works!
Here is the Sub with the change included:
Code: Select all
Sub RemoveCategoryFromCustom1
' Define variables
Dim category, s
category = Trim(SkinnedInputBox("Enter the Category to remove", "Remove Category", "Blah"&Chr(34)))
if (category = "") then
Exit Sub
End If
s = "If(itm.Custom1 = Category) Then:"
s = s & " itm.Custom1 = '''':"
s = s & " itm.UpdateDB:"
s = s & "End If:"
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category&'', '', '', ''):"
s = s & "itm.Custom1 = Replace(itm.Custom1, Category&'', '', ''''):"
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category, ''''):"
s = s & "itm.UpdateDB:"
s = Replace(s, "''", Chr(34))
kwExecuteStatement Replace(s, "Category", kwToString(Category))
End Sub
Firstly, I would like to send out big thanks to W. Kyle White and the other posters for making these scripts available.
I found a problem with the RemoveCategoryFromCustom1 sub and I am posting the fix.
The problem: When you add three categories, then remove the second category the comma between the first category and the third category disappears, thereby fusing the first and third categories together.
I replaced
[code]
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category&'','', ''''):"
[/code]
[code]
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category&'', '', '', ''):"
[/code]
And now it works! :)
Here is the Sub with the change included:
[code]Sub RemoveCategoryFromCustom1
' Define variables
Dim category, s
category = Trim(SkinnedInputBox("Enter the Category to remove", "Remove Category", "Blah"&Chr(34)))
if (category = "") then
Exit Sub
End If
s = "If(itm.Custom1 = Category) Then:"
s = s & " itm.Custom1 = '''':"
s = s & " itm.UpdateDB:"
s = s & "End If:"
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category&'', '', '', ''):"
s = s & "itm.Custom1 = Replace(itm.Custom1, Category&'', '', ''''):"
s = s & "itm.Custom1 = Replace(itm.Custom1, '', ''&Category, ''''):"
s = s & "itm.UpdateDB:"
s = Replace(s, "''", Chr(34))
kwExecuteStatement Replace(s, "Category", kwToString(Category))
End Sub [/code]