Jump to content
monarch684

Get Focus on Popup

Recommended Posts

monarch684

I have gotten far in my script but after trying numerous times I can not get a popup window get focus and edit what I need to edit then go back to original window.

; Start Jabber Setup
#include <IE.au3>

; Open Web Console and Wait for Load
Global $oIE = _IECreate("https://***********/ccmadmin/showHome.do")

; Send Username & Password
Local $oForm = _IEFormGetObjByName($oIE,"logonform")
Local $oUname = _IEFormElementGetObjByName($oForm, "j_username")
Local $oPwd = _IEFormElementGetObjByName($oForm, "j_password")
_IEFormElementSetValue($oUname, $uname)
_IEFormElementSetValue($oPwd, $pwd)
_IEFormSubmit($oForm)

; Navigate to Capabilities Assignment
_IENavigate($oIE,"https://***********/ccmadmin/capassignFindList.do")

; Set User HR Number and Search
Local $oForm = _IEFormGetObjByName($oIE,"capassignFindListForm")
Local $oText = _IEFormElementGetObjByName($oForm, "searchString0")
_IEFormElementSetValue($oText, $uhrnum)
_IEFormSubmit($oForm)

; Get Link to Modify User
_IELinkClickByText($oIE, $uhrnum)

; Verify CUP and CUPC are Enabled
Local $oForm = _IEFormGetObjByName($oIE,"capassignForm")
_IEFormElementCheckBoxSelect($oForm, 1, "",0,"byIndex")
_IEFormElementCheckBoxSelect($oForm, 1, "",1,"byIndex")
_IEFormSubmit($oForm)

; Navigate to List Phones
_IENavigate($oIE,"https://***********/ccmadmin/phoneEdit.do")

; Set Option to CUCSF and Submit
Local $oForm = _IEFormGetObjByName($oIE,"phoneForm")
Local $oSelect = _IEFormElementGetObjByName($oForm, "tkmodel")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "503")
_IEFormSubmit($oForm)

; Set Device Name
Local $oForm = _IEFormGetObjByName($oIE,"phoneForm")
Local $oName = _IEFormElementGetObjByName($oForm, "name")
_IEFormElementSetValue($oName, "CSF" & $uext)

; Set Description
Local $oDesc = _IEFormElementGetObjByName($oForm, "description")
_IEFormElementSetValue($oDesc, "US5 " & $duname & " " & $uext)

; Set Device Pool
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkdevicepool")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "0f8019b9-0069-59f0-5e02-3a873e6bb2b6")

; Set Phone Button Template
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkphonetemplate")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "8e1a10fa-a52c-4435-a4ec-540d266c8c37")

; Set Calling Search Space
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkcallingsearchspace")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "8462f516-112b-b875-0b4d-9ac3f828655a")

; Set AAR Calling Search Space
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkcallingsearchspace_aar")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "60e4e653-5653-aa9d-9436-5c3ce97f4fc3")

; Set Media Resource Group List
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkmediaresourcelist")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "28d6ccdf-9114-28db-906c-4a1c7f7158fc")

; Set AAR Group
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkaarneighborhood")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "5efbf00a-fec9-3c0b-d6b7-4a319e697323")

; Set User Locale
Local $oSelect = _IEFormElementGetObjByName($oForm, "tkuserlocale")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "1")

; Set Primary Phone
Local $oSelect = _IEFormElementGetObjByName($oForm, "ikdevice_primaryphone")
_IEAction($oSelect, "focus")
Send("{TAB}{ENTER}")
Sleep(1000)
Local $hWin = WinGetTitle("[ACTIVE]")
Local $oForm = _IEFormGetObjByName($hWin,"PhoneFindListForm")
Local $oSelect = _IEFormElementGetObjByName($oForm, "searchField0")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "numplan.dnorpattern")

The Set Primary Phone is where this issue lies.

I need to be able to open this popup:

<INPUT onclick="search('ikdevice_primaryphone', 'phoneFindList.do?whereClause=device.tkClass=1', 'false')" class=content-form-button type=button value=Find>

Once this is open I need to edit the fields to find a long key that is unique with each phone.  (I know how to edit the fields once I get focus on the popup.)

<TD align=center>
     <INPUT class=content-nogroove type=checkbox value=true name=result[1].chked>
     <INPUT type=hidden value=a73e1e1d-fb5a-5424-af2f-e9b7e5f3e753 name=result[1].col[0].stringVal>
     <INPUT type=hidden value=SEP0019E7A6640C name=result[1].col[1].stringVal>
 </TD>

I need to get the "result[1].col[0].stringVal".

Once I retrieve that key and submit the popup closes and I am back on the main page I was originally editing.

My Hurdles:

  1. Open Popup without having to use SEND("{TAB}{ENTER}")
  2. Get focus on popup so that I can edit the form
  3. Retrieve the long unique key
  4. Submit Form and once back on main form continue editing

If I can get these thing accomplished then the rest of my script will be a cake walk.  BTW I am a noob and like to ask questions.  This is my third day creating this script.

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

×