2023.1:Scripting Setup: Difference between revisions

From Grooper Wiki
No edit summary
m Dgreenwood moved page 2023.1:Remote Scripting Setup to 2023.1:Scripting Setup over a redirect without leaving a redirect
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<blockquote style="font-size:14pt">
{{AutoVersion}}
 
<blockquote>
This article seeks to elucidate the requirements for setup of remote scripting in '''Grooper 2023.1'''.
This article seeks to elucidate the requirements for setup of remote scripting in '''Grooper 2023.1'''.
</blockquote>
</blockquote>
Line 7: Line 9:


With '''Grooper 2023.1''' scripting can now be done on a remote computer, compiled, and thanks to the '''Grooper SDK''', uploaded to the '''Grooper''' server.
With '''Grooper 2023.1''' scripting can now be done on a remote computer, compiled, and thanks to the '''Grooper SDK''', uploaded to the '''Grooper''' server.
=== Things You Can't Do In Web ===
It's important to understand the thick client and web client are essentially two different user interfaces for '''Grooper'''.  While the functionality is similar, there are necessarily differences in how '''Grooper''' is programed to function when installed and running using a machine's operating system versus how '''Grooper''' is programed to function using web calls.
Due to this, there are certain things that scripts may have been able to accomplish in the thick client that they '''''cannot''''' in the web client  '''''or''''' will need to be rewritten with web functionality in mind.
==== Field Entry and Exit in Data Model Scripts ====
The web client does not register an event for when a '''[[Data Field]]''' is entered or when it is exited in a '''[[Review]]''' step's '''Data Viewer'''.  Therefore, you cannot script events based around field entry or exit in the web client.
==== Windows Dialog Box ====
Windows dialog boxes are not supported through '''Grooper''' in a web browser.


=== Understanding the Environment ===
=== Understanding the Environment ===
Line 36: Line 50:


[[image:2023_Remote-Scripting-Setup_01_About_02_Remote-Scripting-Computer.png]]
[[image:2023_Remote-Scripting-Setup_01_About_02_Remote-Scripting-Computer.png]]
<br><br>
 
[[image:2023_Remote-Scripting-Setup_01_About_04.png]]
[[image:2023_Remote-Scripting-Setup_01_About_04.png]]


<br>
==== Understanding Both ====
 
==== Understaing Both ====
We have the "Grooper Server" and we have the "Remote Scripting Computer" and their requisite components on each. As stated, the '''Grooper Software''' and the '''Grooper Web Client''' are installed on the "Remote Scripting Computer" but the '''Grooper Repository''' is established on the "Grooper Server". The "Remote Scripting Computer" is simply referencing the repository as it exists on the "Grooper Server".
We have the "Grooper Server" and we have the "Remote Scripting Computer" and their requisite components on each. As stated, the '''Grooper Software''' and the '''Grooper Web Client''' are installed on the "Remote Scripting Computer" but the '''Grooper Repository''' is established on the "Grooper Server". The "Remote Scripting Computer" is simply referencing the repository as it exists on the "Grooper Server".


Line 51: Line 63:
=== Establishing a Connection to the "Grooper Server" from the "Remote Scripting Computer" ===
=== Establishing a Connection to the "Grooper Server" from the "Remote Scripting Computer" ===
As discussed, the "Remote Scripting Computer" has '''Grooper 2023.1''', the '''Grooper Web Client''', and Visual Studio 2019 installed, but itself is not hosting a '''Grooper''' repository. We will configure this machine to point at the '''Grooper''' repository that is being hosed by the "Grooper Server".
As discussed, the "Remote Scripting Computer" has '''Grooper 2023.1''', the '''Grooper Web Client''', and Visual Studio 2019 installed, but itself is not hosting a '''Grooper''' repository. We will configure this machine to point at the '''Grooper''' repository that is being hosed by the "Grooper Server".
<br><br>
 
Follow the instructions in the screenshots below.
Follow the instructions in the screenshots below.
<br><br>
 
* Because '''''Grooper Config''''' has  not been run on this computer before, it will need to create its requisite .cfg file that stores its configuration settings.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_01.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_01.png]]
<br><br>
 
 
* With '''''Grooper Config''''' properly initialized (the requisite .cfg file was made), select the "Repositories" property and click the ellipsis button to configure a connection to a '''Grooper''' repo.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_02.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_02.png]]
<br><br>
 
 
# In the "Repositories" window that appears, click the "Add" button.
# A connection entry ill be added to the list.
# Enter connection info to the "Grooper Server" including "Server Name" and "Database Name"
# Enter "Authentication" info. In this case the active Windows user has access to the database, so the properties are left blank.
# Test the connection to verify settings.
# Click "OK" in the "Information" box.
# Click "OK" once the connection is established.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_03.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_03.png]]
<br><br>
 
 
# With a connection established the "Repositories" property will list the connection.
# With only one connection made it will be the default, otherwise verify your "Default Repository"
# Click "Save" once settings are confirmed
 
[[image:2023_Remote-Scripting-Setup_02_How-To_04.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_04.png]]


=== Installing and Configuring the Grooper SDK ===
=== Installing and Configuring the Grooper SDK ===
We now have the ability to connect to the '''Grooper Repository''' hosted by the "Grooper Server", but before we do any work in '''Grooper''', let's jump into Visual Studio to install and configure the '''Grooper SDK'''.
We now have the ability to connect to the '''Grooper Repository''' hosted by the "Grooper Server", but before we do any work in '''Grooper''', let's jump into Visual Studio to install and configure the '''Grooper SDK'''.
<br><br>
 
Follow the instructions in the screenshots below.
Follow the instructions in the screenshots below.
<br><br>
 
* Launch Visual Studio as an administrator
 
[[image:2023_Remote-Scripting-Setup_02_How-To_05.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_05.png]]
<br><br>
 
 
* For now, continue without code
 
[[image:2023_Remote-Scripting-Setup_02_How-To_06.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_06.png]]
<br><br>
 
 
# Click the "Extensions" menu
# Choose "Manage Extensions"
 
[[image:2023_Remote-Scripting-Setup_02_How-To_07.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_07.png]]
<br><br>
 
 
# Search for "Grooper"
# Select "GrooperSDK" and click "Download"
 
[[image:2023_Remote-Scripting-Setup_02_How-To_08.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_08.png]]
<br><br>
 
 
* With the extension downloaded you will need to close Visual Studio in order for the install to take place
 
[[image:2023_Remote-Scripting-Setup_02_How-To_09.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_09.png]]
<br><br>
 
 
* Once Visual Studio closes the VSIX installer will launch. Click modify to begin the installation of the extension.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_10.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_10.png]]
<br><br>
 
 
* Once the installation completes you can close the VSIX installer.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_11.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_11.png]]
<br><br>
 
 
# Re-launch Visual Studio as an administrator and in the "Extensions" menu you will notice a "Grooper" sub-menu. We'll worry about this later.
# For now click "Manage Extensions"
 
[[image:2023_Remote-Scripting-Setup_02_How-To_12.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_12.png]]
<br><br>
 
==== Turn Off Automatic Updates ====
The default setting for the '''Grooper SDK''' as an extension in Visual Studio is to automatically update. It is suggested by the development team to disable this option.
The default setting for the '''Grooper SDK''' as an extension in Visual Studio is to automatically update. It is suggested by the development team to disable this option.


The '''Grooper SDK''' will not get updated frequently, but if it does, you do not want to automatically download the update as it would facilitate installing a new sub-version of '''Grooper'''. If your environment is stable it is best practice to not introduce unknown variables that may interfere with your setup.
The '''Grooper SDK''' will not get updated frequently, but if it does, you do not want to automatically download the update as it would necessistate installing a new sub-version of '''Grooper'''. If your environment is stable it is best practice to not introduce unknown variables that may interfere with your setup.
<br>
 
# In the "Manage Extensions" window of Visual Studio, click the "Installed" section.
# Click the "GrooperSDK"
# Uncheck the "Automatically update this extension" setting.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_13.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_13.png]]
<br><br>
 
==== Set a Debug Target Page ====
When debugging and testing your scripts the default page that will open in your browser will be the '''Grooper''' "Home" page. If you want to set this to a different page to save time, you can change the debug target to whichever page you prefer.
 
# Click the "Tools" menu in Visual Studio
# Click "Options" from the list
 
[[image:2023_Remote-Scripting-Setup_02_How-To_14.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_14.png]]
<br><br>
 
When debugging and testing your scripts the default page that will open in your browser will be the '''Grooper''' "Home" page. If you want to set this to a different page to save time, you can change the debug target to whichever page you prefer.
 
<br>
# Select "Grooper" from the list.
# Select a "Debug Target" from the drop-down list of the "Start Page" property.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_15.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_15.png]]


Line 104: Line 174:


In the following example an '''Object Library''' will be created and a [https://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] script applied to it.
In the following example an '''Object Library''' will be created and a [https://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] script applied to it.
<br><br>
 
Follow the instructions in the screenshots below.
Follow the instructions in the screenshots below.
<br><br>
 
* In your web browser (Chrome, Firefox, or MS Edge) put in the url:
*: <code>localhost/grooper</code>
*: Do not use the: <code>(hostname)/grooper</code> normal convention.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_16.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_16.png]]
<br><br>
 
 
# On the "Design" page of '''Grooper''', right-click on a '''Project'''
# Choose "Add" from the menu
# Select "Object Library" from the sub-menu
# Type a name for the object
# Click "Execute" to create the object
 
[[image:2023_Remote-Scripting-Setup_02_How-To_17.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_17.png]]
<br><br>
 
==== Create Custom Script Button ====
Because we are using the path <code>localhost/grooper</code> we are using the '''Grooper''' website that is hosted on this machine, which is a local site to this "Remote Scripting Computer". However, because the '''Grooper Repository''' connection is to the "Grooper Server", this local website is leveraging a '''Grooper Repository''' that is remotely hosted.
Because we are using the path <code>localhost/grooper</code> we are using the '''Grooper''' website that is hosted on this machine, which is a local site to this "Remote Scripting Computer". However, because the '''Grooper Repository''' connection is to the "Grooper Server", this local website is leveraging a '''Grooper Repository''' that is remotely hosted.
<br>
<br>
The "Create a custom script" button is only available to us because we are on a website that is local to this machine. If you use the standard <code>https://(hostname)/grooper</code> your browser is actually connected to a website that is remote, and as a result the "Create a custom script" button would be grayed out.
The "Create a custom script" button is only available to us because we are on a website that is local to this machine. If you use the standard <code>https://(hostname)/grooper</code> your browser is actually connected to a website that is remote, and as a result the "Create a custom script" button would be grayed out.
<br>
 
# On the "Design" page of '''Grooper''', select the newly created '''Object Library'''
# Click on the "Scripting" tab
# Click the "Create a custom script" button
# Select "C#" from the drop-down
 
[[image:2023_Remote-Scripting-Setup_02_How-To_18.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_18.png]]
<br><br>
 
 
* You will see the .sln and other associated files related to this project are made
 
[[image:2023_Remote-Scripting-Setup_02_How-To_19.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_19.png]]
<br><br>
 
==== Script Files Created in the Grooper Filestore ====
While we are accessing the '''Grooper Repository''' that lives on the "Grooper Server" via a local website, the files for the custom solution are still made in the '''Grooper Filestore''' that is part of the remote '''Grooper Repository''' on the "Grooper Server". Historically when you would edit scripts in '''Grooper''' it would be on the files in the '''Grooper Filestore''' of that repository. We don't want to do this however, so we will create a local copy of the created files that will live on this "Remote Scripting Computer" in the next steps.
While we are accessing the '''Grooper Repository''' that lives on the "Grooper Server" via a local website, the files for the custom solution are still made in the '''Grooper Filestore''' that is part of the remote '''Grooper Repository''' on the "Grooper Server". Historically when you would edit scripts in '''Grooper''' it would be on the files in the '''Grooper Filestore''' of that repository. We don't want to do this however, so we will create a local copy of the created files that will live on this "Remote Scripting Computer" in the next steps.
<br>
 
# On the "Design" page of '''Grooper''', with the newly created '''Object Library''' selected, if you go to the "Advanced" tab...
# ...you will see the script project files that are created for the object are stored in the "Grooper Filestore" for this repository.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_20.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_20.png]]
<br><br>
 
 
# Back on the "Scripting" tab...
# Click the "Download script to a local folder" button
# In the "Working Directory" dialog box that opens, notice the default directory. You can change it to whatever you want. '''Grooper''' will remember the path you set moving forward.
# Click "OK" to continue.
# The "Edit Script" dialog box will open with a prompt. Notice a sub-folder is made named after the object the solution lives on.
# Click "OK" to continue
 
[[image:2023_Remote-Scripting-Setup_02_How-To_21.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_21.png]]
<br><br>
 
==== Local Solution Files Copied ====
Now that the solution files of the custom script have been copied from the '''Grooper Filestore''' of the "Grooper Server", we can work on this solution locally and not worry about a connection to the "Grooper Server".
Now that the solution files of the custom script have been copied from the '''Grooper Filestore''' of the "Grooper Server", we can work on this solution locally and not worry about a connection to the "Grooper Server".
<br>
 
# If you open a File Explorer window and navigate to the path created...
# ...you will see the solution files have been copied from the "Grooper Filestore" from the "Grooper Server" to a local directory on your machine.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_22.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_22.png]]


=== Editing the Custom Script Solution ===
=== Editing the Custom Script Solution ===
In this next section we will add some code to our project.
In this next section we will add some code to our project.
<br>
 
Feel free to use the following code for your purposes.
Feel free to use the following code for your purposes.
<br>
 
{|
|
<code style="background-color: rgb(30,30,30); color:rgb(220, 220, 220); display:block; padding: 1.5em;">
<code style="background-color: rgb(30,30,30); color:rgb(220, 220, 220); display:block; padding: 1.5em;">
<span style="color: #569cd6; font-family: monospace">using</span> Grooper;<br>
<span style="color: #569cd6; font-family: monospace">using</span> Grooper;<br>
Line 153: Line 261:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #569cd6; font-family: monospace">public string</span> Description { <span style="color: #569cd6; font-family: monospace">get</span>; <span style="color: #569cd6; font-family: monospace">set</span>; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #569cd6; font-family: monospace">public string</span> Description { <span style="color: #569cd6; font-family: monospace">get</span>; <span style="color: #569cd6; font-family: monospace">set</span>; }<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #569cd6; font-family: monospace">protected override void</span> Execute(<span style="color: #4ec9b0; font-family: monospace">GrooperNode</span> <span style="color: #9ed8ff; font-family: monospace">"Item</span>)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #569cd6; font-family: monospace">protected override void</span> Execute(<span style="color: #4ec9b0; font-family: monospace">GrooperNode</span> <span style="color: #9ed8ff; font-family: monospace">Item</span>)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #9ed8ff; font-family: monospace">Item</span>.Description = Description;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #9ed8ff; font-family: monospace">Item</span>.Description = Description;<br>
Line 160: Line 268:
}<br>
}<br>
</code>
</code>
<br>
|}
The following image is used as an "IconResource" which you can choose to leverage to match what is being used. Be sure to rename it to "Tap.png" so the name matches the code.
 
<br>
The following image is used as an "IconResource" which you can choose to leverage to match what is being used. Be sure to rename it to "Tap.png" so the name matches the code. <span style="color: red;">THIS IS CASE SENSITIVE</span>.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_34_tap.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_34_tap.png]]
<br><br>
 
Follow the instructions in the screenshots below.
Follow the instructions in the screenshots below.
<br><br>
 
* Launch Visual Studio as an administrator and choose "Open a project or solution"
 
[[image:2023_Remote-Scripting-Setup_02_How-To_23.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_23.png]]
<br><br>
 
 
# Navigate to where you solution file is saved
# Select the file and click "Open"
 
[[image:2023_Remote-Scripting-Setup_02_How-To_24.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_24.png]]
<br><br>
 
 
# Right-click on the solution in the "Project Explorer"
# Choose "Add"
# Select "New Item..."
 
[[image:2023_Remote-Scripting-Setup_02_How-To_25.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_25.png]]
<br><br>
 
 
# Select the "C# Class" item
# Click the "Add" button (you can name the class before clicking "Add" if you choose)
 
[[image:2023_Remote-Scripting-Setup_02_How-To_26.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_26.png]]
<br><br>
 
 
# With the newly created class selected in the "Project Explorer"...
# ...feel free to set the name of the class (if you haven't already)
# Replace the existing text with the supplied sample code (or your own code if you're following along without the sample)
# Notice this portion of the script that has an "IconResource" named "Tap". We will address this next.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_27.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_27.png]]
<br><br>
 
==== Adding an Icon Resource ====
# Right-click the solution in the "Project Explorer"
# Select "Properties" from the menu
 
[[image:2023_Remote-Scripting-Setup_02_How-To_28.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_28.png]]
<br><br>
 
 
# From the solution properties...
# ...select the "Resources" menu
# Click the <code style="color:blue";>"This project does not contain a default resource file. Click here to create one.</code> prompt to create the requisite resource file.
 
[[image:2023_Remote-Scripting-Setup_02_How-To_29.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_29.png]]
<br><br>
 
 
# Click the "Add Resource" drop-down
# Select "Add Existing File..."
 
[[image:2023_Remote-Scripting-Setup_02_How-To_30.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_30.png]]
<br><br>
 
 
# In the File Explorer that opens, select the supplied image or select one of your choosing
# Click the "Open" button
 
[[image:2023_Remote-Scripting-Setup_02_How-To_31.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_31.png]]
<br><br>
 
 
# With the image file added...
# ...close the project properties
# Click "Save" when prompted
 
[[image:2023_Remote-Scripting-Setup_02_How-To_32.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_32.png]]
<br><br>
 
 
# From the "File" menu...
# ...be sure to "Save All" changes
 
[[image:2023_Remote-Scripting-Setup_02_How-To_33.png]]
[[image:2023_Remote-Scripting-Setup_02_How-To_33.png]]


=== Testing and Debugging ===
=== Testing and Debugging ===
With the script added, let's now test to see it working and see how we can set a break point for debugging purposes.
Follow the instructions in the screenshots below.
* Click the "Start" button to test
[[image:2023_Remote-Scripting-Setup_02_How-To_35.png]]
* An instance of IISExpress will launch and automatically minimize itself
[[image:2023_Remote-Scripting-Setup_02_How-To_36.png]]
* In the browser that launches (hopefully your default is set to a compatible browser like Chrome, Firefox, or MS Edge), from the "Home" page, go to the "Design" page
[[image:2023_Remote-Scripting-Setup_02_How-To_37.png]]
* Right-click on a node and you will see that our custom object command is working as intended. Select the "SetDescription..." custom command
[[image:2023_Remote-Scripting-Setup_02_How-To_38.png]]
# In the "Set Description" dialog box, you can set the '''''Description''''' property...
# ...and click "Execute" when finished
[[image:2023_Remote-Scripting-Setup_02_How-To_39.png]]
* On the node you ran the command from, you can see that a the '''''Description''''' property is successfully set. When done, feel free to close the browser.
[[image:2023_Remote-Scripting-Setup_02_How-To_40.png]]
==== Setting a Break Point for Debugging Purposes ====
* Back in the solution, set a break point on line 21 then re-run the script
[[image:2023_Remote-Scripting-Setup_02_How-To_41.png]]
# Back on the "Design" page of '''Grooper''', use the custom object command...
# ...type something for the '''''Description'''''
# ...click "Execute" and...
[[image:2023_Remote-Scripting-Setup_02_How-To_42.png]]
# <li value=4>...because of the break point you will be back in Visual Studio where you could make edits
[[image:2023_Remote-Scripting-Setup_02_How-To_43.png]]
# Clear the break point
# Then continue running the script
[[image:2023_Remote-Scripting-Setup_02_How-To_44.png]]
* The script will finish executing and the description will be set
[[image:2023_Remote-Scripting-Setup_02_How-To_45.png]]
=== Saving to Grooper and Compiling ===
The '''Grooper SDK''' extension has three commands:
* '''Save''' - This will take the files of the saved solution and "push" them to the original object in '''Grooper''', overwriting the script files on the object. You will need to go to the object in '''Grooper''' and run the compile command if you use this option. After compiling you will need to close your web browser, recycle the GrooperAppPool on the "Grooper Server", then reconnect to your '''Grooper''' site.
* '''Save and Compile''' - This will do what the ''Save'' command will do, but after "pushing" the files over it will immediately compile the script and create the associated .DLL and .XML descriptor file. After compiling you will need to close your web browser, recycle the GrooperAppPool on the "Grooper Server", then reconnect to your '''Grooper''' site.
* '''Get Latest''' - This command syncs with the published version of the code and updates your local code/binaries to the most up-to-date.
<br><br>
Follow the instructions in the screenshots below.
# Click the "Extensions" menu
# In the "Grooper" menu choose "Save"
# Click "Yes" in the confirmation prompt
# Click "OK" in the following window. Notice the prompt about needing to compile and restart processes.
[[image:2023_Remote-Scripting-Setup_02_How-To_46.png]]
* Navigate to your '''Grooper''' site. You can use the standard <code>(hostname)/grooper</code> path.
[[image:2023_Remote-Scripting-Setup_02_How-To_47.png]]
# Select the '''Object Library'''
# Go to the "Scripting" tab
# Click the "Compile Script" button
# In the "Compile Script" dialog box you should recieve a message informing of a successful compile
# Click "OK" to close the window
[[image:2023_Remote-Scripting-Setup_02_How-To_48.png]]
* With a successful compile you should now see the compiled .dll and its descriptor .xml file
[[image:2023_Remote-Scripting-Setup_02_How-To_49.png]]
# Go to the "Grooper Server" and launch "IIS Manager"
# Click on the "Application Pools"
# Right-click the "GrooperAppPool" and choose "Recycle..." from the drop-down menu
[[image:2023_Remote-Scripting-Setup_02_How-To_50.png]]
* With the "GrooperAppPool" recycled, go back to your '''Grooper''' site and notice the custom object command is now usable
[[image:2023_Remote-Scripting-Setup_02_How-To_51.png]]
==== Disabling a Compiled Script ====
# If you want to disable a compiled script, select the object library
# Go to the "Scripting" tab
# Click the "Disable Script" button
[[image:2023_Remote-Scripting-Setup_02_How-To_52.png]]
* This will remove the compiled .dll and it's .xml descriptor file
[[image:2023_Remote-Scripting-Setup_02_How-To_53.png]]
# Once again, go to the "Grooper Server" and launch "IIS Manager"
# Click the "Application Pools"
# Right-click the "GrooperAppPool" and choose "Recycle..." from the drop-down menu
[[image:2023_Remote-Scripting-Setup_02_How-To_54.png]]
# With the script disabled and the "GrooperAppPool" reset, we can choose to delete the '''Object Library", or...
# ...go back to it's "Scripting" tab...
# ...and click the trash can icon to delete all files related to the script and start over.


