Skip to main content
Known Participant
October 23, 2023
Answered

robohelp 2022 build script

  • October 23, 2023
  • 6 replies
  • 1145 views

After building in Robohelp 2022, I want to copy all files in the folder I specified to the build folder. Are there any js script examples? And is there a special environment variable for the Robohelp build location?

    This topic has been closed for replies.
    Correct answer deltechwriter

    I realize this topic is a year+ old, however.... if you are comfortable with the Windows command line and batch files...

    You can use a command-line scripting/batch file to build the Robohelp content, then add a command-line command like Robocopy to move the files. 

    Robohelp command line (2020): https://helpx.adobe.com/robohelp/using/generate-output.html?x-product=Helpx%2F1.0.0&x-product-location=Search%3AForums%3Alink%2F3.6.3

    Robocopy help: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

    example:

    rem batch file to build output and copy files

    "C:\Program Files\Adobe\Adobe RoboHelp 2020\RoboHelp.exe" --cl "C:\path\to\project\project.rhpj" -o "preset" -l "C:\path\to\log\file\log.html" -p "C:\path\to\output\folder"

    Robocopy <from> <to> *.* /z /s /unilog:C:\path\to\copy\log\textfile.txt

     

    I have not tested this but I've done similar before. Be careful with Robocopy, it's great for copying but can also delete i you are not careful with switches. Check the logs each time to be sure of what it did.

    __PRESENT

    __PRESENT

    __PRESENT

    6 replies

    deltechwriterCorrect answer
    Inspiring
    December 10, 2024

    I realize this topic is a year+ old, however.... if you are comfortable with the Windows command line and batch files...

    You can use a command-line scripting/batch file to build the Robohelp content, then add a command-line command like Robocopy to move the files. 

    Robohelp command line (2020): https://helpx.adobe.com/robohelp/using/generate-output.html?x-product=Helpx%2F1.0.0&x-product-location=Search%3AForums%3Alink%2F3.6.3

    Robocopy help: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

    example:

    rem batch file to build output and copy files

    "C:\Program Files\Adobe\Adobe RoboHelp 2020\RoboHelp.exe" --cl "C:\path\to\project\project.rhpj" -o "preset" -l "C:\path\to\log\file\log.html" -p "C:\path\to\output\folder"

    Robocopy <from> <to> *.* /z /s /unilog:C:\path\to\copy\log\textfile.txt

     

    I have not tested this but I've done similar before. Be careful with Robocopy, it's great for copying but can also delete i you are not careful with switches. Check the logs each time to be sure of what it did.

    __PRESENT

    __PRESENT

    __PRESENT

    Known Participant
    December 11, 2024

    This is an old topic, but thanks for answering. I already solved this part by creating a batch file. It's similar to how you spoke to me. I didn't know there was help for the RoboHelp command line, so thank you for the link.

    Community Expert
    October 25, 2023

    Oh, and you should find some sample scripts (for use within the RH UI, not post-build scripts) in the %appdata% folder.

     

    And info on how to debug the in-RH scripts:

    https://community.adobe.com/t5/robohelp-discussions/rh2019-new-scripting-feature/m-p/11036083#M129795

    Community Expert
    October 25, 2023

    I assume you are wanting to automate getting files owned and managed by another part of the business and don't want to risk including outdated files in the output. 

     

    Most of us here aren't developers so you unfortunately won't get a lot of advice about scripting. Also, the post build script stuff is also very new (and undocumented?) so not sure how all that works.

     

    Have you had a look at the scripting documentation in the Appendix of the help? It's out of date (and inadequate in my opinion), but might offer some insight into what to look for in the browser debug window - I assume you can incorporate this into the post build script...

     

    https://helpx.adobe.com/robohelp/user-guide.html

     

    Another option to look at would be linking files or folders to the project. This should let you know when an external file has changed and let you sync the latest version with the project. See here for information:

    https://helpx.adobe.com/robohelp/using/work-with-topics-folders.html#Linkfilesandfolders

     

    Also look at Peter's excellent site. While it only talks about Word docs, it should* apply for any type of file:

    https://www.grainge.org/pages/authoring/rh_tour/rh2022/authoring/importing_linking.htm

     

    I don't *think* there's any option to automatically get the latest version when you generate the output, so you'd need to manually do that before you generate. But I haven't looked at that functionality in RH2022 so it's possible a setting has been added. If there's no setting in the output preset you could submit a feature request for it.

     

     

    * YMMV - I'm not sure many people use this feature, and the architecture has changed significantly in New UI, so who knows what bugs you might find.

    Jeff_Coatsworth
    Community Expert
    Community Expert
    October 24, 2023

    I think you're missing the two distinct actions that RH does when you create output from a RH project - the first is generating and the second publishing. When you generate, you specify the output location folder and your output content is created there. Then you can move/copy/transfer it wherever you need it to be using whatever tool you want - File Explorer, FTP, etc.. When you publish, it combines both those actions - generating to a specified end location & moving the output files to that location (usually to a webserver or some location in a content management system for inclusion in some product's build process).

    Known Participant
    October 25, 2023

    I do not want to move the generated output to a location other than the build folder. After building, I want to automatically overwrite other files into the build folder using js script.

    Peter Grainge
    Community Expert
    Community Expert
    October 24, 2023

    Sorry but this is still not making sense. By build location I take it you mean the folder to which you are generating the output. That is something known in advance that could be included in the topics.

     

    Perhaps someone can help if you tell us what is behind this request.

     

    I've been around these forums for over twenty years and have not seen anything like this thread before.

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Known Participant
    October 25, 2023

    As you said, the build location is where the project output is generated.

    I'm trying to overwrite some files (outside the robohelp project) into the build location.

    I want this task to occur after every build.

    If you look at the Output settings, there is a Post Generation Script setting, so I want to write the task as a script.

    Peter Grainge
    Community Expert
    Community Expert
    October 25, 2023

    Yes I am well aware of the option to add scripts, that's not the issue.

     

    Adding files into the build location can be done with baggage files but you are saying "overwrite". What sort of files are you trying to add to the build location?

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Peter Grainge
    Community Expert
    Community Expert
    October 23, 2023

    After building you want to copy to the build folder. After "building" they are wherever you specified so do you mean you want to publish what you generated?

     

    Please clarify what you are wanting to achieve.

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Known Participant
    October 24, 2023

    After building the project, I want to overwrite the files in a specific folder with the build folder location.

    example)
    - Build folder path: D:\build\
    - Folder path I want to copy: D:\sample\
    - Desired action 1: copy to D:\build\ from D:\sample\*
    - Desired action 2: copy to D:\build\image\ from D:\image\*

    Known Participant
    October 24, 2023

    I'm also curious how I can get the location of the build folder.
    e.g., robohelp.getLocation(ProjectBuildFolder)