Jump to content
Sign in to follow this  
sbobbyyy

Unable to Upload attachement.

Recommended Posts

sbobbyyy

Hello,

I need to upload an attachment and send a mail with that attachment.

I am working on IE.

The following is the script i used to do so.

#include <IE.au3>

; Internet Explorer is partly integrated in shell.application

$oShell = ObjCreate("shell.application") ; Get the Windows Shell Object

$oShellWindows=$oShell.windows ; Get the collection of open shell Windows

$MyIExplorer=""

for $Window in $oShellWindows ; Count all existing shell windows

; Note: Internet Explorer appends a slash to the URL in it's window name

if StringInStr($window.LocationURL,"https://......") then

$MyIExplorer=$Window

;MsgBox 'IE Select';

exitloop

endif

next

$frame = _IEFrameGetObjByName($MyIExplorer, "right")

$oForm = _IEGetObjByName ($frame, "attachfile")

MsgBox(0, "Test","Clicking button")

_IEAction($oForm, "click")

WinActivate("Choose file to Upload");

;WinWaitActive("Choose File to Upload");

WinFlash("Choose file to Upload", "",4,500)

MsgBox(0, "Test","Selected window")

ControlSetText("Choose File to Upload", "", "Edit1", "D:\screenshots\test.jpg")

Sleep(1000)

ControlClick("Choose File to Upload" ,"", "Button2")

Exit

The problem is "Choose file to Upload " window is opened but the remaining part of the script is not getting executed..

I mean... the below piece of code is not getting executed. It is waiting for a long time.

WinActivate("Choose file to Upload");

;WinWaitActive("Choose File to Upload");

WinFlash("Choose file to Upload", "",4,500)

MsgBox(0, "Test","Selected window")

ControlSetText("Choose File to Upload", "", "Edit1", "D:\screenshots\test.jpg")

Sleep(1000)

ControlClick("Choose File to Upload" ,"", "Button2")

Exit

Please help me out in resolving this issue.

Thank you,

Bhaskar

Share this post


Link to post
Share on other sites
xjiang

Do you have an answer? I met this question too.

Share this post


Link to post
Share on other sites
stormbreaker

Yo, using ControlClick.... eh? You can't do something like that for a webpage. Try this one from Jos:

Edited by MKISH

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

:bye: Hey there, was I helpful?

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

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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  

×