Sign in to follow this  
Followers 0
SentryP

Service-now.com

8 posts in this topic

Has anyone had any success with using autoit to automate a ticket creation with this website?

I’m running in to issues and its probably because I’m new to autoit.

Any guidance would be great.

Thank you

Share this post


Link to post
Share on other sites



You need to post a more specific question. Exactly what kind of issues does your script have?

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I'm having issues creating tickets.

$oIE1 = _IECreate ("https://company.service-now.com/expert_shell.do?sysparm_initial=true&sysparm_sys_id=95c4f29f0a0a3c60007a74bc846a6369", 1)

_IELoadWait ($oIE1)

$o_Template = _IEGetObjByName ($oIE1, "sys_display.IO:95d248040a0a3c60008c0e6bd08fbf2d")

_IEFormElementSetValue ($o_Template, "Server Decommission")

There is a validation process that goes on after you enter the text. But I cant get it to work without using a tab key or mouse move.

Here is the code for the above feild:

<INPUT class=questionsetreference onkeypress="return acReferenceKeyPress(this, event)" id=sys_display.IO:95d248040a0a3c60008c0e6bd08fbf2d onkeydown="return acReferenceKeyDown(this, event);" onkeyup="return acReferenceKeyUp(this, event)" title="" onfocus="if (!this.ac) new AJAXReferenceCompleter(this, 'IO:95d248040a0a3c60008c0e6bd08fbf2d', '', '', 'sys_template');" value="Server Decommission" name=sys_display.IO:95d248040a0a3c60008c0e6bd08fbf2d autocomplete="off">

After this there is a next button I cant seem to "press".

here is the code for the button.

<BUTTON class="catalog catalog_next" onclick=g_expert.next()>Next</BUTTON>

Share this post


Link to post
Share on other sites

Assuming the value was correctly set, indicating you had a valid reference to $o_Template:

The _IEFormElementSetValue() function fires the "onchange" and "onclick" events if you leave the default value of $f_fireEvent = 1. That element is looking for events of "onkeypress", "onkeyup", "onkeydown", and "onfocus". You may have to fire some or all of them to get those scripts to do whatever they do. For example:

_IEFormElementSetValue ($o_Template, "Server Decommission")
_IEAction($o_Template, "focus") ; Fire "onfocus" event script
$oTemplate.fireEvent("onkeypress") ; Fire "onkeypress" event script

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Assuming the value was correctly set, indicating you had a valid reference to $o_Template:

The _IEFormElementSetValue() function fires the "onchange" and "onclick" events if you leave the default value of $f_fireEvent = 1. That element is looking for events of "onkeypress", "onkeyup", "onkeydown", and "onfocus". You may have to fire some or all of them to get those scripts to do whatever they do. For example:

_IEFormElementSetValue ($o_Template, "Server Decommission")
_IEAction($o_Template, "focus") ; Fire "onfocus" event script
$oTemplate.fireEvent("onkeypress") ; Fire "onkeypress" event script

;)

I tried this code but it didn't work.

Thank you for the quick relpy!

Share this post


Link to post
Share on other sites

What if you set focus to it, as above or with _IEAction($o_Template, "click"), then ControlSend() the value? Maybe that would trigger required events.

Also, you should be running this with _IEErrorHandlerRegister() and watching the console pane for helpful messages while it runs.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Assuming the value was correctly set, indicating you had a valid reference to $o_Template:

The _IEFormElementSetValue() function fires the "onchange" and "onclick" events if you leave the default value of $f_fireEvent = 1. That element is looking for events of "onkeypress", "onkeyup", "onkeydown", and "onfocus". You may have to fire some or all of them to get those scripts to do whatever they do. For example:

_IEFormElementSetValue ($o_Template, "Server Decommission")
_IEAction($o_Template, "focus") ; Fire "onfocus" event script
$oTemplate.fireEvent("onkeypress") ; Fire "onkeypress" event script

;)

Does the window have to be active of this to work?

Share this post


Link to post
Share on other sites

Not for the AutoIt functions themselves to work. I guess the scripts on the page might test for it, but that's just guessing.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0