Page 1 of 1
https://genderize.io/
Posted: Mon Jan 11, 2016 4:14 pm
by 5243
Hi Oleg,
I want to use this API within Robotask.
I want to send a name to this site.
https://genderize.io/
And get back if it is a female or male.
Any Ideas
Thanks 5243
Re: https://genderize.io/
Posted: Tue Jan 12, 2016 11:26 am
by Oleg
This site returns information in JSON format.
This is native format for JavaScript language. You can parse this information by using
JS Script action (see step #7 in the example below)
Look at my example:
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|397884660
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task27"
Hide=INTEGER|0
ID=INTEGER|1523079779
LogOnAsUser=INTEGER|1
Name=STRING|"JSON parse (JS script)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER
[Actions\Action1\Params]
default=STRING|"none"
password=STRING|"0"
prompt=STRING|"Input the name"
variable=STRING|"NAME"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{name}"
value2=STRING|"none"
[Actions\Action3]
ActionID=STRING|"A_FLOW_EXIT"
Enabled=INTEGER|-1
Name=STRING|"Exit"
[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action5]
ActionID=STRING|"A_INET_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"Download files and save in ""{TEMPDIR}"""
Params=FOLDER
[Actions\Action5\Params]
action=STRING|"1"
file0=STRING|"https://api.genderize.io/?name={name}"
filecount=STRING|"1"
proxykind=STRING|"0"
saveas=STRING|"1"
saveasname=STRING|"gendersize.dat"
savedir=STRING|"{TEMPDIR}"
useproxy=STRING|"0"
[Actions\Action6]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|0
Name=STRING|"Run ""notepad.exe ""{TempDir}\gendersize.dat"""""
Params=FOLDER
[Actions\Action6\Params]
ifnonzero=STRING|"0"
params=STRING|"""{TempDir}\gendersize.dat"""
program=STRING|"notepad.exe"
runas=STRING|"0"
wait=STRING|"2"
[Actions\Action7]
ActionID=STRING|"A_SCRIPT_JSSCRIPT"
Enabled=INTEGER|-1
Name=STRING|"JS script"
Params=FOLDER
[Actions\Action7\Params]
expandvars=STRING|"0"
line00000000=STRING|"s = RoboTaskApp().expandtext(""{TextFile({TempDir}\\gendersize.dat)}"");"
line00000002=STRING|"//LogMessage(s);"
line00000004=STRING|"obj = JSON.parse(s);"
line00000006=STRING|"//LogMessage(obj.name + ""|"" + obj.gender);"
line00000008=STRING|"if (obj.gender == null)"
line00000009=STRING|" {RoboTaskApp().SetUserVariable(""gender"", ""UNKNOWN"");"
line0000000A=STRING|" }"
line0000000B=STRING|" else"
line0000000C=STRING|" {RoboTaskApp().SetUserVariable(""gender"", obj.gender);"
line0000000D=STRING|" }"
linecount=STRING|"16"
savescript=STRING|"0"
[Actions\Action8]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Name: {name}"""
Params=FOLDER
[Actions\Action8\Params]
icon=STRING|"1"
msg0=STRING|"Name: {name}"
msg1=STRING|"Gender: {gender}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action9]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER
[Actions\Action9\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
file0=STRING|"{TempDir}\gendersize.dat"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Re: https://genderize.io/
Posted: Tue Jan 12, 2016 2:08 pm
by 5243
SUPER!!!!