[[Category:Articles]]
[[image:2023_Remote-Scripting-Setup_02_How-To_55.png]]
[[Category:Version 2023.1]]

Latest revision as of 16:54, 23 September 2025

This article is about an older version of Grooper.

Information may be out of date and UI elements may have changed.

20252023.1

This article seeks to elucidate the requirements for setup of remote scripting in Grooper 2023.1.

About

.Net scripting is a fantastic way to expand the capabilities of Grooper but has historically been a procedure that was inherently tied to the machine that Grooper is installed on.

With Grooper 2023.1 scripting can now be done on a remote computer, compiled, and thanks to the Grooper SDK, uploaded to the Grooper server.

Things You Can't Do In Web

It's important to understand the thick client and web client are essentially two different user interfaces for Grooper. While the functionality is similar, there are necessarily differences in how Grooper is programed to function when installed and running using a machine's operating system versus how Grooper is programed to function using web calls.

Due to this, there are certain things that scripts may have been able to accomplish in the thick client that they cannot in the web client or will need to be rewritten with web functionality in mind.

Field Entry and Exit in Data Model Scripts

The web client does not register an event for when a Data Field is entered or when it is exited in a Review step's Data Viewer. Therefore, you cannot script events based around field entry or exit in the web client.

Windows Dialog Box

