R / Python Apleno Designer Functions
These functions are useful in every step of an Apleno Designer app.
Functions
rpgm.addToEndScreen(filepath)
Adds a file to the list in the final end step. Path can be absolute or relative to your program directory.
rpgm.appVersion()
Returns the latest version found in the latest app's project changelog entry. If no version exists, returns an empty string.
rpgm.executeInPython(code)
R only. Executes the code string in Python.
rpgm.executeInR(code)
Python only. Executes the code string in R.
rpgm.isServer()
Returns TRUE if the app is executed on Apleno Server, FALSE otherwise.
rpgm.notification(type, message, duration = 5000)
Displays a notification in the bottom right corner of the screen. The
notification lasts duration milliseconds and displays message. type can
be:
"error"for a red message;"info"for a blue message;"success"for a green message.
rpgm.off(message, callback)
Removes a callback function previously registered with rpgm.on().
rpgm.on(message, callback)
Sets a callback function when Apleno emits a new event. Currently, there are 3 events:
didReceiveMessage: when receiving a message from another language like JavaScript, Python or R;didUserConnect: when the user connected to the app instance;didUserInitialized: when the user is connected to the app instance and has finished loading JavaScript files.
The callback argument is a function that will be called when the message is
emitted.
rpgm.open(file)
- In Apleno Client, opens a
filewith the default associated program. - In Apleno Server, depending on the file type, it will either open the file in a new browser tab or will download the file.
Please note that the file must be in the output folder or the app folder of the app.
rpgm.outputFile(filename)
Returns an absolute path to a named filename in the output directory.
rpgm.outputFileURL(filename)
Mainly used in Apleno Server, this function returns the full URL to a file named
filename in the output directory.
rpgm.pgmFilePath(filename)
Returns an absolute path to a named filename in the program directory.
rpgm.playSound(sound)
Plays a sound. Sound can be either "success" or "error".
rpgm.setNextSequence(step)
Sets the next step of the sequence to the specified Step.
rpgm.sendEmail(to, subject, text = "", html = "", cc = "", bcc = "", attachments = list(), replyto = "")
Apleno Server only. Sends an email. to, subject are mandatory. Either text
or html should be used (both is also possible).
tois the recipient's email address;subjectemail subject;textplain text content of the email;htmlHTML content of the email;ccandbccother addresses to send the email to;attachmentsalist()of files to include in the email. Each file is alistwithfilenameand apathproperties. For example:list(filename="report.pdf", path="rpgm.outputFile("doc.pdf");replytoan email address to respond to.
rpgm.sendToClipboard(value, headers=FALSE)
Sends a value to the user's clipboard. If sending an R dataframe, setting
headers to TRUE will also include the data frame's headers.
Note
For this to work on Apleno Server, you have to be on HTTPS.
rpgm.sendToJavascript(message, value)
Sends a message packet to JavaScript, with message as a string and a list of
values in value.
rpgm.sendToPython(variableName, content)
Creates a variable variableName in Python with content content.
rpgm.step(file, stepid)
Creates a Step object, used in a lot of GUI functions.
rpgm.userEmail()
Returns a string with the email address of the user. On Apleno Server, it's the email associated to the user. On RPGM, it's the email of the connected user. If the user is not connected, it returns an empty string.
rpgm.userName()
Returns the name of the current user. On Apleno Server, it's the name of the user as defined in its account settings. On Apleno Client, it's the Windows/Linux/MacOS username.
rpgm.version()
Returns a string containing the version of Apleno Client or Apleno Server.