scsnake

dialog box button

6 posts in this topic

there's ie form and a "submit" button, when "submit" is clicked there pops up a dialog box (by javascript onclick) for confirmation, and the dialog box has two buttons (accept, cancel)

i use UDF in IE.au3 to select all checkboxes, click the "submit", but fail to click the accept button in dialog box

i have tried

ControlClick("[Class:#32770]","...text...","[ClassNN:Button1]","left")

or just use

WinWait and WinActivate ("[Class:#32770]","...text...") and then send("{enter}")

but both fail to work >"<

any suggestions :D

the following are informations of that dialog box (the accept button):

>>>> Window <<<<

Title: Windows Internet Explorer

Class: #32770

Position: 410, 326

Size: 468, 166

Style: 0x94C801C5

ExStyle: 0x00010101

Handle: 0x000B0674

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Advanced (Class): [CLASS:Button; INSTANCE:1]

ID: 1

Text: 確定(traditional chinese character that means "accept")

Position: 270, 100

Size: 88, 28

ControlClick Coords: 43, 18

Style: 0x50030001

ExStyle: 0x00000004

Handle: 0x00050702

>>>> Mouse <<<<

Position: 726, 467

Cursor ID: 2

Color: 0xB5E2FA

>>>> StatusBar <<<<

>>>> Visible Text <<<<

確定(traditional chinese character that means "accept")

取消(traditional chinese character that means "cancel")

Are you sure you want to delete all selected personal messages?

>>>> Hidden Text <<<<

----

for anyone playing dead frontier, i want to check all messages in that page, and click "deleted selected" submit button, and click the accept button in dialog box

Share this post


Link to post
Share on other sites



It's likely that there may be only one window with that dimensions on your system at once, you can try this:

Opt('WinTitleMatchMode', 4)

...
..
.
WinWaitActive('[W:468; H:166]')
ControlClick('[W:468; H:166]', '', 'Button1')

You can at least try it. ;]

Share this post


Link to post
Share on other sites

I have seen where someone used Send "Tab" and then Send "Enter" and that worked for them

Just an Idea...

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

both of your method are tested, but still not work >"<

by the way, my OS is vista(home basic), ie 7

---------

this is my script:

$oIE=_IEAttach($handle,"HWnd")

$oForm=_IEFormGetObjByName($oIE,"pmFolder")

_IEFormElementCheckBoxSelect($oForm,"0","","1","byIndex")

$oSubmit=_IEFormElementGetObjByName($oForm,"del_selected")

_IEAction($oSubmit,"click") ->after the click pops the dialog, and full script pause

MsgBox(1,"","test") msgbox will only appear after dialog box disappear

so that's the problem, the script pauses at _IEAction

any idea that can solve this problem??

-----------------------------

ok this is the solution:

i use _IEAction($oSubmit,"focus") and send("{enter}") instead of _IEAction($oSubmit,"click")

and everything goes fine !!

Edited by scsnake

Share this post


Link to post
Share on other sites

Hi scsnake, everyone, I am facing the same issue but is not able to replicate your success with your fix. Last post is several years back so I am just trying my luck. 

Its a password reset portal that my company's HQ requires all new users to use to reset their newly created accounts. However, locally, we have already had other systems and complex password has already been created for them. This is me trying to automate the process for them so that they do not have to manage so many different passwords. 

This is the source of the button i am trying to automate the click on. 

############################

<INPUT name=ctl00$ContentPlaceHolder$btn_Send id=ContentPlaceHolder_btn_Send onclick="return confirm('INF0250:パスワードを変更します。よろしいですか?\nINF0250:Your password will be changed. Do you want to continue?');" type=submit value=Send>

############################

My script is working up till clicking on the Send button, where it gives me a Dialog box where I have to click "OK". The script just stops there, although the dialog box has focus and all i need to do is press "Enter"; all script actions i attempted does not seem to work. 

####################################

;populate fields in the form
_IEFormElementSetValue($GIMSFormUser, $FwdAddr)
_IEFormElementSetValue($GIMSFormOldPassword, $StandardPassword)
_IEFormElementSetValue($GIMSFormNewPassword, $Password)
_IEFormElementSetValue($GIMSFormNewPasswordCon, $Password)


;click Send
_IEAction($GIMSFormSend, "click")
;Sleep(2000)
WinWaitActive("[CLASS:#32770]")
Sleep(500)
Send("{ENTER}")

####################################

This is from AutoInfo.exe

>>>> Control <<<<
Class:  Button
Instance:   1
ClassnameNN:    Button1
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:1]
ID: 1
Text:   OK
Position:   261, 96
Size:   88, 26
ControlClick Coords:    43, 12
Style:  0x50030000
ExStyle:    0x00000004
Handle: 0x00220E1C

>>>> Mouse <<<<
Position:   769, 446
Cursor ID:  0
Color:  0x7D3200

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
OK
Cancel
INF0250:パスワードを変更します。よろしいですか?
INF0250:Your password will be changed. Do you want to continue?


>>>> Hidden Text <<<<

########################

I have attempted _IEAttach, ControlSend. Except for MouseClick(), which I do not want to use as it will not work with users with different screen resolutions. 

 

Any help is appreciated!

Share this post


Link to post
Share on other sites

dnnytn,

all script actions i attempted does not seem to work

Which is quite normal when you consider what you are trying to do. Anyway, we are not prepared to support automatic password changing - for what I hope are obvious reasons. Thread locked.

M23 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.