Windows dialog boxes are not supported through Grooper in a web browser.

Understanding the Environment

Before we dive into how things are setup, let's take a look at what parts make up the demonstration environment. Variables in your environment will obviously be slightly different, but this is a basic setup that should work as a reasonable template.

Grooper Server

This is the main server that is hosting everything Grooper, and as such will be referred to as "Grooper Server". The following components are installed on this machine.

  • Grooper Software
    • Grooper software is installed on this computer normally. For more information on installing Grooper please visit the Install and Setup article.
  • Grooper Web Server
    • The Grooper Web Client is installed on this "Grooper Server" (along with the requisite installation and appropriate configuration of IIS) to allow remote computers to access the Grooper environment remotely without having to have Grooper installed on their machines.
  • Grooper Repository
    • The infrastructure that establishes a repository of information that the Grooper application points to consists of the following pieces that are also installed on this "Grooper Server":
      • Grooper Filestore
        • Files associated with objects in Grooper reside here. This is a file directory located on this "Grooper Server"
      • SQL Server
        • Objects and their configurations are stored in tables in a SQL database that make the backbone of a Grooper repository.

Remote Scripting Computer

This is a generic workstation used by a developer wanting to do scripting for Grooper that is on the same network the "Grooper Server" is on, but it is not itself the "Grooper Server". The following Components are installed on this machine.

  • Grooper Software
    • This is installed on the computer because of the need to access Grooper code for the developer when compiling. SQL server is not installed on this machine, neither is the Filestore for Grooper so it is pointed at the remote repository (the repository hosted on the "Grooper Server") via Grooper Config.
  • Grooper Web Client
    • The Grooper Web Client is installed on the developer's machine so that they can have a debug target when creating their scripts. This is not the main webpage users will interact with to access Grooper. IIS is installed on this machine to facilitate the appropriate installation of the Grooper Web Client, but IIS Express (which is side-loaded when the Grooper SDK is added to Visual Studio) will actually be leveraged upon testing and debugging of scripts.
  • Visual Studio - with Grooper SDK
    • Visual Studio 2019 is the supported version for developing with Grooper 2023.1. From Visual Studio you can download and install the Grooper SDK.

