Lights_On Posted September 1, 2016 Share Posted September 1, 2016 Hi all, The below string works if the searched term exists, however if it does not - I don't get an '@error' or '@extended' - the scrip appears to just keep running? Local $result = _Word_DocFind($oDoc, $ComString, 0, Default, True, False, True, True) I can get errors with other combination of parameters but not with the above however only the above does what i need. It seems to be the combination of: $bMatchWildcards $bMatchWholeWord that is does not like if a term can not be matched, as changing one of these allows for an error to be found but then also no matches are found. I seek to create an 'if' statement using the above string so when it finds a match is does one set of things, and if no match is found then it does something else. With out an error being generated i can only do something when a match is found and when a match is not found the script just hangs as does not set and error so as such does not move on? Scratching my head on this one. Thank you in advance. V3.3.14.2 Link to comment Share on other sites More sharing options...
water Posted September 1, 2016 Share Posted September 1, 2016 A reproducer script would be fine. Means: Can you post a word document plus a small script that reproduces your problem? 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...
Lights_On Posted September 1, 2016 Author Share Posted September 1, 2016 Hi Water, Thank you for your quick reply. In creating the test script and docs I found it worked – sort of. Let me explain before I post further code etc. When testing basic docs all works as expected. When testing on my real environment it still failed as above. The difference between the docs is the use of tables. If I have docs with tables it hangs. If I don’t it does not. I see there is _Word_DocTableRead so perhaps I use this in some way. Initial thoughts / questions. Aim: To search a word document for a sting using the above find solution. Issues: Table’s cause hangs. Should I detect tables and or search them separately – if so how Should convert the docs to plain text and then search plain text documents? Would I be better reading the entire doc to an array and then search the array? With a little direction as to which route is likely best I can go and do some more reading etc. Thank you in advance. Link to comment Share on other sites More sharing options...
water Posted September 1, 2016 Share Posted September 1, 2016 Then please post a word document with tables and the reproducer script so I can play with it 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...
Lights_On Posted September 5, 2016 Author Share Posted September 5, 2016 Good morning Water, Thank you for your (as always) time and helpful support with fast replies. I have since changed the way I was scripting as, in fact, in the long run it suited my purpose better. I ended up opening the work document, saving it as a .txt document - then reading this into an array. This allowed for me to do what i needed to with far greater ease and speed. As with many projects its not until one starts digging further that realisation of the best way to do things becomes apparent. The issue was still with tables however I believe it was my need to read in the data in a better way that was more relevant. Not an issue with the UDF. Many thanks as always. Link to comment Share on other sites More sharing options...
water Posted September 5, 2016 Share Posted September 5, 2016 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...
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