
spoo
Active Members-
Posts
48 -
Joined
-
Last visited
Everything posted by spoo
-
Hi All, I have a . docm word document , when I write the below code it give "Variable must be of type "Object".:" Error #include <Word.au3> $oWordApp = _Word_Create("D:\Documents\Word Doc API\Report Guide Sheet.docm") $oDoc = _Word_DocGet($oWordApp,1) global $w = $oDoc.Application----> throws error here ;ConsoleWrite(@error "error code is" &@CRLF) ; move there ;$oDoc.Bookmarks("Date 1").Select ; insert content ;$w.Selection.typetext("This is inserted at the bookmark") Please suggest what on what mistake I'm doing. Thanks in advance
-
Hello , how to i close the IE browser pop window as attached in the image . Local $hIE = WinGetHandle("[Class:IEFrame]") Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]") Winclose($hCtrl) when i use the above code window gets grayed out but does not close completely . Please help me close the pop up.
-
$valSheet = $eWorkbook.Sheets($sheet_names[$i][0])
-
Hello guys, I really cannot find a way to solve this error.so please help I have an excel file (example Test.xlsx) say with 34 sheets (sheets can vary from excel file to file) i need to traverse to all the 34 sheets and check for a word . After finding the word i need to apply certain condition and then write the information in another excel (Config.xlsm) when i do this process it throws Request object failed Error . However if the sheets are less lets say 10 then i will not have any problem. Since their is so many Read , Find , and Write to the excel i thought that could be the problem . so i only used find and _ExcelRead and after Finding the value i am writing it the Notepad. from NotePad i process the data. But unfortunately i still get that message rarely . Please help me For $j=0 to UBound($VerMSN)-1 $Fileopen=FileOpen($fileName,1) $Fileopen1=FileOpen($fileName1,1) $realRank=StringSplit($VerMSN[$j][2],",") $Msn=StringSplit($VerMSN[$j][0],",") For $i=3 to UBound($sheet_names)-1 SplashTextOn("Progress","Reading through validity sheets...",500,100,Default,Default,33) if(StringInStr($sheet_names[$i][0],"Validity")<>0) Then $valSheet = $eWorkbook.Sheets($sheet_names[$i][0]) $valSheet.Activate() $fRes = FindRange($VerMSN[$j][1],$valSheet.Range("D:D")) If UBound($fRes)>0 Then If UBound($fRes)>1 Then For $f=0 to UBound($fRes)-1 $verAddress=$fRes[$f] WriteToFile($verAddress,$sheet_names[$i][0],$eWorkbook,$realRank,$Msn,$Fileopen,$Fileopen1,$Revision) Next Else $verAddress=$fRes[0] WriteToFile($verAddress,$sheet_names[$i][0],$eWorkbook,$realRank,$Msn,$Fileopen,$Fileopen1,$Revision) EndIf EndIf Next Next SplashOff() ;EndFunc Func WriteToFile($verAddress,$sheetName,$eWorkbook,$realRank,$Msn,$Fileopen,$Fileopen1,$Revision) $address= StringMid($verAddress,StringInStr($verAddress,"$",0,2)+1,3) $FAL=_Excel_RangeRead($eWorkbook,$sheetName,"B" & $address) $RangeFrom=_Excel_RangeRead($eWorkbook,$sheetName,"E" & $address) $RangeTo=_Excel_RangeRead($eWorkbook,$sheetName,"F" & $address) For $k=1 to UBound($realRank)-1 If $realRank[$k]<>"" Then $Circuit=StringLeft($sheetName,2) $Root =Rootvalue($Circuit,$sheetName) If $realRank[$k]>=$RangeFrom And $realRank[$k]<=$RangeTo Then FileWriteLine($Fileopen,$Revision &" " & $Msn[$k] &" "& $FAL &" "& $Circuit& " " & $Root) Else FileWriteLine($Fileopen1,$Revision &" " & $Msn[$k] &" "& "None" &" "& $Circuit& " " & $Root) EndIf EndIf Next EndFunc ;Find the version Func FindRange($Search,$vRange) Local $aResult[100],$iIndex = 0 Local $oMatch = $vRange.Find($Search) If IsObj($oMatch) Then $sFirst = $oMatch.Address While 1 $aResult[$iIndex] = $oMatch.Address $iIndex = $iIndex + 1 If Mod($iIndex, 100) = 0 Then ReDim $aResult[UBound($aResult, 1) + 100] $oMatch = $vRange.Findnext($oMatch) If Not IsObj($oMatch) Or $sFirst = $oMatch.Address Then ExitLoop WEnd EndIf ReDim $aResult[$iIndex] Return $aResult EndFunc Func Rootvalue($Circuit,$sheet_names) $Root=StringReplace(StringReplace($sheet_names,"-Validity",""),$Circuit,"") Return $Root EndFunc
-
@water Thank you. Here is the working code. $oSearchRange1 = _Word_DocRangeSet($oDoc, $oRangeFound, $wdSection, -1, $wdWord, 1) ;Search for MSN Involved $oMSNFound = _Word_DocFind($oDoc, "MSN involved", $oSearchRange1,Default,False) $oSearchRange = _Word_DocRangeSet($oDoc, $oMSNFound, $wdParagraph, 1, $wdParagraph, 3) $oTables=$oSearchRange.Tables Local $asMSN = _Word_DocTableRead($oDoc, $oTables(1), 1) _ArrayDisplay($asMSN) While $asMSN[2][0] == "NO data involved" $oMSNFound = _Word_DocFind($oDoc, "MSN involved", $oMSNFound,Default,False) $oSearchRange = _Word_DocRangeSet($oDoc, $oMSNFound, $wdParagraph, 1, $wdParagraph, 3) $oSearchRange.Select $oTables=$oSearchRange.Tables Local $asMSN = _Word_DocTableRead($oDoc, $oTables(1), 1) $oMSNFound = _Word_DocFind($oDoc, "MSN involved", $oMSNFound,Default,False) _ArrayDisplay($asMSN) Wend
-
@water by suggesting reading the whole table into the array are you trying to say pull all the tables present in the word documents into the array? there are multiple Tables with the same name. Please refer the attached test docx. i want table 1.2 I have used _WordDocTableRead and it work well but problem is I'm finding it difficult to search for the immediate next table (Upwards) with table name MSN Involved when "NO data involved " text is found in the table.
-
@water Word Document is provided by the Customer. so no other go. we will have to fetch the Table data from word.
-
Hi All, 1. I want to search for a unique number in the word document. lets say 34-3330 2. After finding the number i want to search for a key word "MSN INVOLVED" , upwards starting from the location of 34-3330 (ie. MSN involved keyword will be above 34-3330 number) 3.Get the first table occurrence with "MSN INVOLVED " keyword > check if the MSN involved table as no data >if table has "NO data involved keyword" then ignore the table >look for the next MSN involved Table ->if entries present then retrieve it. Problem : My code always gives me the very first table from the top with MSN involved keyword. Please find the attached test.docx #include <Array.au3> #include <MsgBoxConstants.au3> #include <Word.au3> ; Create application object Local $oWord = _Word_Create() ; Open the test document Local $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\Test.docx", Default, Default, True) ;search for the number $oRangeFound = _Word_DocFind($oDoc, "34-3330") $oSearchRange = _Word_DocRangeSet($oDoc, $oRangeFound, $wdSection, -1, $wdWord, 1) $oMSNFound = _Word_DocFind($oDoc, "MSN Involved",$oSearchRange,Default,True) $oSearchRange1 = _Word_DocRangeSet($oDoc, $oMSNFound, $wdParagraph, 1, $wdParagraph, 3) $oTables=$oSearchRange1.Tables Local $asResult1 = _Word_DocTableRead($oDoc, $oTables(1), 1) _ArrayDisplay($asResult1, "Word UDF: _Word_DocTableRead Example") test.docx
-
Local $hIE = WinGetHandle("[Class:IEFrame]") Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]") $WinHndz = WinGetHandle("Airbus Enhanced Configurator") WinActivate($WinHndz) If WinExists($hIE,"") Then $WinHndz = WinGetHandle("Airbus Enhanced Configurator") WinActivate($WinHndz) ControlClick($WinHndz,"","DirectUIHWND1","left",1,838,28) ControlSend($WinHndz,"","DirectUIHWND1","{UP}a") sleep(500) ConsoleWrite(@ScriptDir &"\EVM file" &"\"&$sheet_name & @CRLF) ControlSetText("Save As", "", "Edit1", @ScriptDir &"\EVM file" &"\"&$sheet_name&".xlsx") ControlSend("Save As", "", "Edit1","{END}x{BACKSPACE}") ControlClick("Save As", "", "Button1") EndIf for Some reason after controlSetText ,controlSend had to be given.
-
Hello, I have written a code which downloads files from a web application. steps 1. click on save -> save as 2.window pop opens-> then do control set to give the desired file location and File name Surprisingly the code that i have written works well on my windows but on other systems it goes to their default download location with default file name ,(does not change the file name). #include <IE.au3> #include <Crypt.au3> #include <Excel.au3> #include <File.au3> Local $hIE = WinGetHandle("[Class:IEFrame]") Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]") $WinHndz = WinGetHandle("xyz") WinActivate($WinHndz) If WinExists($hIE,"") Then $WinHndz = WinGetHandle("xyz") WinActivate($WinHndz) ControlClick($WinHndz,"","DirectUIHWND1","left",1,838,28) ControlSend($WinHndz,"","DirectUIHWND1","{UP}a") sleep(1000) ControlSetText("Save As", "", "Edit1", @ScriptDir &"\EVM file" &"\test.xlsx") sleep(1000) ControlClick("Save As", "", "Button1") EndIf Could someone tell me what is that I'm doing wrong ? please.. Note: i can see controlSetText doing its job , however when it clicks on save button it goes to default download location.
-
@pixelsearch Thank you so much that help
-
Hello , Rarely my code Stops abruptly with the exit code 322122547. How can i prevent it from happening? say i need to Automate some 26 files, my code works well for 15 files. after which it stops abruptly with the exit code. so how can i handle exit code 322122547 what is it telling to tell me?
-
How to Pass two arguments in shellExecuteWait?
spoo replied to spoo's topic in AutoIt General Help and Support
@Subz and @alienclone Thank you so much.. that helped:) -
How to Pass two arguments in shellExecuteWait?
spoo replied to spoo's topic in AutoIt General Help and Support
@alienclone Thanks for your reply. i want to use Aircraft and sheet_name in another autoit script. when i use the $sheet_name it gets appended with the $Aircraft value like this : aircraft|sheet_name however i want only sheet_name. -
Delete Column from 1 to 2 _ArrayColDelete($asResult,"1-2")---> doesnt work _ArrayColDelete($asResult,"1:2")---> doesnt work Should i do it separatly two times _ArrayColDelete($asResult,"1") _ArrayColDelete($asResult,"1") Thank you
-
@Exit Thanks for the reply. Basically wanted to unmerge the cells in the excel for some reason iam not able to controlsend "M" and "u" , i used both your code.. i was able to press Home button but not Meger& center $oWorkBook.Activesheet.Range($A&$res+1&":"&$col_letter&$res+1).Select-->after selecting the column If WinExists($hIE,"") Then WinActivate($hIE,"") ControlSend($hIE ,"",$hCtrl,"{ALTDown}") ControlSend($hIE ,"",$hCtrl,"H",1 ) ControlSend($hIE ,"",$hCtrl,"M",1 ) ControlSend($hIE ,"",$hCtrl,"U",1 ) ControlSend($hIE ,"",$hCtrl,"{ALTUp}") EndIf works fine till home button press Thanks:)
-
Hello, How to send ALT+H+U+M using Control Send I can get it work using send ,however if my desired location is minimized then sends it to the current open application $excel_handle="Microsoft Excel - "&$fileName Local $hIE =WinGetHandle ($excel_handle) Local $hCtrl = ControlGetHandle($excel_handle, "", "") If WinExists($hIE,"") Then WinActivate($hIE,"") ControlSend($hIE ,"",$hCtrl,"{ALT}") ControlSend($hIE ,"",$hCtrl,"H",1 ) ControlSend($hIE ,"",$hCtrl,"M",1 ) ControlSend($hIE ,"",$hCtrl,"U",1 ) EndIf
-
How to fetch the entire row in excel which is highlighted
spoo replied to spoo's topic in AutoIt General Help and Support
@water Thanks for the reply, I will try and let you know if that worked -
How to fetch the entire row in excel which is highlighted
spoo replied to spoo's topic in AutoIt General Help and Support
@Nine I want to read rows which are highlighted . -
Hello @water Thanks for your reply.. i could fix the issue.. problem was my excel had VBA Macro code embedded , and so it was not allowing me to make any change. an hence i had to use HxDen to break to the VBA macro and get relevant function name . and followed by autoit function.
-
Hello guys, I want sort my excel sheet based on the idx cloumn in ascending order and also retain its adjacent cell values , how do we do it Thanks in advance
-
Thank you:) @Nine
-
Thanks a ton:)