Understanding Both

We have the "Grooper Server" and we have the "Remote Scripting Computer" and their requisite components on each. As stated, the Grooper Software and the Grooper Web Client are installed on the "Remote Scripting Computer" but the Grooper Repository is established on the "Grooper Server". The "Remote Scripting Computer" is simply referencing the repository as it exists on the "Grooper Server".

How To

With an understanding of what is established in this defacto environment we will now walk through the setup of creating, compiling, and sending a script to Grooper from a remote computer.

Establishing a Connection to the "Grooper Server" from the "Remote Scripting Computer"

As discussed, the "Remote Scripting Computer" has Grooper 2023.1, the Grooper Web Client, and Visual Studio 2019 installed, but itself is not hosting a Grooper repository. We will configure this machine to point at the Grooper repository that is being hosed by the "Grooper Server".

Follow the instructions in the screenshots below.

  • Because Grooper Config has not been run on this computer before, it will need to create its requisite .cfg file that stores its configuration settings.


  • With Grooper Config properly initialized (the requisite .cfg file was made), select the "Repositories" property and click the ellipsis button to configure a connection to a Grooper repo.


  1. In the "Repositories" window that appears, click the "Add" button.
  2. A connection entry ill be added to the list.
  3. Enter connection info to the "Grooper Server" including "Server Name" and "Database Name"
  4. Enter "Authentication" info. In this case the active Windows user has access to the database, so the properties are left blank.
  5. Test the connection to verify settings.
  6. Click "OK" in the "Information" box.
  7. Click "OK" once the connection is established.


  1. With a connection established the "Repositories" property will list the connection.
  2. With only one connection made it will be the default, otherwise verify your "Default Repository"
  3. Click "Save" once settings are confirmed

