Jump to content

ajit

Active Members
  • Posts

    196
  • Joined

  • Last visited

Everything posted by ajit

  1. @water, Thanks a lot. The problem got solved. Had earlier missed another post of yours on the topic which made things easy. Regards, Ajit
  2. @Water Thanks so much for your reply. I am not sure if I am missing something but I cannot get the part on highlighting text. Thanks for any help you can provide. Regards, Ajit
  3. Hi, I am trying to color highlight text (any color other than yellow) in a word document. Please can someone help me do it. See the code below $doc = (@ScriptDir & "\test.doc") $str = "123" $Fontcolor = 0xFF0000 ;~ $Highlightcolor = "Bright Green) $oWord = ObjCreate("Word.Application") $oWord.Documents.Open($doc) $oWord.selection.find.ClearFormatting() ; clear previous search while $oWord.selection.find.execute($str) = True $oWord.Selection.Expand $oWord.selection.Font.Color = $Fontcolor $oWord.selection.Font.Bold = True $oWord.selection.Find.Forward = True $oWord.Selection.Find.Execute wend $oWord.documents.Save $oWord.Application.Quit $oWord = 0 MsgBox(0, "Highlighter", "Finished") Test Highlight.au3test.doc Thanks for any help Ajit
  4. @water, That's right. _Word_DocRangeSet of Word UDF does not move the insertion mark to the right of the range. Problem could be because I am running an outdated version of Office. Thanks, Ajit
  5. @water, Thanks for your reply. Still the script is not working properly, not sure if Word version matters here. I use MS Word 2003. However, when I use function _Word_DocRangeSet from your WordEX.au3 it works fine and the insertion point moves to after "InsertAfter". #include <Word.au3> $oWord = _Word_Create() $oDoc = _Word_DocAdd($oWord) $oRange = _Word_DocRangeSet($oDoc, 0) $oRange.Insertafter("INSERTED TEXT") $oRange = _Word_DocRangeSet_($oDoc, $oRange, Default, 2) Func _Word_DocRangeSet_($oDoc, $oRange, $iStartUnit = Default, $iStartCount = Default, $iEndUnit = Default, $iEndCount = Default, $bSelect = Default) If $iStartUnit = Default Then $iStartUnit = $wdWord If $iEndUnit = Default Then $iEndUnit = $wdWord If $bSelect = Default Then $bSelect = True If Not IsObj($oDoc) Then Return SetError(1, 0, 0) If Not IsObj($oRange) And ($oRange < -2 Or $oRange > 0) Then Return SetError(2, 0, 0) If $oRange = -1 Then $oRange = $oDoc.Range ; Set range start/end at the start to the document $oRange.Collapse($wdCollapseStart) ElseIf $oRange = -2 Then $oRange = $oDoc.Range ; Set range start/end at the end to the document $oRange.Collapse($wdCollapseEnd) ElseIf $oRange = 0 Then $oRange = $oDoc.Parent.Selection.Range ; Use the current selection as range EndIf If $iStartUnit = -1 Then $oRange.Collapse($wdCollapseStart) ElseIf $iStartCount <> Default Then $oRange.MoveStart($iStartUnit, $iStartCount) EndIf If $iEndUnit = -1 Then $oRange.Collapse($wdCollapseEnd) ElseIf $iEndCount <> Default Then $oRange.MoveEnd($iEndUnit, $iEndCount) EndIf If $bSelect Then $oRange.Select ; Show the new range Return $oRange EndFunc ;==>_Word_DocRangeSet Regards, Ajit
  6. Production version 3.3.14.2 Regards, Ajit
  7. @water, Thanks. Regards, Ajit Edit: When I used _Word_DocRangeSet from your UDF (WordEx.au3) it worked. For some reason it does not work with the AutoIT include Word.au3. Thanks.
  8. Hi, Please can someone help me with getting the "insertion point" of MS Word document after I use InsertAfter. I have tried to reset _Word_DocRangeSet after InsertAfter but the insertion point of word continues to remain before the inserted text whereas I want it after the inserted text so I can continue typing after the inserted text. Thanks for your help. Regards, Ajit #include <Word.au3> $oWord = _Word_Create() $doc = _Word_DocAdd($oWord) $oRange = _Word_DocRangeSet($doc, 0) $oRange.Insertafter("INSERTED TEXT")
  9. Thanks very much @water
  10. @Water, I am trying to use your code to split a word document using delimiters. include <Word.au3> $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, "C:\temp\Test_Word.docx") $oRange = _Word_DocFind($oDoc, "takimatas") ; Search for a single word $oRange.Select() ; Select the found word $oRange = $oDoc.Bookmarks("\page").Range ; Expand the range to the full page $oRange.Select() ; Select the full page Second last line expands the range to the full page. Instead of full page, I want it to expand the range to the next occurrence of "takimatas". Is that possible? Actually would it be possible to have a collection of parts of the document in between delimiters? What I needed was to split the single document and create multiple documents separated by delimiters. I need help specifically with expanding the range to next occurrence of "takimatas" and thus get a collection of ranges to paste in new individual documents. Thanks for any help you can provide. Regards, Ajit
  11. Thanks all of you especially @LarsJ and @HAMID. Finally got the answer after four long years. Thanks again
  12. $dbname = "C:\Documents and Settings\Admin\Desktop\MSDataBase.mdb" $adoCon = ObjCreate("ADODB.Connection") $adoCon.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $dbname) ;Use this line if using MS Access 2003 and lower ;~ $adoCon.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname) ;Use this line if using MS Access 2007 and using the .accdb file extension $adoRs = ObjCreate("ADODB.Recordset") $adoRs.CursorType = 1 $adoRs.LockType = 3 @JCHD, $Parray = $adoRs.GetRows() $Parray = $adoRs.GetRows()^ ERROR GetRows() gives an error if I delete all records (empty array). I have uploaded ADO part just in case. Regards, Ajit
  13. @JCHD, Thanks for the help, that speeds up the process. Empty array was a problem so needed to query the count beforehand (application crashed if query returned an empty array). I am using Access database if that matters. Thanks again for the help. Regards, Ajit
  14. Local $query = "(Select COUNT (*) From Files)" $adoRs.Open($query, $adoCon) $Parray = $adoRs.GetRows() $adoRs.Close Local $iRows_id = $Parray[0][0] _GUICtrlListView_DeleteAllItems($listview_Files) If $iRows_id <> 0 Then For $i = 1 To $iRows_id Local $query = "(Select * From Files)" $adoRs.Open($query, $adoCon) $Parray = $adoRs.GetRows() GUICtrlCreateListViewItem($Parray[$i - 1][1] & "|" & $Parray[$i - 1][2] & "|" & $Parray[$i - 1][3] & "|" & $Parray[$i - 1][4] & "|" & $Parray[$i - 1][5] & "|" & $Parray[$i - 1][6] & "|" & $Parray[$i - 1][7], $listview_Files) $adoRs.Close Next EndIf Hi, Please can someone have a look at my code to see if is efficient to work with large number of records, either at the database query part or GUICtrlCreateListViewItem part. I have uploaded part of the code which I think may be inefficient. Would be grateful for any suggestions. Regards, Ajit
  15. @Yashied, Thanks so much. Just what I needed. Regards, Ajit
  16. Hi, Is it possible to disable mouse wheel when focus is on a particular control such as combobox. Would be thankful for any help/hints. Regards, Ajit
  17. @water, Thanks so much. Regards, Ajit
  18. Hi, Is it possible to format particular words in a word document (bold, underline) using the native word udf or word udf by Water. So far I have only found formatting text in word document based on a range but not exactly formatting a particular word like "AutoIt" in the document. I would be grateful for any suggestions. Regards, Ajit
  19. @danwilli, Thanks, that looks beautiful when blinking. Thanks again, Regards, Ajit
  20. Hi, I want to create a list view that would have some blinking items so as to grab the attention of the user. I would be grateful for any ideas, links or examples. Example of trigger for the blinking could be system time matching with list view item. Regards, Ajit
  21. @Water Thanks for the help. WordEX is indeed a very good UDF. Regards, Ajit
  22. Hi, I want to perform functions such as _WordDocFindReplace in word document not created by my script but by some other program. So in effect I only have the name of the word document which is already open. Can I get control over the word document to do what I need for eg _WordDocFindReplace WITHOUT using _WordCreate? If that is possible, I would be grateful for some help. Thanks and regards, Ajit Edit: I posted in the wrong forum, can someone please move it to the correct forum?
  23. @careca, I guess problem with OS. I am on XP Professional, Service Pack 3 Regards Ajit
×
×
  • Create New...