water Posted March 23, 2016 Share Posted March 23, 2016 You could set the AlternativeText when creating the Word document and check that in your script: #include <Word.au3> $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, "C:\temp\Default RMLO_SIG.docx") $FBName = "http://www.facebook.com" ; Set Picture 1 to Facebook _Word_DocLinkAdd($oDoc, $oDoc.InlineShapes(1).Range, $FBName, Default, "Click here to visit my facebook page. " & @CRLF & $FBName, "FB") ; Loop through the InlineShape collection and display some information for each picture For $oShape In $oDoc.InlineShapes ConsoleWrite($oShape.Name & " - " & $oShape.AlternativeText & " - " & $oShape.Hyperlink.Address & @CRLF) Next My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Messy_Code_Guy Posted March 23, 2016 Author Share Posted March 23, 2016 Water- I think this will work. I will try this later today and let you know how it goes. "The only thing necessary for the triumph of evil is for good men to do nothing". Edmund Burke Link to comment Share on other sites More sharing options...
Messy_Code_Guy Posted March 24, 2016 Author Share Posted March 24, 2016 Water- I am getting this error: "C:\Temp\Word_Test3.au3" (35) : ==> The requested action with this object has failed.: ConsoleWrite($oShape.Name & " - " & $oShape.AlternativeText & " - " & $oShape.Hyperlink.Address & @CRLF) ConsoleWrite($oShape^ ERROR Here is the code I was using. expandcollapse popup#include <MsgBoxConstants.au3> #include <Word.au3> #include <File.au3> Local $oWord = _Word_Create(True, True) If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error creating a new Word application object." & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf Local $sDocument = @ScriptDir & '\Default RMLO_SIG.mht' Local $oDoc = _Word_DocOpen($oWord, $sDocument, Default, Default, False) If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error opening " & $sDocument & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf $Google = "http://www.google.com" ; Set Picture 1 to Facebook _Word_DocLinkAdd($oDoc, $oDoc.InlineShapes(2).Range, $Google, Default, "Click here to visit Google.com. " & @CRLF & $Google, "G") If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error setting link in image " & $Google & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf $FBName = "http://www.facebook.com" ; Set Picture 1 to Facebook _Word_DocLinkAdd($oDoc, $oDoc.InlineShapes(1).Range, $FBName, Default, "Click here to visit my facebook page. " & @CRLF & $FBName, "FB") ; Loop through the InlineShape collection and display some information for each picture For $oShape In $oDoc.InlineShapes ConsoleWrite($oShape.Name & " - " & $oShape.AlternativeText & " - " & $oShape.Hyperlink.Address & @CRLF) If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error setting link in image " & $FBName & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf Next If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error setting link in image " & $FBName & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf $FBName = "http://www.facebook.com" ; Set Picture 1 to Facebook _Word_DocLinkAdd($oDoc, $oDoc.InlineShapes(1).Range, $FBName, Default, "Click here to visit my facebook page. " & @CRLF & $FBName, "FB") For $oShape In $oDoc.InlineShapes ConsoleWrite($oShape.Name & " - " & $oShape.AlternativeText & " - " & $oShape.Hyperlink.Address & @CRLF) If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error setting link in image " & $FBName & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf Next If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error setting link in image " & $FBName & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf $Google = "http://www.google.com" ; Set Picture 1 to Facebook _Word_DocLinkAdd($oDoc, $oDoc.InlineShapes(2).Range, $Google, Default, "Click here to visit Google.com. " & @CRLF & $Google, "G") If @error Then $file1 = FileOpen(@ScriptDir & "\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error setting link in image " & $Google & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf Thanks for the help! "The only thing necessary for the triumph of evil is for good men to do nothing". Edmund Burke Link to comment Share on other sites More sharing options...
water Posted March 24, 2016 Share Posted March 24, 2016 Which version of AutoIt do you run? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Messy_Code_Guy Posted March 25, 2016 Author Share Posted March 25, 2016 v3.3.14.2 "The only thing necessary for the triumph of evil is for good men to do nothing". Edmund Burke Link to comment Share on other sites More sharing options...
water Posted March 25, 2016 Share Posted March 25, 2016 With AutoIt 3.3.14.x you need a COM error handler. If none is defined every COM error crashes your script. Global $__goError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") ; At the top of your script Function __Excel_COMErrFunc comes with the Excel UDF. For details see ObjEvent in the help file. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Messy_Code_Guy Posted March 25, 2016 Author Share Posted March 25, 2016 Thanks, this is what I needed! "The only thing necessary for the triumph of evil is for good men to do nothing". Edmund Burke 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