Jump to content

suroit

Members
  • Posts

    14
  • Joined

  • Last visited

suroit's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Good point. I just did, ControlGetHandle gets a blank handle. Is there another way to get the handle?
  2. For what it's worth, I also followed stilllife's in another post: #include <GuiListBox.au3> WinWait("Available streams") $hdlList = ControlGetHandle("Available streams", "", "[CLASS: Listbox, INSTANCE: 1]") _GUICtrlListBox_ClickItem($hdlList, 1, "right")Hoping Item 1 (the second one) would get selected and the context menu would show up. Strangely enough, a context menu appears, but unrelated to the target window. I get the desktop context menu instead!
  3. Thanks for the suggestion. Unfortunately, same result: I get $r = 0.
  4. Sorry if this has already been discussed, but I spent a lot of time searching the forum, and experimenting... without success. Here is my problem. I am trying to automate a VirtualDubMod.exe video encoding application. Everything works fine, except when I get to this window that contains a listbox (title: "Available Streams".) The AutoIt V3 Window Info says the following: In Basic Control Info Class: Listbox Instance: 1 in the Control tab: Class: Listbox Instance: 1 ClassnameNN: Listbox1 Advanced (Class) [CLASS: Listbox, INSTANCE: 1] ID: 1402 Text (blank) ... The listbox may contain one or several items describing video streams, and I would like to do several things: (1) Find an item that contains a specific string, and then select that item (that might be the most critical) Other things I'd like to do, but not critically important: (2) be able to select an item by rank: #1 or #3 (3) read the strings in the items in the listbox (4) and/or find out how many items are in the listbox (5) or, (lower priority) right click on each item and select one of the actions on the context menu, for example "Direct Stream Copy" or "Full Processing" I have tried to do this, hoping to identify the item that contains: "Long_amer_drag.ac3" WinWait("Available streams") $r = ControlCommand("Available streams", "", "[CLASSNN:ListBox1]", "FindString", "Long_amer_drag.ac3") MsgBox(4096, "Audio streams", " Reference $r = " &amp; $r)I get $r = 0 (the item that contains the string is in 2nd position), so that must be wrong. I also tried, hoping to select the right item: WinWait("Available streams") $r = ControlCommand("Available streams", "", "[CLASSNN:ListBox1]", "SelectString", "Long_amer_drag.ac3") MsgBox(4096, "Audio streams", " Reference $r = " &amp; $r)I also get $r = 0, and the selection doesn't move to the right item. I haven't found many options to pursue. I hope someone will be able to point me in the right direction. Thanks.
  5. Xenobiologist (or anyone else), did you try to follow Fire's recommendation? How does it work? Fire, I am a little worried by your warning "very dangerous". What exactly is the danger, before I try to follow your method? Thanks all.
  6. Thanks Water, I don't know how I missed that thread. But I am worried about Fire's proposal in that thread, deemed "very dangerous" without me understanding what the danger really is.
  7. This is what is happening: I am running a scheduled script every night at 2:00 am on Windows XP SP3, and it sometimes happens that my PC reboots, for example due to a short power shortage. It then sits with the logon screen that has the users icons, waiting for a user to logon. I may be mistaken, but I was under the impression that this state was similar to the "locked workstation" state, and that it was possible to run a script without logging in. I haven't been able to do it. I have followed the recommendation regarding running scripts on locked workstations (no Send() MouseClick() WinActivate() WinWaitActive() WinActive() etc) Can anyone confirm whether it is possible or not to run scripts prior to logging in as a Windows user? Thanks.
  8. Excellent, this is totally clear to me now. Thanks a lot.
  9. Thanks, but what I am looking for is an example of nested loops with two ExitLoop levels. But I may have originally misunderstood the level parameter, as described (summarily) in the Autoit Help file: Now, my understanding is that with ExitLoop 1, you exit the current loop, with ExitLoop 2, you exit the current loop and the higher level loop, etc. I think I can test this.
  10. Thanks Omikron. Removing the levels make it work. I thought I had use the ExitLoop levels so that the first loop doesn't exit on the second ExitLoop -- and the help file is really sketchy on this point. But apparently, there is no ambiguity here. I am struggling to find an example where there is ambiguity and the ExitLoop levels are needed...no luck so far.
  11. I am trying to use a nested While/Wend loop with ExitLoops for each loop. Here is the code I am testing: Dim $i Dim $j $i=0 $j=0 While 1 While 2 If $j<3 Then $j = $j + 1 MsgBox(4096, "$j loop", "$i =" & $i & ",$j = "& $j) Else ExitLoop (1) EndIf WEnd MsgBox(4096, "", "End of loop $j = "& $j) If $i <3 Then $i = $i +1 MsgBox(4096, "$i loop", "$i =" & $i & ",$j = "& $j) Else ExitLoop (2) EndIf WEnd MsgBox(4096, "", "End of loop $i = "& $i) Exit The nested loop (index $j) works fine. When the nested loop reaches the exit condition ($j>=3), the first loop (index $i) seems to work fine until the condition for exit ($i>=3) is reached. When the program has to execute the second ExitLoop (2) command, I get an Autoit Error saying: Line 20 (File "D:|Testing_nested_while_loops.au3") ExitLoop(2) Error: "ExitLoop/ContinueLoop" Statements only valid from inside a For/Do/While loop. I need some help about how to use the ExitLoop levels. By the way, I tried ExitLoop 2 as well as ExitLoop (2). Same result. It seems to me the second ExitLoop is used inside a While loop, contrary to the error statement. Any comment would be appreciated.
  12. Hi, I am trying to delete large numbers of files with specific names that I can calculate. I would like to use FileRecycle with the script below, but only FileDelete seems to give me the correct return values. When I use FileDelete, I get the predicted return values: 0 when the file doesn't exist, and 1 when the file exists. With FileRecycle, though, the return value is always 1! Can anyone let me know if I am using this function correctly? Thanks. #Include <File.au3> ; Statement required by _FileListtoArray #include <Date.au3> ;-------------Script works as is when using FileDelete, not FileRecycle. ; Local $i Local $k Local $file $lgName = "log.txt" $fpath = InputBox("Delete some files", "Enter folder path","D:\_test2") & "\" Msgbox("", "Folder path is ", $fpath) $logfile = FileOpen($fpath & $lgName, 1) $log = "Time: " & @hour & ":" & @min & ":" & @sec & " Starting FileRecycle_test" & @CRLF FileWriteLine($logfile, $log) ;---------Create test files in directory---------------------------- For $k = 5 to 10 $txtfile = FileOpen($fpath & $k & ".txt", 1) If $txtfile = -1 Then ; Check if file opened for writing OK MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileClose($txtfile) Next MsgBox(4096,"","All files created") ;-----------Loop to test FileDelete--------------------------------- $i = 1 Do $FileSearch = FileFindFirstFile($fpath & $i & "*.txt") $file = FileFindNextFile($FileSearch) $RecycleSearch = FileRecycle($fpath & $i & "*.txt") $log = $i & ", " & "File: " & $fpath & $i & "*.txt" & ", FileSearch= " & $FileSearch & ", File= " & $file & ", RecycleSearch= " & $RecycleSearch MsgBox(4096,"", $log,1 ) FileWriteLine($logfile, $log) FileClose($FileSearch) $i = $i +1 Until $i = 13 FileClose($logfile) MsgBox(4096, "", "End") Exit
  13. Melba, Thanks for the explanation. It sounds indeed reasonable. I was hoping I wouldn't have to find out separately if the files exist. By the way, the Help file doesn't talk about wild cards for FileExists. I will have to try that. I was using FileFindFirstFile and FileFindNextFile with wild cards, but it is somewhat cumbersome. Suroit Edit: After a quick test, FileExists seems to work with wild cards.
  14. Sorry if this is obvious to many people -- I am a newbie -- but here is the question: After some testing, I found out that when I FileRecycle a file that doesn't exist, the return value is always 1 (success) as long as the path is correct, even if the file to be recycled doesn't exist. Example: $newpath = D:\np2\ $t = FileRecycle($newpath & "*.jpg") If $t = 1 Then Msgbox( 4096, "FileRecycle", "File Recycle success returns 1." & " $t = " & $t) Else Msgbox( 4096, "FileRecycle", "File Recycle failure returns 0." & " $t = " & $t) EndIf If the directory exists, the return value is always 1, whether the jpg files exist in it or not. This is counterintuitive. Is my conclusion correct that when FileRecycle is asked to recycle a file that doesn't exist, it is considered success as long as the directory exists? Or am I missing something basic? Thanks for any help.
×
×
  • Create New...