Installing and Configuring the Grooper SDK

We now have the ability to connect to the Grooper Repository hosted by the "Grooper Server", but before we do any work in Grooper, let's jump into Visual Studio to install and configure the Grooper SDK.

Follow the instructions in the screenshots below.

  • Launch Visual Studio as an administrator


  • For now, continue without code


  1. Click the "Extensions" menu
  2. Choose "Manage Extensions"


  1. Search for "Grooper"
  2. Select "GrooperSDK" and click "Download"


  • With the extension downloaded you will need to close Visual Studio in order for the install to take place


  • Once Visual Studio closes the VSIX installer will launch. Click modify to begin the installation of the extension.


  • Once the installation completes you can close the VSIX installer.


  1. Re-launch Visual Studio as an administrator and in the "Extensions" menu you will notice a "Grooper" sub-menu. We'll worry about this later.
  2. For now click "Manage Extensions"

Turn Off Automatic Updates

The default setting for the Grooper SDK as an extension in Visual Studio is to automatically update. It is suggested by the development team to disable this option.

The Grooper SDK will not get updated frequently, but if it does, you do not want to automatically download the update as it would necessistate installing a new sub-version of Grooper. If your environment is stable it is best practice to not introduce unknown variables that may interfere with your setup.

  1. In the "Manage Extensions" window of Visual Studio, click the "Installed" section.
  2. Click the "GrooperSDK"
  3. Uncheck the "Automatically update this extension" setting.

