Purpose
Display data read via a web service

Solution
Call up the web service via CopyText and a suitable URL

Compared to a solution via JavaScript or VB, the CopyText approach is easy to implement, although not sufficient for advanced applications.

As an example we translate a text using the "deepl.com" API.

InputScript

// text to translate (example from Wikipedia)

Set V[mytext1] "Thomas Alva Edison (February 11, 1847 – October 18, 1931) was an American inventor and businessman who has been described as America's greatest inventor. He developed many devices in fields such as electric power generation, mass communication, sound recording, and motion pictures. These inventions, which include the phonograph, the motion picture camera, and early versions of the electric light bulb, have had a widespread impact on the modern industrialized world.[5] He was one of the first inventors to apply the principles of organized science and teamwork to the process of invention, working with many researchers and employees. He established the first industrial research laboratory."

 

 

// build deepl-URL (we use a free developer key)

Set V[url] "https://api-free.deepl.com/v2/translate?auth_key=6f7a5e2d-8989-ae5e-998f-132d9dxxxxxx:fx&source_lang=EN&target_lang=DE&text=<GuiXT>&V[mytext1]<GuiXT>"

 

 

// translate

CopyText fromFile="&V[url]" toText="result"

 

 

// extract translated text from JSON format (Alternative: JavaScript/VB call)

Set text[delimiter] "X"

ReplaceText "delimiter" from="X" toHexCode="1A"

ReplaceText "result" from="<GuiXT>" to="&text[delimiter]"

CopyText fromText="result" toString="mytext2" line=2 delimiter="&text[delimiter]"

 

 

// display text

Message "&V[mytext2]"

 

 

Return

 

 

Components
InputAssistant + Controls