Skip to content

Scripts

Some features of a configuration rely on scripts which can reproduce all actions performed by a user facing his/her screen. Scripts allow to configure an application already installed on devices or a device parameter in order to extend Genydeploy abilities. In addition, for some features of Genydeploy, creating a script is required and integrated into features. This chapter details how to create those two types of scripts.

Creating a custom script

The Set app or service feature allows you to configure an application already installed on devices or a device parameter using a custom script. Using this feature, you can:

  • Enroll an EMM application (enterprise mobility management)
  • Preconfigure a third application
  • Modify system settings

To create a custom script:

  1. Click Add and Set app or service.
  2. In Name, give the script a relevant name.
  3. Select the tab of the device model you wish to configure.
  4. Configure the script using commands listed in the right-hand panel. The use of each command is detailed in the Commands section.
  5. At anytime during script creation, you can test all or part of the script by selecting the commands to be tested and clicking Test. Commands being tested are then highlighted. You can abort the test by clicking Stop.
  6. If your script runs properly, click Add to script library.
  7. Repeat those steps for other device models.
  8. Click Apply.

Creating an integrated script

Some features of Genydeploy require the creation of a script in order to be deployed. These features are:

Install app from Play Store

Installs an application from Google Play Store.

Add APN

Creates a network access point name.

Add Google, MobileIron, Airwatch, Knox account

Configures an account provided by a major EMM.

Add custom account

Assigns a device to a user.

Factory reset

Restores devices to their factory state.

To create an integrated script:

  1. Click and select the feature for which you wish to create a script.
  2. Select the tab of the device model you wish to configure.
  3. In Script Library, select the script with the match rate closest to your device model.1
  4. Create or complete the script using commands listed in the right-hand panel. The use of each command is detailed in the Commands section.

    Tip

    • When a command is added, you can drag and drop it in order to run the script in the order of your choice.
    • By clicking ic_preview_hover , you can view a screenshot of the device highlighting the area on which a command has been initiated.
    • The Expert mode allows users with good knowledge of script edition to write their script directly in XML.
  5. At anytime during script creation, you can test all or part of the script by selecting the commands to be tested and by clicking Test. Commands being tested are then highlighted. You can abort the test by clicking Stop.

  6. If your script runs properly, click Add to script library.
  7. Repeat those steps for other device models.
  8. Click Apply.

Commands

The 'Export' button generates an archive containing the data displayed in the script editor. If needed, you can send that file to Genydeploy customer service.

This section lists commands that can be used to create a script:

sleep

The sleep command allows you to temporize a command before switching to the next one:

  1. Click Sleep.
  2. In Seconds, specify the duration to wait before running the next command.
  3. Click Insert.
text

The text command allows you to type text in a text input area:

  1. Click Text.
  2. From your device, go to the screen on which you want to enter some text content.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, select a text input area. Id, Class, Index and Instance fields automatically retrieve the values corresponding to the text input area.
  5. In Text, enter your text.
  6. Click Insert.
while

The while command allows you to wait for an element to disappear or change state. This command is useful when you need to wait for a page download to be complete in order to continue:

  1. Click While.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, select the element with which you want to interact (a progress bar, a checkbox, an on/off button, a text field). Id, Class, Index and Instance fields automatically retrieve the values corresponding to the element.
  5. From the Test dropdown list, select the test to be performed on the element:

    • verify whether the element exists (exists) or not (!exists)
    • verify whether the element is enabled (enabled) or not (!enabled)
    • verify whether a checkbox is checked (checked) or not (!checked)
    • verify whether the text contained in the element is identical (compare) or different (!compare) from the text contained in the compare parameter.
  6. Click Insert.

tap

The tap command simulates a pressure on a button or allows you to activate the focus in a window (example: a popup window) at given coordinates:

  1. Click Tap.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, click where you want to simulate a finger pressure.
  5. Click Insert.
drag

The drag command simulates the motion of an element such as an icon or a list item between two points of the screen:

  1. Click Drag.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, click on the element to be moved and drag it to the destination location.
  5. In the Duration field, you can specify a value that defines the pace of the motion. By default, this value is set to 55. Increase the value to get a slower motion or decrease it to get a faster motion. This parameter is optional. We recommend not to change the default value.
  6. Click Insert.
exit

The exit command allows you to stop a script during its execution depending on its status (success or failure):

  1. Click Exit.
  2. From the State dropdown list, select the state in which the script execution must be stopped (success or fail).
  3. In Message, enter the text to be displayed when the script execution is stopped. This value is optional.
  4. Click Insert.
parent

The parent command allows you to define the parent element in which you wish to perform actions. This command is useful when several groups exist and that you wish to reach an element within one group:

  1. Click Parent.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, click the parent element of the one with which you want to interact. Id, Class, Index and Instance fields automatically retrieve the values corresponding to the element.
  5. In Label, you can directly specify the text content of the object as it appears on the screen. This value is optional.
  6. Click Insert.
file

The file command creates a file dynamically and stores it at the location of your choice:

  1. Click File.
  2. In Destination path, enter the file destination path.
  3. In File content, enter the file content. This content can be entered manually or using the available variables at the bottom of the window. Variables are linked either to a device property or to a property of the opened feature.
  4. Click Insert.
launch

