Jump to content

tac

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by tac

  1. Thanks for the suggestions. There seems to be many ways to work around the issue, I was just curious why it was recognizing the file before it is created?
  2. I don't think this is it. I already am showing hidden files, and yes every time the script crashes I know I need to manually end my winword.exe. Even if I put a Sleep(xxxx) after the arraydisplay, it still shows the word file that is not saved to that folder until the end of the script.
  3. ah OK i used arraydispay and realized that somehow the array that is defined at the beginning of the script is including the word doc that is saved at the end of the script. I got the script to work now, but I do not understand why it includes that file. From the arraydisplay: [0]|4 [1]|test1.docx [2]|test2.docx [3]|test3.docx [4]|~$alysis Report.docx
  4. The requested action with this object has failed.: .InsertFile($sPath & $aDocs[$i]) .InsertFile($sPath & $aDocs[$i])^ ERROR
  5. For clarity, this is the full script. This script combines all word documents within the given folder path. It works only if I manually use the number 3 in the For loop since i know there are 3 word docs in the folder. #include #include #include $sPath = "C:\test\" Local $aDocs = _FileListToArray($sPath) Local $oWord = _WordCreate(0,0,0) Local $oDoc = _WordDocGetCollection($oWord, 0) With $oWord.Selection .InsertFile($sPath & $aDocs[1]) EndWith For $i = 2 to 3 With $oWord.Selection .EndKey(6) .InsertBreak(7) .InsertFile($sPath & $aDocs[$i]) EndWith Next $oWord.Activedocument.SaveAs($sPath & "Analysis Report.docx" ) $oWord.Application.Quit
  6. Sorry, I should have mentioned I have tried Ubound already. Doesn't help.
  7. Having some trouble using _FileListToArray function. I have read the help file and I confirmed the first element [0] in the array is the number of files/folders in the array. In my case that would be 3 files. If I manually enter "3" in the "For $i = 2 to 3" then it works, however if I use "For $i = 2 to $aDocs[0]" or "For $i = 2 to $aDocs[0]-1" I can not get it to work. I'm sure I am missing something simple. I would just like to reference the number of items in the array list in my For statement. This works... Local $aDocs = _FileListToArray($sPath) For $i = 2 to 3 With $oWord.Selection .EndKey(6) .InsertBreak(7) .InsertFile($sPath & $aDocs[$i]) EndWith Next but this doesn't... Local $aDocs = _FileListToArray($sPath) For $i = 2 to $aDocs[0] With $oWord.Selection .EndKey(6) .InsertBreak(7) .InsertFile($sPath & $aDocs[$i]) EndWith Next
  8. Yes! I said I would need help on implementation This works perfect now. Thank you. #include Func ChildActivate($appTitle, $formName) AutoItSetOption("WinTitleMatchMode", 2) $hWnd = WinGetHandle($appTitle, $formName) $array = WinList($appTitle) WinActive($hWnd) $winarray = _WinAPI_EnumWindows(True, $hWnd) For $i = 1 to $winarray[0][0] $title = _WinAPI_GetWindowText($winarray[$i][0]) If StringInStr($title, $formName) Then _WinAPI_ShowWindow($winarray[$i][0], @SW_MAXIMIZE) _WinAPI_ShowWindow($winarray[$i][0], @SW_SHOWNORMAL) EndIf Next EndFunc
  9. I understand your approach but may need help on implementation of this method. I have never done any coding before AutoIt. This does not seem to work. #include <WinAPI.au3> Func ChildActivate($appTitle, $formName) AutoItSetOption("WinTitleMatchMode", 2) $hWnd = WinGetHandle($appTitle, $formName) $array = WinList($appTitle) WinActive($hWnd) $winarray = _WinAPI_EnumWindows(True, $hWnd) For $i = 1 to $winarray[0][0] $title = _WinAPI_GetWindowText($winarray[$i][0]) If StringInStr($appTitle, $formName) Then _WinAPI_ShowWindow($winarray[$i][0], @SW_MAXIMIZE) _WinAPI_ShowWindow($winarray[$i][0], @SW_SHOWNORMAL) EndIf Next EndFunc
  10. Case Sensitive is OK. I am really looking for something similar to MatchMode 1 since the end of the text in the child window is always changing.
  11. I have tried all of the match modes, but they only apply to the Main window. The Child Window always needs to be an exact match. ChildActivate("Main Window", "Child Window")
  12. Hello, new to AutoIt. As far as I can tell, there is no direct way to activate a child window. The following function will correctly activate the child window, however, the child window text needs to be an exact match. WinTitleMatchMode does not seem to apply or help in this case. Thanks for any help! #include <WinAPI.au3> Func ChildActivate($appTitle, $formName) AutoItSetOption("WinTitleMatchMode", 2) $hWnd = WinGetHandle($appTitle, $formName) $array = WinList($appTitle) WinActive($hWnd) $winarray = _WinAPI_EnumWindows(True, $hWnd) For $i = 1 to $winarray[0][0] $title = _WinAPI_GetWindowText($winarray[$i][0]) If ($title == $formName) or ($title == $formName & " *") Then _WinAPI_ShowWindow($winarray[$i][0], @SW_MAXIMIZE) _WinAPI_ShowWindow($winarray[$i][0], @SW_SHOWNORMAL) EndIf Next EndFunc EDIT for clarification: WinTitleMatchMode will only apply to the Main Window in: ChildActivate("Main Window", "Child Window")
×
×
  • Create New...