Set a Debug Target Page

When debugging and testing your scripts the default page that will open in your browser will be the Grooper "Home" page. If you want to set this to a different page to save time, you can change the debug target to whichever page you prefer.

  1. Click the "Tools" menu in Visual Studio
  2. Click "Options" from the list


  1. Select "Grooper" from the list.
  2. Select a "Debug Target" from the drop-down list of the "Start Page" property.

Creating an Object Library and Local Project Files

There are five objects in Grooper where you can apply a custom script:

  • Batch Process
  • Data Model
  • Data Table
  • Data Type
  • Object Library

In the following example an Object Library will be created and a C# script applied to it.

Follow the instructions in the screenshots below.

  • In your web browser (Chrome, Firefox, or MS Edge) put in the url:
    localhost/grooper
    Do not use the: (hostname)/grooper normal convention.


  1. On the "Design" page of Grooper, right-click on a Project
  2. Choose "Add" from the menu
  3. Select "Object Library" from the sub-menu
  4. Type a name for the object
  5. Click "Execute" to create the object

Create Custom Script Button

Because we are using the path localhost/grooper we are using the Grooper website that is hosted on this machine, which is a local site to this "Remote Scripting Computer". However, because the Grooper Repository connection is to the "Grooper Server", this local website is leveraging a Grooper Repository that is remotely hosted.
The "Create a custom script" button is only available to us because we are on a website that is local to this machine. If you use the standard https://(hostname)/grooper your browser is actually connected to a website that is remote, and as a result the "Create a custom script" button would be grayed out.

  1. On the "Design" page of Grooper, select the newly created Object Library
  2. Click on the "Scripting" tab
  3. Click the "Create a custom script" button
  4. Select "C#" from the drop-down


  • You will see the .sln and other associated files related to this project are made