The launch command launches an application:

  1. Click Launch.
  2. From the Action dropdown list, select the name of the action to launch.
  3. From the Component dropdown list, select the name of the activity to launch.
  4. In Data, enter the value corresponding to the URI of the content needed by the launched application.
  5. In MIME type, enter the value corresponding to the MIME type of the data described in the data attributes. This value is optional.
  6. Click Add extra to apply a child tag. Enter the information related to the activity in fields Name and Value. These values are optional.
  7. Click Insert.
click

The click command simulates a click on an element of the screen:

  1. Click Click.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, click on the element with which you want to interact. Id, class, index and instance fields automatically retrieve the values corresponding to the element.
  5. In Label, you can directly specify the text content of the object as it appears on the screen. This value is optional.
  6. By enabling Wait for new window, you can request the script to wait for a new window before running the next instruction. This parameter is optional and does not do anything if Long click is enabled.
  7. By enabling Long click, you can request the script to perform a long click on the item instead of a simple click. This parameter is optional.
  8. Click Insert.
if

The if command allows you to perform actions under certain conditions only. This command is useful to intercept events that occur only once (example: a confirmation window):

  1. Click If.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, select the element you want to test. Id, class, index and instance fields automatically retrieve the values corresponding to the element.
  5. In Label, you can directly specify the text content of the object as it appears on the screen. This value is optional.
  6. From the Test dropdown list, select the test to be performed on the element:

    • verify whether the element exists (exists) or not (!exists).
    • verify whether the element is enabled (enabled) or not (!enabled).
    • verify whether a checkbox is checked (checked) or not (!checked).
    • verify the value contained in the value parameter (value or !value)2.
    • verify whether the text contained in the element is identical (compare) or different (!compare) from the text contained in the compare parameter3.
  7. Click Insert.

swipe

The swipe command simulates a finger movement between two points of the screen:

  1. Click Swipe.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, click at a departure point and drag to a destination point.
  5. In the Duration field, you can specify a value that defines the pace of the swipe. By default, this value is set to 55. Increase the value to get a slower swipe or decrease it to get a faster swipe. This parameter is optional. We recommend not to change the default value.
  6. Click Insert.
scroll

The scroll command allows you to scroll the display. If a list is too long to be contained within the screen, elements not visible are not loaded in the memory and the script cannot detect them. Scrolling allows you to display the new elements:

  1. Click Scroll.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, select the area to scroll. Id, class, index and instance fields automatically retrieve the values corresponding to the area.
  5. In Label, you can directly specify the text content of the object to scroll as it appears on the screen. This value is optional.
  6. In the Direction dropdown list, select the direction of the scroll (forward, backward, end, beginning).
  7. In the Duration field, you can specify a value that defines the pace of the scroll. By default, this value is set to 55. Increase the value to get a slower scroll or decrease it to get a faster scroll. This parameter is optional. We recommend not to change the default value.
  8. Click Insert.
key

The key command simulates a keyboard event on the device:

  1. Click Key.
  2. From the Key dropdown list, select a keyboard event.
  3. In Repeat, enter the number of times the action must be repeated. This parameter is optional.
  4. Click Insert.
orientation

The orientation command defines the orientation in which the device must be to perform the script.

To use this command:

  1. Click Orientation.
  2. From the Value dropdown list, select the orientation of the device (left, right, natural).
  3. Click Insert.
broadcast

The broadcast command sends information to an activity within an application:

  1. Click Broadcast.
  2. From the Action dropdown list, select the name of the activity to call.
  3. From the Component dropdown list, select the name of the class to call.
  4. In Data, enter the value corresponding to the URI of the content needed by the called application.
  5. In MIME type, enter the value corresponding to the MIME type of the data described in the data attributes. This value is optional.
  6. Click Add extra to apply a child tag. Enter the information related to the activity in fields Name and Value. These values are optional.
  7. Click Insert.
catch

The catch command allows you to perform actions if an exceptional event occurs, preventing the proper execution of the script. Once it has failed, the script attempts to run the catch command before resuming where it failed. If the script succeeds to proceed with its execution, then the exceptional event has been handled by the catch command.

Example

During the execution of the script, a window pops up, preventing the script to proceed with its execution.

Using the catch command, you perform the actions necessary to close the popup window. When the script fails, it attempts to run the catch command before resuming where it stopped. If the script succeeds to proceed with its execution, then it means that the popup has been closed.

To use this command:

  1. Click Catch.
  2. From your device, go to the screen on which you want to interact.
  3. Click Refresh to view the device in the script editor.
  4. On the displayed device, select the element you want to test. Id, class, index and instance fields automatically retrieve the values corresponding to the element.
  5. In Label, you can directly specify the text content of the object as it appears on the screen. This value is optional.
  6. Click Insert.
comment

The comment command allows you to insert a comment within the script scenario:

  1. Click Comment.
  2. In field Text, insert the text of your comment.
  3. Click Insert.

  1. Cloud scripts are the ones pre-configured in Genydeploy while local scripts are the ones that you previously added to the script library. 

  2. If you use the "value" test, you must add a "value" parameter which contains the value to be tested. 

  3. If you use the "compare" test, you must add a "compare" parameter which contains the text you want to compare. This field can be an empty string. 

Back to top