Jump to content
Sign in to follow this  
alexhuang

Add attachment

Recommended Posts

This is my code and I get an error message:subscript used on non-accessible variable

Can someone help me? Thanks

  Local $sText=""
   Local $teller =0
   WinWaitActive("Open")
   Local $hWnd = ControlGetHandle("Open", "", 1148)
   ControlFocus("Open","",1148)
   Send($CmdLine[1])
   $sText = ControlGetText($hWnd, "", 1148)

    While Not StringCompare($sText,$CmdLine[1]) And $teller < 3
      WinWaitActive("Open")
      $hWnd = ControlGetHandle("Open", "", 1148)
      ControlFocus("Open","",1148)
      ControlSetText($hWnd,"",1148,"")
      Send($CmdLine[1])
      $sText = ControlGetText($hWnd, "", 1148)
      $teller = $teller + 1
   WEnd
   ControlClick("Open","",1)
   ;Send("{ENTER}")
   WinWaitClose("Open"[,""[,timeout=15])

 

Edited by JLogan3o13
Added code tags

Share this post


Link to post
Share on other sites

@alexhuang welcome to the forum.

  • First and foremost, when posting please explain in detail what you are trying to accomplish - it is a lot better than asking us to guess.
  • Secondly, post the output of the SciTE window that shows the error, as it should also show you which line the error is on (again, better than having us guess).
  • Lastly, when posting code please use the code tags ( <> in your toolbar when posting), it makes it much easier to read. I have modified your original post so you can see what I mean.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

"Add attachment" means "adding an attachment to an email"?
If yes, which mail programm do we talk about?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Ok, attacking someone brand new for not asking the question correctly is not something we want to start around here.


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

The last line of your script

WinWaitClose("Open"[,""[,timeout=15])

is wrong. Brackets denote optional parameters.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Never mind. We all started as newbies on this forum :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

all your WinWaits, you have the Control where the Window title should be.

Would be more like WinWait("Open", "", 2)

Edited by BigDaddyO

hmm... I guess I have to have a signature...

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...