Functions: Difference between revisions
Jump to navigation
Jump to search
m (43 revisions imported) |
No edit summary |
||
| Line 159: | Line 159: | ||
Now if we want to get ''size'' of a product from the list above, we call as follows: | Now if we want to get ''size'' of a product from the list above, we call as follows: | ||
<code>[GetWord("things","milk","Size")]</code> - Result would be ''1 Gallon'' | <code>[GetWord("things","milk","Size")]</code> - Result would be ''1 Gallon'' | ||
== Get Request == | |||
* <code>[LINKS.LHttp.Get("https://maker.ifttt.com/trigger/{event}/with/key/REPLACE_ME","Say this on success","Say this on error or {error} to get actual error message.","WaitTimeInMS")]</code> | |||
== Get Response == | |||
* <code>[LINKS.LHttp.GetResponse("http://ai-dot.net/test.txt","unused","Say this on error or {error} to get actual error message.")]</code> | |||
== Put Request == | |||
* <code>[LINKS.LHttp.Put("{"on":"true"}","http://<hueIPAddress>/api/<applicationAPIkey>/lights/1/state")]</code> | |||
== Post Request == | |||
* <code>[LINKS.LHttp.Post("url","contentToPost","JSON_Formatted_Headers","returnContentType_bydefault it's application/json")]</code> | |||
Revision as of 13:26, 23 September 2016
Go here to see what a Function is.
Speak
All speak functions output can be randomized by using ; in the phrase.
- Basic Speaking function
[Speak("Phrase")]
- Speaks using specified values, allows you to change volume but is SYNCHRONOUS ONLY so it will NOT STOP the speech - blocks the flow
[SpeakEx("Phrase","Volume","Rate","VoiceName")]
- Phrase:
Phrase to speak - Volume:
0 - 100 - Rate:
-10 to 10 - VoiceName:
full voice name (case sensitive) (e.g. Microsoft Zira Desktop or Microsoft David Desktop etc..)
- Phrase:
- Speaks from LINKS using a text file as source using Web Service
[LINKS.LExecute.SpeakTextFileFromLINKS("c:\temp\test.txt")]
- Speaks from LINKS using a text file as source
[GetFile("c:\temp\test.txt")]
- Putting this in UI will allow LINKS to speak the text file.
- Sets speech volume
[SetSpeechVolume("volume")]
- volume:
0 - 100
- volume:
- Change voice
[SetSpeechVoice("VoiceName")]
- VoiceName:
Full name of the voice to be used for speech; case sensitive
- VoiceName:
Gets data from a file
[GetFile("c:\test.txt")]
- If file path is not defined and uses %APPDATA%\LINKS\Data\Strings as the default directory.
- In web request we can add
&output=responseto see plain text response in browser.
Executes any non-dynamic (non-WordList) commands
[CallCommand("Command")]
- Command:
any command from user interface
- Command:
Executes an external programs or run as shell command action
[RunAsShell("Shell Action","Response after execution","Response before confirmation","Response on fail")]
Executes a shell command with voice name and volume specified
[RunAsShell("Shell Action","Response After Execution","Response Before Confirmation","Response Failed","VoiceVolume,"VoiceName")]
- VoiceName:
Full name of the voice to be used for speech - VoiceVolume:
0 - 100 - If voice change does not work, then leave voice name blank to make volume change affected
- This function also has compatibility issue for voice change and may not work on some machines.
- VoiceName:
Executes a shell command with specified system volume
[RunAsShellSysVol("shellCommand","responseAfterExecution","responseBeforeConfirmation","responseFailed","voiceVolume)]
Run a task according to a time and date with a specific voice name and voice volume
[SetTaskEx("datetime","speechBefore","speechAfter","speechFailed","VoiceVoice","VoiceVolume","shell action")]
- VoiceName:
Full name of the voice to be used for speech - VoiceVolume:
0 - 100
- VoiceName:
Run a task according to a time and date with a specific voice name and system volume
[SetTaskExSysVol("datetime","speechBefore","speechAfter","speechFailed","VoiceName","SysVolume","shell action")]
- VoiceName:
Full name of the voice to be used for speech - SysVolume:
0 - 100
- VoiceName:
Stop/Start web service
[Speak("Stoppping web service")]&request=disable[Speak("Web service enabled")]&request=enable
Stop/start listening
[ToggleListening][StartListening("[PlaySound("Startup_Music")]Listening Started")][StopListening("[PlaySound("Startup_Music")]Listening Stopped")]
Speech to text using Cortana
[Cortana.LDictation.GetDictation("Question phrase","show_ui")]
- Shows Windows 10 style dialogue box for voice prompt via Cortana.
[Cortana.LDictation.GetDictation("Question phrase","hide_ui")]]
Web Search
[LINKS.WebSearch.bingQuery("Search Query"," response on fail")]
- Note: Search query can also come from Cortana or from windows speech recognition.
- Might not work on certain machines. Try going to bing.com and change region to US English.
Get data from web/url
[LINKS.LHttp.GetResponse("http://jarvis.ai-dot.net/test.txt","return","{error}")]
- Make sure to encode the url you like to get response from. See Bing URL Encoder
- Note: There is a limit of 1024 bytes of data this function can get.
- We will make that 5120000 bytes in next update
Run a get request
[LINKS.LHttp.Get("http://jarvis.ai-dot.net/test.txt","return","{error}")]
- Make sure to encode the url you like to hit. See Bing URL Encoder
- Note: There is a limit of 1024 bytes of data this function can get.
- We will make that 5120000 bytes in next update
Return full grammar list in response
[GetGrammarList("XML")]&output=xml&request=disable_recurse[GetGrammarList("XML")]&output=response&request=disable_recurse[GetGrammarList("JSON")]&output=json&request=disable_recurse[GetGrammarList("JSON")]&output=response&request=disable_recurse
Set microphone level
[SetMicrophone("volume","mute")]
- volume:
0 - 100 - mute_unmute:
mute, unmute
- volume:
Speech/sound file to text
[SpeechToText("c:\temp\1.wav","DictationOrGrammar")]
- DictationOrGrammar: Can use these 2 keywords. Dictatation or Grammar, so when funtion recognizes the wave file it will use loaded grammar or use dictation.
Set a reminder
[SetReminder("DateTime","Phrase","Volume")]
- DateTime:
system date format like: 04/01/2016 02:29:00 PM or 04/01/2016 14:29:00 - Phrase:
Phrase to be spoken, can be randomized using ; as phrase separator - Volume:
0 - 100
- DateTime:
Set a reminder and emulate speech
[SetReminderEx("DateTime ","phrase","volume","EmulateSpeech” )]
- DateTime:
system date format like: 04/01/2016 02:29:00 PM or 04/01/2016 14:29:00 - Phrase:
Phrase to be spoken, can be randomized using ; as phrase separator - Volume:
0 - 100 - EmulateSpeech:
can be replaced by any grammar... like "turn of the lights"
- DateTime:
Import commands remotely
[AddCommands("F:\20160401_export_shell.txt")][AddCommands("F:\20160401_export_web.txt")][AddCommands("F:\20160401_export_social.txt")][AddCommands("F:\20160401_export_default.txt")][AddCommands("F:\20160401_export_keyboard.txt")]
- Imports command files to database directly, does not check for duplicates.
Set a variable
[Set("VariableName","Value")]
- VariableName:
Name given to variable - Variable:
Variable value
- VariableName:
- Sets and stores a variable for later use
Get a variable
[Get("VariableName")]
- VariableName:
Name given to variable
- VariableName:
Get a value from WordList
[GetWord("WordList","Grammar","Column Header Or Number")]
Grammar Value Size milk Milk 1 Gallon bread Some brand bread Family detergent Some brand pods detergent 40+
As an example we make a text file things.txt with 3 columns. Note: There is no limit on number of columns
Now if we want to get size of a product from the list above, we call as follows:
[GetWord("things","milk","Size")] - Result would be 1 Gallon
Get Request
[LINKS.LHttp.Get("https://maker.ifttt.com/trigger/{event}/with/key/REPLACE_ME","Say this on success","Say this on error or {error} to get actual error message.","WaitTimeInMS")]
Get Response
[LINKS.LHttp.GetResponse("http://ai-dot.net/test.txt","unused","Say this on error or {error} to get actual error message.")]
Put Request
[LINKS.LHttp.Put("{"on":"true"}","http://<hueIPAddress>/api/<applicationAPIkey>/lights/1/state")]
Post Request
[LINKS.LHttp.Post("url","contentToPost","JSON_Formatted_Headers","returnContentType_bydefault it's application/json")]