Script Files Created in the Grooper Filestore

While we are accessing the Grooper Repository that lives on the "Grooper Server" via a local website, the files for the custom solution are still made in the Grooper Filestore that is part of the remote Grooper Repository on the "Grooper Server". Historically when you would edit scripts in Grooper it would be on the files in the Grooper Filestore of that repository. We don't want to do this however, so we will create a local copy of the created files that will live on this "Remote Scripting Computer" in the next steps.

  1. On the "Design" page of Grooper, with the newly created Object Library selected, if you go to the "Advanced" tab...
  2. ...you will see the script project files that are created for the object are stored in the "Grooper Filestore" for this repository.


  1. Back on the "Scripting" tab...
  2. Click the "Download script to a local folder" button
  3. In the "Working Directory" dialog box that opens, notice the default directory. You can change it to whatever you want. Grooper will remember the path you set moving forward.
  4. Click "OK" to continue.
  5. The "Edit Script" dialog box will open with a prompt. Notice a sub-folder is made named after the object the solution lives on.
  6. Click "OK" to continue

Local Solution Files Copied

Now that the solution files of the custom script have been copied from the Grooper Filestore of the "Grooper Server", we can work on this solution locally and not worry about a connection to the "Grooper Server".

  1. If you open a File Explorer window and navigate to the path created...
  2. ...you will see the solution files have been copied from the "Grooper Filestore" from the "Grooper Server" to a local directory on your machine.

Editing the Custom Script Solution

In this next section we will add some code to our project.

Feel free to use the following code for your purposes.

using Grooper;
using Grooper.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace SetDescription
{
    [DataContract, IconResource("Tap"), DisplayName("SetDescription")]
    public class ObjectCommand : ObjectCommand<GrooperNode>
    {
        [DataMember, Viewable, Required]
        public string Description { get; set; }

        protected override void Execute(GrooperNode Item)
        {
            Item.Description = Description;
        }
    }
}

