Hi,
I want to use a macro to rename thousands of bookmarks at a single go using a excel sheet as input.
I would like to know how we can create such macros in Madcap Flare in order to do so.
Please help me with this.
Thanks.
How to use Macros in Madcap Flare
-
- Propellus Maximus
- Posts: 810
- Joined: Wed Jul 25, 2012 11:36 am
- Location: Ann Arbor, MI
Re: How to use Macros in Madcap Flare
Does Flare even support macros?
I don't know if this will work for what you're trying to do, but here's a VBScript I use for replacing unicodes. Enter the current value in the first set of quotes and the new value in the second. This is assuming you know all the bookmarks to be changed.
Example: strNewText = Replace(strText, "oldBookmark", "newBookmark")
strNewText1 = Replace(strText, "oldBookmark1", "newBookmark1")
strNewText2 = Replace(strText, "oldBookmark2", "newBookmark2")
...and just delete the lines you don't need.
Copy the code into NotePad and save it with a .vbs file extension. When you double-click the file, a dialog displays for you to enter the directory: C:\Users\kwag.myers\Documents\Test\Content (if your snippets have bookmarks, you'll have to do the Resources\Snippets folder in a second pass).
I don't know if this will work for what you're trying to do, but here's a VBScript I use for replacing unicodes. Enter the current value in the first set of quotes and the new value in the second. This is assuming you know all the bookmarks to be changed.
Example: strNewText = Replace(strText, "oldBookmark", "newBookmark")
strNewText1 = Replace(strText, "oldBookmark1", "newBookmark1")
strNewText2 = Replace(strText, "oldBookmark2", "newBookmark2")
...and just delete the lines you don't need.
Copy the code into NotePad and save it with a .vbs file extension. When you double-click the file, a dialog displays for you to enter the directory: C:\Users\kwag.myers\Documents\Test\Content (if your snippets have bookmarks, you'll have to do the Resources\Snippets folder in a second pass).
Code: Select all
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = InputBox("Enter file directory ending with \","File Directory")
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile In colfiles
fn = objFSO.GetFileName(objFile)
Set objFile = objFSO.OpenTextFile(objStartFolder & fn, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "à", "à")
strNewText1 = Replace(strNewText, "á", "á")
strNewText2 = Replace(strNewText1, "â", "â")
strNewText3 = Replace(strNewText2, "ã", "ã")
strNewText4 = Replace(strNewText3, "ç", "ç")
strNewText5 = Replace(strNewText4, "è", "è")
strNewText6 = Replace(strNewText5, "é", "é")
strNewText7 = Replace(strNewText6, "ê", "ê")
strNewText8 = Replace(strNewText7, "ì", "ì")
strNewText9 = Replace(strNewText8, "í", "í")
strNewTextA = Replace(strNewText9, "î", "î")
strNewTextB = Replace(strNewTextA, "ñ", "ñ")
strNewTextC = Replace(strNewTextB, "ò", "ò")
strNewTextD = Replace(strNewTextC, "ó", "ó")
strNewTextE = Replace(strNewTextD, "ô", "ô")
strNewTextF = Replace(strNewTextE, "õ", "õ")
strNewTextG = Replace(strNewTextF, "ù", "ù")
strNewTextH = Replace(strNewTextG, "ú", "ú")
strNewTextI = Replace(strNewTextH, "û", "û")
strNewTextJ = Replace(strNewTextI, "Í", "Í")
strNewTextK = Replace(strNewTextJ, "º", "º")
strNewTextL = Replace(strNewTextK, " ", " ")
strNewTextM = Replace(strNewTextL, "ï", "ï")
strNewTextN = Replace(strNewTextM, "’", "’")
strNewTextO = Replace(strNewTextN, "À", "À")
strNewTextP = Replace(strNewTextO, "É", "É")
strNewTextQ = Replace(strNewTextP, "°", "°")
strNewTextR = Replace(strNewTextQ, "«", "«")
strNewTextS = Replace(strNewTextR, "»", "»")
strNewTextT = Replace(strNewTextS, "œ", "œ")
strNewTextU = Replace(strNewTextT, "'", "'")
Set objFile = objFSO.OpenTextFile(objStartFolder & fn, ForWriting)
objFile.WriteLine strNewTextT
objFile.Close
Next
MsgBox "Ta Da! \0/" & strMsg, vbInformation, "Done!"
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Re: How to use Macros in Madcap Flare
Thanks kwag_myers , It works like a charm.kwag_myers wrote:Does Flare even support macros?
I don't know if this will work for what you're trying to do, but here's a VBScript I use for replacing unicodes. Enter the current value in the first set of quotes and the new value in the second. This is assuming you know all the bookmarks to be changed.
Example: strNewText = Replace(strText, "oldBookmark", "newBookmark")
strNewText1 = Replace(strText, "oldBookmark1", "newBookmark1")
strNewText2 = Replace(strText, "oldBookmark2", "newBookmark2")
...and just delete the lines you don't need.
Copy the code into NotePad and save it with a .vbs file extension. When you double-click the file, a dialog displays for you to enter the directory: C:\Users\kwag.myers\Documents\Test\Content (if your snippets have bookmarks, you'll have to do the Resources\Snippets folder in a second pass).
Code: Select all
Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = InputBox("Enter file directory ending with \","File Directory") Set objFolder = objFSO.GetFolder(objStartFolder) Set colFiles = objFolder.Files For Each objFile In colfiles fn = objFSO.GetFileName(objFile) Set objFile = objFSO.OpenTextFile(objStartFolder & fn, ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, "à", "à") strNewText1 = Replace(strNewText, "á", "á") strNewText2 = Replace(strNewText1, "â", "â") strNewText3 = Replace(strNewText2, "ã", "ã") strNewText4 = Replace(strNewText3, "ç", "ç") strNewText5 = Replace(strNewText4, "è", "è") strNewText6 = Replace(strNewText5, "é", "é") strNewText7 = Replace(strNewText6, "ê", "ê") strNewText8 = Replace(strNewText7, "ì", "ì") strNewText9 = Replace(strNewText8, "í", "í") strNewTextA = Replace(strNewText9, "î", "î") strNewTextB = Replace(strNewTextA, "ñ", "ñ") strNewTextC = Replace(strNewTextB, "ò", "ò") strNewTextD = Replace(strNewTextC, "ó", "ó") strNewTextE = Replace(strNewTextD, "ô", "ô") strNewTextF = Replace(strNewTextE, "õ", "õ") strNewTextG = Replace(strNewTextF, "ù", "ù") strNewTextH = Replace(strNewTextG, "ú", "ú") strNewTextI = Replace(strNewTextH, "û", "û") strNewTextJ = Replace(strNewTextI, "Í", "Í") strNewTextK = Replace(strNewTextJ, "º", "º") strNewTextL = Replace(strNewTextK, " ", " ") strNewTextM = Replace(strNewTextL, "ï", "ï") strNewTextN = Replace(strNewTextM, "’", "’") strNewTextO = Replace(strNewTextN, "À", "À") strNewTextP = Replace(strNewTextO, "É", "É") strNewTextQ = Replace(strNewTextP, "°", "°") strNewTextR = Replace(strNewTextQ, "«", "«") strNewTextS = Replace(strNewTextR, "»", "»") strNewTextT = Replace(strNewTextS, "œ", "œ") strNewTextU = Replace(strNewTextT, "'", "'") Set objFile = objFSO.OpenTextFile(objStartFolder & fn, ForWriting) objFile.WriteLine strNewTextT objFile.Close Next MsgBox "Ta Da! \0/" & strMsg, vbInformation, "Done!"