Jump to content

kistoff

Active Members
  • Posts

    24
  • Joined

  • Last visited

kistoff's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. @Tjalve - That did work, thanks! @jdelaney - I have been tinkering with this off and on all day. I think I have finally figured it out after trying a bunch of things and reading up on Xpath. Thanks for the link to w3schools and thanks for the help! Here is what I came up with. #include <IEGetDOMObjByXPathWithAttributes.au3> #include <IE.au3> #include <Array.au3> $oIE = _IEAttach("...", "URL") $oFrame = _IEFrameGetCollection($oIE, 1) $aoImages = BGe_IEGetDOMObjByXPathWithAttributes($oFrame, "//div[@class='outputmsg outputmsg_error']") For $i = 0 To UBound ($aoImages) -1 $oNode = $aoImages[$i] ConsoleWrite($oNode.innertext & @crlf ) This writes to the console. No auto-assignment group found.
  2. I am rather new at this and I am not familiar with XPath, so I am not sure what syntax to use in order to find something in a document. I will do some reading about that, know of a good resource? If I run the code it returns.. Row Col 0 [0] [1] Should it show more or am I missing something?
  3. Well that code worked thanks! I Would never have thought to use _Stringbetween. #include <String.au3> $sString = '<img class="outputmsg_image" src="images/outputmsg_error_24.gifx">No auto-assignment group found.</div>' $aString = _StringBetween($sString, 'outputmsg_error_24.gifx">', '</div>') MsgBox(0, '', $aString[0])
  4. @PhoenixXL - thanks for the help! It is an internal work website, so I can not give out the URL. It is for service-now and there is a demo version on the web (https://demo03.service-now.com/navpage.do), but it may not have the field I am trying to get unless someone has modified it (I could play with the admin side and try to find the setting for it). Demo03 actually has the box atm, but I am not sure when the server gets reset. Login with "ITIL, ITIL" and click on an incident "INC000000" and It is the box "Done done done". @somdcomputerguy - I will look into that in the morning, thanks!
  5. I have been searching the forums for more solutions, but have come up with nothing so far. Anyone have some more ideas on what I can try?
  6. Ah you are right, its been a long day and I am learning as I go. If I run that code with only changing the URL. It tells me there are 26 images on the page, class=outputmsg_close followed by class=0 26 times.
  7. If I try that $oIE = _IEAttach ; url here $oImg = _IEImgGetCollection($oIE, "outputmsg_image") $sInfo = $oImg.classname MsgBox(0, "", $sInfo) I get - "outputmsg_close" Maybe I didn't list the right code. <div id="output_messages" class="outputmsg_container"> <img class="outputmsg_close" onclick="GlideUI.get().clearOutputMessages(this)" alt="Close Messages" src="images/x.gifx"> <div class="outputmsg_div"> <div class="outputmsg outputmsg_error"> <img class="outputmsg_image" src="images/outputmsg_error_24.gifx">No auto-assignment group found.</div> <div class="outputmsg outputmsg_info"> <img class="outputmsg_image" src="images/outputmsg_info_24.gifx">Auto-assignment successful.</div> <div class="outputmsg outputmsg_info"> <img class="outputmsg_image" src="images/outputmsg_info_24.gifx">Multiple auto-assignment groups found.</div> </div></div>
  8. I can not figure out how to get the text from a box that pops up in the form after hitting a button. Button <button style="white-space: nowrap;" id="auto_assign_3" class="form_action_button header action_context" title="Auto Assign" onclick="getAutoAssignment();;return false;" type="submit" value="cfc23c1cbda36000947b7b26545cb012" gsft_id="cfc23c1cbda36000947b7b26545cb012"><span>Auto-assign</span></button> Three possible text blocks will display. I would like to get "No auto-assignment group found." from this. <div class="outputmsg outputmsg_error"> <img class="outputmsg_image" src="images/outputmsg_error_24.gifx">No auto-assignment group found.</div> "Auto-assignment successful." from here. <div class="outputmsg outputmsg_info"> <img class="outputmsg_image" src="images/outputmsg_info_24.gifx">Auto-assignment successful.</div> "Multiple auto-assignment groups found." from here. <div class="outputmsg outputmsg_info"> <img class="outputmsg_image" src="images/outputmsg_info_24.gifx">Multiple auto-assignment groups found.</div> I have tried to use _IEImgGetCollection, _IELinkGetCollection, _IETagNameAllGetCollection, _IETagNameGetCollection, _IEGetObjById, _IEGetObjByName. Can someone point me in the right direction?
  9. I think I have it worked out and I thought I would post the code in case anyone is/was interested. Edit: tooltips were just so I could see it working. Func _IEWaitForImg() Local $i = 0 While $i <= 5 Local $oIE = _IEAttach("https://demo11.service-now.com/navpage.do", "URL") Local $oImg = _IEImgGetCollection($oIE, 3) Local $sInfo = $oImg.style.visibility If $sInfo = "visible" Then ToolTip("Visibility: " & $oImg.style.visibility) Sleep(100) $i = 0 ElseIf $sInfo = "hidden" Then ToolTip("Visibility: " & $oImg.style.visibility) Sleep(100) $i = $i + 1 EndIf WEnd EndFunc ;==>_IEWaitForImg
  10. Well I am stuck again... If I try to set an element and then set the next one right after (subcategory) the page does not update in time and it fails to set the next element. I could use Sleep() to wait, but that could fail depending on the speed of the connection. Is there a way to wait for the frame/element/form (I am not sure which one I would need to wait on) to load before setting the next element? WinWait does not seem to work and I tried _IEloadwait, but can't seem to figure it out. There is a little loading image that appears as the page is updating, could I use that some how to find when the page has loaded? Loading animation info <IMG style="VISIBILITY: hidden" id=show_loading_gif border=0 src="images/loading_anim2.gifx" width=16 height=16> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> Global $Button[1] #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 178, 106) $Button[0] = GUICtrlCreateButton("Button0", 8, 8, 75, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then Exit If $Msg = $Button[0] Then Hardware() WEnd Func Hardware() $oIE = _IEAttach("https://demo11.service-now.com/navpage.do", "URL") $oForm = _IEFrameGetCollection($oIE, 0) $oCategory = _IEGetObjByName($oForm, "incident.category") _IEFormElementOptionSelect($oCategory, "Hardware", 1, "byValue") ;wait here $oSubcategory = _IEGetObjByName($oForm, "incident.subcategory") _IEFormElementOptionSelect($oSubcategory, "Keyboard", 1, "byText") EndFunc ;==>Hardware
  11. After a lot of forum reading, trial and error, I finally figured it out. #include <IE.au3> $oIE = _IEAttach("https://demo19.service-now.com/navpage.do", "URL") $oForm = _IEFrameGetCollection($oIE, 0) $oCategory = _IEGetObjByName ($oForm, "incident.category") _IEFormElementOptionselect($oCategory,"Hardware",1,"byValue")
  12. Cool, thanks for the help! Maybe we can bounce ideas off each other once you start using service-now. It seems I am still not able to figure this out. I guess it is a problem with the form name I am using, I used the developer tools in IE to find the name. I found this which I think is the right form. <form name="incident.do" id="incident.do" onkeypress="return enterSubmitsForm(event,'false')" action="incident.do" method="post" accept-charset="UTF-8"> If I run this it doesn't work and displays "Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch" #Include <IE.Au3> $oIE = _IEAttach("ServiceNow IT Service Management Suite") $oForm = _IEFormGetObjByName($oIE,"incident.do") $oCategory = _IEFormElementGetObjByName($oForm,"incident.category") _IEFormElementOptionselect($oCategory,"Hardware",1,"byValue")
  13. The team we have for service now is pretty busy with fixing things and working on improvements, so I am pretty far down on the list and do not know when they will have time to help me. I was trying to see if I could do it with AutoIT since I like it and have used it before. I am going to look some more into the scripting they have and maybe check out some things on their forums.
  14. My company recently switched from Remedy to Service-now (https://demo.service-now.com, login itil itil) and I am trying to make some scripts to take away some repetitive work. I had some that worked well for the Remedy client, but since Service-now is web based I am not sure how/if AutoIT will work. I tried using some IE.Au3 commands, but I am a novice with AutoIT and unsure of how to figure out how to interact with this website. I would like to be able to modify fields in a ticket, category, subcategory, etc. and update the ticket. If I open a ticket and inspect the fields I want to modify for the category and subcategory I get the following. <select name="incident.category" id="incident.category" style="width: 160px;" onchange="onChange('incident.category');"> <select name="incident.subcategory" id="incident.subcategory" style="width: 160px;" onchange="onChange('incident.subcategory');"> I am trying to do something like this below. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> $Form1 = GUICreate("Form1", 178, 106, 840, 229) $Button0 = GUICtrlCreateButton("Button1", 8, 8, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit If $nMsg = $Button0 Then SN() EndSwitch WEnd Func SN() $oIE = _IEAttach("https://demo08.service-now.com/navpage.do") $Category = _IEGetObjByName($oIE, "incident.category") $SubCategory = _IEGetObjByName($oIE, "incident.subcategory") _IEAction($Category, "Hardware") _IEAction($SubCategory, "Keyboard") EndFunc ;==>SN
  15. This works really well thanks! Now to try and understand it all hehe.
×
×
  • Create New...