The following image is used as an "IconResource" which you can choose to leverage to match what is being used. Be sure to rename it to "Tap.png" so the name matches the code. THIS IS CASE SENSITIVE.

Follow the instructions in the screenshots below.

  • Launch Visual Studio as an administrator and choose "Open a project or solution"


  1. Navigate to where you solution file is saved
  2. Select the file and click "Open"


  1. Right-click on the solution in the "Project Explorer"
  2. Choose "Add"
  3. Select "New Item..."


  1. Select the "C# Class" item
  2. Click the "Add" button (you can name the class before clicking "Add" if you choose)


  1. With the newly created class selected in the "Project Explorer"...
  2. ...feel free to set the name of the class (if you haven't already)
  3. Replace the existing text with the supplied sample code (or your own code if you're following along without the sample)
  4. Notice this portion of the script that has an "IconResource" named "Tap". We will address this next.

Adding an Icon Resource

  1. Right-click the solution in the "Project Explorer"
  2. Select "Properties" from the menu


  1. From the solution properties...
  2. ...select the "Resources" menu
  3. Click the "This project does not contain a default resource file. Click here to create one. prompt to create the requisite resource file.


  1. Click the "Add Resource" drop-down
  2. Select "Add Existing File..."


  1. In the File Explorer that opens, select the supplied image or select one of your choosing
  2. Click the "Open" button


  1. With the image file added...
  2. ...close the project properties
  3. Click "Save" when prompted


  1. From the "File" menu...
  2. ...be sure to "Save All" changes

Testing and Debugging

With the script added, let's now test to see it working and see how we can set a break point for debugging purposes.

Follow the instructions in the screenshots below.

  • Click the "Start" button to test


  • An instance of IISExpress will launch and automatically minimize itself


  • In the browser that launches (hopefully your default is set to a compatible browser like Chrome, Firefox, or MS Edge), from the "Home" page, go to the "Design" page


  • Right-click on a node and you will see that our custom object command is working as intended. Select the "SetDescription..." custom command


  1. In the "Set Description" dialog box, you can set the Description property...
  2. ...and click "Execute" when finished


  • On the node you ran the command from, you can see that a the Description property is successfully set. When done, feel free to close the browser.

Setting a Break Point for Debugging Purposes

  • Back in the solution, set a break point on line 21 then re-run the script


  1. Back on the "Design" page of Grooper, use the custom object command...
  2. ...type something for the Description
  3. ...click "Execute" and...


  1. ...because of the break point you will be back in Visual Studio where you could make edits


  1. Clear the break point
  2. Then continue running the script


  • The script will finish executing and the description will be set

Saving to Grooper and Compiling

The Grooper SDK extension has three commands:

  • Save - This will take the files of the saved solution and "push" them to the original object in Grooper, overwriting the script files on the object. You will need to go to the object in Grooper and run the compile command if you use this option. After compiling you will need to close your web browser, recycle the GrooperAppPool on the "Grooper Server", then reconnect to your Grooper site.
  • Save and Compile - This will do what the Save command will do, but after "pushing" the files over it will immediately compile the script and create the associated .DLL and .XML descriptor file. After compiling you will need to close your web browser, recycle the GrooperAppPool on the "Grooper Server", then reconnect to your Grooper site.
  • Get Latest - This command syncs with the published version of the code and updates your local code/binaries to the most up-to-date.



Follow the instructions in the screenshots below.

  1. Click the "Extensions" menu
  2. In the "Grooper" menu choose "Save"
  3. Click "Yes" in the confirmation prompt
  4. Click "OK" in the following window. Notice the prompt about needing to compile and restart processes.


  • Navigate to your Grooper site. You can use the standard (hostname)/grooper path.


  1. Select the Object Library
  2. Go to the "Scripting" tab
  3. Click the "Compile Script" button
  4. In the "Compile Script" dialog box you should recieve a message informing of a successful compile
  5. Click "OK" to close the window


  • With a successful compile you should now see the compiled .dll and its descriptor .xml file


  1. Go to the "Grooper Server" and launch "IIS Manager"
  2. Click on the "Application Pools"
  3. Right-click the "GrooperAppPool" and choose "Recycle..." from the drop-down menu


  • With the "GrooperAppPool" recycled, go back to your Grooper site and notice the custom object command is now usable

Disabling a Compiled Script

  1. If you want to disable a compiled script, select the object library
  2. Go to the "Scripting" tab
  3. Click the "Disable Script" button


  • This will remove the compiled .dll and it's .xml descriptor file


  1. Once again, go to the "Grooper Server" and launch "IIS Manager"
  2. Click the "Application Pools"
  3. Right-click the "GrooperAppPool" and choose "Recycle..." from the drop-down menu


  1. With the script disabled and the "GrooperAppPool" reset, we can choose to delete the Object Library", or...
  2. ...go back to it's "Scripting" tab...
  3. ...and click the trash can icon to delete all files related to the script and start over.