# URCap Sample: Script Wrapper URCap

**URL:** <https://forum.universal-robots.com/t/urcap-sample-script-wrapper-urcap/1196>\
**Category:** URCap Development\
**Tags:** urcap-sample\
**Created:** [September 20, 2017, 2:05pm UTC](https://forum.universal-robots.com/t/urcap-sample-script-wrapper-urcap/1196 "2017-09-20T14:05:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [September 20, 2017, 2:05pm UTC](https://forum.universal-robots.com/t/urcap-sample-script-wrapper-urcap/1196/1 "2017-09-20T14:05:48Z")

</div>

**Script Wapper URCap**

**Description of functionality:**  
This URCap wraps the contents of a selected script file into a program node in PolyScope.  
The user can select which script file to wrap, and select a decent image to show instead.

User must place a script file (.script) and optionally image (.jpg, .jpeg, .png .bmp) in the `/programs/` folder on a real robot, or `/home/ur/ursim-current/programs/` in a URSim. The URCap checks the robots serial number, to decide what folder to look in.

The sample demonstrates how to wrap pre-written URScript into a URCap. How to read the serial number and find files on the file system. It also implements images and dropdowns.

Note:  
It is suggested, that product that generate URScript code into a file, e.g. CAD/CAM software uses an approach like this, to wrap different modules of the script code into self-explanatory functional blocks for easier readability.

**What topics are covered:**  
appendRaw, script file, image, select, dropdown, manage files, read script

> **[GitHub - BomMadsen/URCap-ScriptWrapper: Small URCap that demonstrated wrapping...](https://github.com/BomMadsen/URCap-ScriptWrapper)**
>
> Small URCap that demonstrated wrapping a URScript file in a ProgramNode. - GitHub - BomMadsen/URCap-ScriptWrapper: Small URCap that demonstrated wrapping a URScript file in a ProgramNode.

**Requirements:**  
URCaps SDK 1.1+

---

<div class="post-metadata">

**Author:** ![jordan](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jordan](https://forum.universal-robots.com/u/jordan)\
**Post date:** [March 12, 2019, 10:11pm UTC](https://forum.universal-robots.com/t/urcap-sample-script-wrapper-urcap/1196/2 "2019-03-12T22:11:22Z")

</div>

Hello Jacob,

Would it be possible to share this Script Wrapper URCap in the Swing user interface (your example is HTML).

Also, after I load the .script file, I plan to read through the script file, locate each movej command in the .script file, and place all the joint locations (following each movej command) into a dynamic array. Also, it would be great if you would provide a sample to do this. I do not need any of the image loading that you have in your Script Wrapper.

Thanks!  
Jordan
