Automic Workload Automation

  • 1.  Opening a url via the Automation Engine

    Posted Feb 22, 2017 11:07 AM
    We would like to run HTTP request from UC4. For example, if we enter a request in the browser, sms will be sent.
    How can we run it trough UC4? Can we use dynamic params ?

    It's possible to open a browser session from a Windows job with this command:
    start <browser.exe> <url>
    e.g.
    start firefox.exe http://google.com

    You may as well use a script variable as the url :

    ex:
    :SET &URL# = "http://google.com"
    start firefox.exe &URL#

    However it's not possible to use a script variable to define one or several parts of the url, because of the "&" character which is used in script variables' names. This character is also commonly used in urls, which makes the variable resolution fail at runtime.

    e.g.
    :SET &DOMAIN# = "http://google"
    :SET &EXTENSION# = ".com"
    start chrome.exe &DOMAIN#&EXT#

    Will fail:
    c:\>start chrome.exe http://google  & EXT#
    'EXT#' is not recognized as an internal or external command,
    operable program or batch file.

    As a workaround you may store the complete url into a single script variable:
    :SET &DOMAIN# = "http://google"
    :SET &EXTENSION# = ".com"
    :SET &URL#=&DOMAIN#&EXTENSION#
    start firefox.exe &URL#

    Best regards,
    Antoine



  • 2.  Opening a url via the Automation Engine

    Posted Feb 23, 2017 09:13 AM

    However it's not possible to use a script variable to define one or several parts of the url, because of the "&" character which is used in script variables' names. This character is also commonly used in urls, which makes the variable resolution fail at runtime.

    e.g.
    :SET &DOMAIN# = "http://google"
    :SET &EXTENSION# = ".com"
    start chrome.exe &DOMAIN#&EXT#

     
    Hey Antoine_Sauteron

    It is possible. You need to enclose it in quotation mark:
    start chrome.exe "&DOMAIN#&EXT#"

    Also, you can play around with other options for the executable you are running.
    Example for Chrome browser.. below it will open Chrome in a maximized window.

    start chrome.exe --start-maximized "&DOMAIN#&EXT#"

    http://www.ghacks.net/2013/10/06/list-useful-google-chrome-command-line-switches/


  • 3.  Opening a url via the Automation Engine

    Posted Feb 27, 2017 04:31 AM
    Hi Christine_Chavez_6412
    Thanks for the hint!

    However the original request was to use a url whose parts would be defined with a variable - for instance
    http://sms-srv/SNSManager/msgSend.jsp?uid=&MYUSER#&encoding=windows-1255&pass=&PASSWORD#&sender=&SENDER#=sql&msg=&MESSAGE#

    So I'm not sure this would work with a url like the one above.
    I tried with my Salesforce login page:
    https://login.salesforce.com/?ec=302&startURL=%2Fhome%2Fhome.jsp%3Fsdtd%3D1&sdtd=1
    :SET &PART1# = "/?ec=302"
    :SET &PART2# = "%2Fhome%2Fhome.jsp%3Fsdtd%3D1&sdtd=1"

    start firefox.exe https://login.salesforce.com/"&PART1#"&startURL="&PART2#"

    And it returns this :
    U00021719 Syntax error in object 'JOBS.WIN.KICKURL', line '00002'. 'U01001308 Variable 'sdtd' has not yet been defined.'.

    If fails with :
    start firefox.exe "https://login.salesforce.com/&PART1#&startURL=&PART2#"
    start firefox.exe https://login.salesforce.com/&PART1#&startURL=&PART2#
    :SET &PART1# = "/?ec=302"
    :SET &PART2# = "%2Fhome%2Fhome.jsp%3Fsdtd%3D1&sdtd=1"
    :SET &URL# = "https://login.salesforce.com/&PART1#&PART2#"

    start firefox.exe &URL#

    So it seems the AE will try to interpret strings that contain '&' as variables. For this reason this method only works if the url to be called by the job does not contain this character.

    Best regards,
    Antoine


  • 4.  Opening a url via the Automation Engine

    Posted Feb 27, 2017 05:27 AM
    Just why I am curious - Why do you want to open a Web GUI (e.g. firefox) with a tool that does not support GUI interactions?
    I do not get the use behind that?!?

    wouldn´t here be any kind of API a better solution?

    cheers Wolfgang


  • 5.  Opening a url via the Automation Engine

    Posted Feb 27, 2017 05:35 AM
    Hi Wolfgang,

    The initial request was to know if it was possible to send a SMS via the AE, with dynamic parameters - like the sender, message, etc.

    FYI the customer finally decided to use a REST WS job for this task.
    we found a solution using WS REST job.
    In this method, we can pass dynamic parameters.
    For now we are checking the result using regular POST_PROCESS_REPORT, though we will change it and use XPath\XQuery, since it's more reliable.
    Best regards,
    Antoine



  • 6.  Opening a url via the Automation Engine

    Posted Feb 27, 2017 09:09 AM
    Hi Antoine_Sauteron


    Instead of:
    start firefox.exe https://login.salesforce.com/"&PART1#"&startURL="&PART2#"

    Enclose the whole http in quotation marks. That way the whole http string will be interpreted as one.
    start firefox.exe "https://login.salesforce.com/&PART1#&startURL=&PART2#"


  • 7.  Opening a url via the Automation Engine

    Posted Feb 27, 2017 09:35 AM
    Hi Christine,

    This is exactly what I did (see my comment above):

    jcumjlm0d336.pnghttps://us.v-cdn.net/5019921/uploads/editor/8j/jcumjlm0d336.png" width="756">
    The job gets a 'FAULT_OTHER - Start impossible. Other error.' status.

    In the details the last message is:
    U00021719 Syntax error in object 'JOBS.WIN.KICKURL', line '00002'. 'U01001308 Variable 'sdtd' has not yet been defined.'.
    I would suspect it refers to this part of the url: '&sdtd=1'.

    Does it work at your end?

    Best regards,
    Antoine


  • 8.  Opening a url via the Automation Engine

    Posted Feb 27, 2017 10:42 PM

    https://login.salesforce.com/?ec=302&startURL=%2Fhome%2Fhome.jsp%3Fsdtd%3D1&sdtd=1
    :SET &PART1# = "/?ec=302"
    :SET &PART2# = "%2Fhome%2Fhome.jsp%3Fsdtd%3D1&sdtd=1"

    start firefox.exe https://login.salesforce.com/"&PART1#"&startURL="&PART2#"

    And it returns this :
    U00021719 Syntax error in object 'JOBS.WIN.KICKURL', line '00002'. 'U01001308 Variable 'sdtd' has not yet been defined.'.

    Hi Antoine_Sauteron

    You might want to review your comment because your code above shows that you have &PART1# and &PART2# in quotation marks :)

    Yes, it works on my end.

    Regarding the error 'sdtd' not yet defined, this is because in &PART2# you have a "&" which AE interprets as a variable. So it interprets sdtd as a variable. That needs to be changed to &&. Just like when you're trying to print
    &MYVAR#, you do
    :PRINT variable name is &&MYVAR#
    This prints  "variable name is &MYVAR#".


    If you do just:
    :PRINT variable name is &MYVAR#
    This will throw an error that 'MYVAR#' has not yet been defined.


    I have already tested this and it works (well it's not a valid URL but it opens chrome with https://www.google.com/?gws_rd=ssl+whatever&sdtd=1). Note the value for &param2#.

    :set &name#="http://google" :set &param1# = "?gws_rd=ssl" :set &param2#="+whatever&&sdtd=1" start chrome.exe "&name#&ext#&param1#&param2#"




  • 9.  Opening a url via the Automation Engine

    Posted Feb 28, 2017 04:25 AM
    Hi Christine, I think you missed parts of my comment :)
    I did several tests - I did not only try with:
    start firefox.exe https://login.salesforce.com/"&PART1#"&startURL="&PART2#"

    If fails with :
    start firefox.exe "https://login.salesforce.com/&PART1#&startURL=&PART2#"
    start firefox.exe https://login.salesforce.com/&PART1#&startURL=&PART2#
    :SET &PART1# = "/?ec=302"
    :SET &PART2# = "%2Fhome%2Fhome.jsp%3Fsdtd%3D1&sdtd=1"
    :SET &URL# = "https://login.salesforce.com/&PART1#&PART2#"

    start firefox.exe &URL#

    Christine Chavez said:

    Regarding the error 'sdtd' not yet defined, this is because in &PART2# you have a "&" which AE interprets as a variable. So it interprets sdtd as a variable. That needs to be changed to &&. Just like when you're trying to print
    &MYVAR#, you do
    :PRINT variable name is &&MYVAR#
    This prints  "variable name is &MYVAR#".


    If you do just:
    :PRINT variable name is &MYVAR#
    This will throw an error that 'MYVAR#' has not yet been defined.


    I have already tested this and it works (well it's not a valid URL but it opens chrome with https://www.google.com/?gws_rd=ssl+whatever&sdtd=1). Note the value for &param2#.

    :set &name#="http://google" :set &param1# = "?gws_rd=ssl" :set &param2#="+whatever&&sdtd=1" start chrome.exe "&name#&ext#&param1#&param2#"



    Regarding the error 'sdtd' not yet defined, this is because in &PART2# you have a "&" which AE interprets as a variable. So it interprets sdtd as a variable. That needs to be changed to &&. Just like when you're trying to print &MYVAR#, you do
    :PRINT variable name is &&MYVAR#
    It did work after changing '&std' to '&&std' in the url, thanks for the  hint!

    Best regards,
    Antoine


  • 10.  Opening a url via the Automation Engine

    Posted Jul 18, 2017 07:37 AM

    Unix: curl

    Windows: nothing beats Powershell. Best is native as in V12 / custom interpreter. You can also access the result & interpret it (like parse for an expected string) easily or check the HTTP code.

    powershell -command "$request = Invoke-WebRequest -TimeoutSec 600 -UseDefaultCredentials -UseBasicParsing -Uri '&L_URL#'; $request.rawContent; if ($request.StatusCode -ne 200) { exit 1; }"