tauruzian Posted November 17, 2014 Share Posted November 17, 2014 #include <Word.au3> Global $oWord = _Word_Create() Global $oDoc = _Word_DocGet($oWord, 1) MsgBox(0,"Test",$oDOc.Name) Above code help me to get the active Word filename . How do I get the active file for PDF,EXCEL,TXT and some other files. Any advice or reference link is highly appreciated. Thanks. Link to comment Share on other sites More sharing options...
water Posted November 17, 2014 Share Posted November 17, 2014 Excel: #include <Excel.au3> Global $oExcel = _Excel_Open() Global $oWorkbook = $oExcel.ActiveWorkbook MsgBox(0,"Test",$oWorkbook.Name) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted November 17, 2014 Share Posted November 17, 2014 PDF, TXT etc. depend on the application you use to open this files. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
tauruzian Posted November 18, 2014 Author Share Posted November 18, 2014 PDF, TXT etc. depend on the application you use to open this files. PDF im using Acrobat. Link to comment Share on other sites More sharing options...
water Posted November 18, 2014 Share Posted November 18, 2014 PDF and TYT get much more complex. Can you please tell us why you need that at all? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
tauruzian Posted November 18, 2014 Author Share Posted November 18, 2014 I need to get the highlighted text in the Word or Excel or PDF document. In order to do so, I need to activate the document and send the "^c" to copy the highlighted text, Word: include <Word.au3> Global $oWord = _Word_Create() Global $oDoc = _Word_DocGet($oWord, 1) Send ("^c") winActivate($oDOc.Name) Send ("^c") Excel: Global $oExcel = _Excel_Open() Global $oWorkbook = $oExcel.ActiveWorkbook Send ("^c") How do I do the same for PDF. Link to comment Share on other sites More sharing options...
water Posted November 18, 2014 Share Posted November 18, 2014 You are mixing two things: Automating the GUI (by using Send) Automating the program by using COM Is the text you want to copy always in the active Window? If yes: Why not just send "^c" to this window? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
tauruzian Posted November 18, 2014 Author Share Posted November 18, 2014 You are mixing two things: Automating the GUI (by using Send) Automating the program by using COM Is the text you want to copy always in the active Window? If yes: Why not just send "^c" to this window? User will select some text in the document, it can be first paragraph or second (any text). I need to copy those text and push it to clipboard. I will retrieve the value from clipboard using Java and i managed to do so. That's why in need to use Send(^C) , so the text will be pushed to clipboard. Link to comment Share on other sites More sharing options...
water Posted November 18, 2014 Share Posted November 18, 2014 Or would something like this help? This script is triggered by "^c" (could be any other key). it sends "^c" to the active window and then displays the content of the clipboard. So it is independant of the application in the active window. HotKeySet("^c", "_Copy") HotKeySet("{ESC}", "_Exit") While 1 Sleep(10) WEnd Func _Copy() HotKeySet("^c") Send("^c") $aClipBoard = ClipGet() MsgBox(0, "Content of Clipboard", $aClipBoard) HotKeySet("^c", "_Copy") EndFunc ;==>_Copy Func _Exit() Exit EndFunc ;==>_Exit My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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