herworth Posted May 27, 2004 Share Posted May 27, 2004 I'm trying to run Autoit within a Word macro. Most of it works but I can't get it to recognise a Wizard Window with Winwait or Winwaitactive. The script just hangs at that point and then continues when I close the window. Any thoughts anyone? [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
herworth Posted May 27, 2004 Author Share Posted May 27, 2004 Thanks Larry but nothing seems to work. The whole VB macro hangs until I cancel the "Send Fax Wizard" window then script carries on from there. I can't even get it to mouseclick until I've closed the window. I'm trying to navigate through the Send Fax Wizard widows without having to manually input or click. It just won't recognise the windows even though the spy does. [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 28, 2004 Administrators Share Posted May 28, 2004 Does it work with something like notepad? Can you knock up a tiny example with notepad that I can test here with Word? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
herworth Posted May 28, 2004 Author Share Posted May 28, 2004 Jon This is my macro taken from Word. Instead of the part communicating with the Wizard window I've included a notepad test - that does work. The window for the Fax wizard still doesn't register. Sub SendtoFax() Dim strStyle(3) As String, strText(3) As String, x As Long Dim ctlAuto As New AUTOITX3Lib.Control, strWords As String strStyle(1) = "Company" strStyle(2) = "FaxNum" strStyle(3) = "Subject" Dim strTitle As String For x = 1 To 3 Selection.HomeKey unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Style = Activedocument.Styles(strStyle(x)) With Selection.Find .Text = "" .Forward = True .Wrap = wdFindStop End With Selection.Find.Execute If Selection.Find.Found = True Then strText(x) = Selection Next x MsgBox strText(1) & " " & strText(2) & " " & strText(3) Printon "Fax" ctlAuto.Run "notepad.exe" ctlAuto.WinWait "Untitled - " ctlAuto.Send "test" End Sub [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
herworth Posted May 28, 2004 Author Share Posted May 28, 2004 Larry if you choose the Windows 2K built in fax as your printer to fax a document, it comes up with a window called "Send Fax Wizard". This asks you to insert Name and Fax No and then you click "finish" and it sends the fax. I can't get automation to work in VBA and I thought I could use Autoit to insert the text and click the buttons. It won't work. [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
herworth Posted May 30, 2004 Author Share Posted May 30, 2004 I've discovered that the "Send Fax Wizard" window is modal which suspends actions until it is clicked. That's why the script doesn't work. Does anyone know a way round this? [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
tutor2000 Posted May 30, 2004 Share Posted May 30, 2004 I've discovered that the "Send Fax Wizard" window is modal which suspends actions until it is clicked. That's why the script doesn't work.Does anyone know a way round this?I'm no expert but what does autoit spy tell you about using controlclickRick Link to comment Share on other sites More sharing options...
herworth Posted May 31, 2004 Author Share Posted May 31, 2004 Thanks for your responses. I've now worked out how to operate automation with FaxCom.dll so in this case I don't need Autoit3. I do still think Autoit is indispensible and I've done my bit on download.com [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now