Jump to content

Shibuya

Active Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by Shibuya

  1. I've verified with 2 other WinXP machines and 1 WinVista machines, all exhibited the same behavior They did not exit the while loop until I've manually tabbed to the "About" tab.
  2. could you tell me what is the behavior that was being exhibited in your machine, with the un-commented messagebox lines? what happended on my machine was: 1) Lauch IE7, launch print dialogue and printing preferences 2) I executed the script 3) I manually activate the printing preferences window 4) the message box "test1" is displayed, i close the message box 5) nothing else happens, script is still running 6) I manually click to the "About" tab, the message box "test" is displayed 7) I close the message box and the script terminates
  3. I executed the following codes and found it keep getting stuck at line 36 WinWaitActive("Printing Preferences") _GoToTab("Printing Preferences", "About") If WinWaitActive("Printing Preferences", "About") Then MsgBox(0, "", "test") Func IsVisible($handle, $wText = "") If BitAnd( WinGetState($handle, $wText), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func _GoToTab($w_title, $tab) While 1 Opt("WinTitleMatchMode", 3) $list = WinList($w_title) Opt("WinTitleMatchMode", 1) For $i = 1 To $list[0][0] If $list[$i][0] <> "" And IsVisible($list[$i][1]) Then $print_handle = $list[$i][1] ;MsgBox(0, "Details", "Title=" & $list[$i][0] & @LF & "Handle=" & $list[$i][1]) ExitLoop(2) EndIf Next WEnd While WinExists($print_handle) ;MsgBox(0, "Details", "test1") If WinActive($print_handle, $tab) Then ExitLoop; stuck here ;MsgBox(0, "Details", "test2") If WinActive($print_handle) Then Send("^{TAB}") ;MsgBox(0, "Details", "test3") Sleep(1500) WEnd EndFunc I used the following steps to test the codes: 1) Lauch any webpage using IE 2) Launch the print dialogue(e.g. Ctrl+p) 3) Select printer as Microsoft Office Document Image Writer 4) Click on "Preferences" button to launch the printing preferences window(this window should have 3 tabs: Page, Advanced and About) 5) Execute the script The script is supposed to scroll thru the tabs until the "About" tab is active. By using the commented MsgBox-es, I found the script to be stuck at line 36. AutoIt version used v3.2.1.14 OS: WinXP w/ SP2 In case if required, I used IE7 PS: I've tried replacing line 36 using WinWaitActive with a timeout, same outcome.
  4. it's kinda like an OS issue, commonly happens when involving 2 windows and 1 gets closed. Just a example scenario: 1) Open Notepad 2) Minimize Notepad window 3) Open any other window, eg My Computer 4) Close the new window by clicking the 'x' on the top right corner At this point, you should see the Notepad icon on the Taskbar is depressed, indicating it's activated. I did this on WinXP(32bit w/ SP2) by the way.
  5. hmmm....is there no way I to reference the tab using the text on the tab, other than using the reference number returned by ControlCommand($title,"","SysTabControl321","CurrentTab", "")?
  6. I'm trying to write a small function, one that scrolls thru a SysTabControl32 until the desired tab is active. The script below is my attempt on it. Tested it on IE7 with the Printing Preferences window of MS Document Image Writer, somehow the script exited the while loop without reaching the correct tab. $title = "Printing Preferences" $tab = "About" Opt("WinTitleMatchMode", 3) $print_handle = WinGetHandle($title) MsgBox(0, "", $print_handle) While WinExists($print_handle) ;MsgBox(0, "Details", "test1") If WinActive($print_handle, $tab) Then ExitLoop ;exit loop when the required tab is active ;MsgBox(0, "Details", "test2") If WinWaitActive($print_handle) Then Send("^{TAB}") ;scrolls thru each tab ;MsgBox(0, "Details", "test3") Sleep(1500) WEnd MsgBox(0, "Details", "test4") Any idea what's wrong with the script?
  7. Hi SmOke_N, I've tried it today and it works perfectly as expected Thanks for the help
  8. Hi SmOke_N, sorry for the late reply. I've yet to test the script as I was away from office and my scripting machine for the past few days. But reading from the code itself, it is exactly what I wanted and I believe it should work. I'll try it out and let you know again when I get back to the office. Thanks again for your help and attention.
  9. yea, comparing order by order so long as i'm comparing if both the arrays are equivalent :">
  10. 2-dimension arrays initially i tried something like: Dim $TestArray1[2][2] Dim $TestArray2[2][2] $TestArray1[0][0] = 1 $TestArray1[0][1] = 1 $TestArray2[1][0] = 1 $TestArray2[1][1] = 1 If $TestArray1 = $TestArray2 Then ;I know...that was pretty dumb... MsgBox(0, "", "Equal") Exit EndIf MsgBox(0, "", "Not equal") which i later realised that I can't compare arrays this way
  11. Anyone any idea on how to compare if 2 sets of arrays are equivalent, if there's such a UDF that can do that?
  12. I was last using v3.1.1.122 when I wrote my scripts with Randall's ExcelCOM UDF after installing v3.2, i found that my scripts do not work anymore after some debugging, I found the root cause with the following snippet: #include ".\ExcelCOM.au3" $ProcessLog = @ScriptDir & "\ProcessLoger.xls" If Not FileExists($ProcessLog) Then _XLCreateBlank($ProcessLog) _XLClose($ProcessLog, 1) EndIf $var = _XLread($ProcessLog,1,1,5) _XLClose($ProcessLog, 1) MsgBox(0, "", $var) While I was using v3.1.1.122, empty cells returns 0, with v3.2, empty cells returns "". just to check if it's a fixed behaviour from v3.1?
  13. just extract the Beta compiler and do a command line compile i'm doing that on my non-AutoIt installed machines
  14. @greenmachine ooops...my bad...somehow my scite returned me this: ERROR: Hex() [built-in] called with wrong number of args. so i thought it could be a missing dll call like what the help file did for _IsPressed.
  15. I don't really get what u're trying to do... anyway, I've amended the script abit and this works #include <misc.au3> HotKeySet ("{ESC}", "quitme") $dll = DllOpen("user32.dll") While 1 For $i = 1 To 255 If _IsPressed (Hex ($i, $dll)) Then MsgBox (0, "pressed", $i) EndIf Next WEnd DllClose($dll) Func quitme() Exit EndFunc
  16. Do a _FileReadtoArray, there's where you should start. Need I explain more for the rest?
  17. LOL gafrost!! I believe u from a UDF for it some time ago. GuiCombo.au3 if I remember correctly, there's a function named _GUICtrlComboGetCount
  18. u might want to check out this one below forgot who did it, but it's nicely done #include <GUIConstants.au3> #include <Date.au3> Dim $Header_1 = "Machine" Dim $Header_2 = "Line" Dim $Header_3 = "Office" Dim $Name, $TotalTime, $Unit, $count = 33 Dim $TimerActive_[50], $Label_[50], $TButton_[50], $SButton_[50], $Input_[50], $Label_[50] Dim $Time_[50], $Timer_[50], $sTime_[50], $xk, $ck, $Left = 0, $Top = 20, $X $Today_File = @MON & "-" & @MDAY & "-" & @YEAR & ".txt" $Log = FileOpen($Today_File, 1) FileWriteLine($Log, "Logfile started: " & _DateTimeFormat( _NowCalc(), 0) & @CRLF & @CRLF) FileClose($Log) $Toy_Logo = @TempDir & "\Toy2-logo.jpg" FileInstall("C:\XPClean-web\Settings\XPClean-pics\Toy-box2-jpg.jpg", $Toy_Logo) $Toy_Banner = @TempDir & "\Toy-banr.jpg" FileInstall("C:\XPClean-web\Settings\XPClean-pics\Toy-box-jpg.jpg", $Toy_Banner) $Logo_icon = @TempDir & "\Toy-Icon.ico" FileInstall("C:\XPClean-web\Settings\XPClean-pics\Toy-box-Icon.ico", $Logo_icon) AdlibEnable("AllTimers", 500) GUICreate(" Toy BOX - Multi-Station-Timer", 981, 470) GUISetIcon($Logo_icon) $Icon_1 = GUICtrlCreatePic($Toy_Banner, 700, 370, 210, 90) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetCursor(-1, 0) GUICtrlSetTip(-1, "Click here - to Donate Now!!") ;Top computer label GUICtrlCreateLabel($Header_1 & "s", 0, 0, 980, 20, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x876B53) ;Middle phones label GUICtrlCreateLabel($Header_2 & "s", 0, 220, 980, 20, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x876B53) ;Bottom PC label GUICtrlCreateLabel($Header_3 & "s", 0, 340, 980, 20, $SS_CENTER, $WS_EX_STATICEDGE) GUICtrlSetFont(-1, 12, 700) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x876B53) For $X = 1 To 9 ; row 1 GUICtrlCreateLabel($Header_1 & " " & $X, $Left, $Top, 100, 20, $SS_CENTER) $Label_[$X] = GUICtrlCreateLabel("", $Left, $Top + 20, 100, 30, 0x1000) GUICtrlSetFont($Label_[$X], 16) GUICtrlSetData($Label_[$X], "00:00:00") $TButton_[$X] = GUICtrlCreateButton("Start", $Left, $Top + 50, 50, 20) $SButton_[$X] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 50, 50, 20) $Input_[$X] = GUICtrlCreateInput("", $Left, $Top + 70, 100, 20, 0x1000) ; row 2 GUICtrlCreateLabel($Header_1 & " " & $X + 9, $Left, $Top + 100, 100, 20, $SS_CENTER) $Label_[$X + 9] = GUICtrlCreateLabel("", $Left, $Top + 120, 100, 30, 0x1000) GUICtrlSetFont($Label_[$X + 9], 16) GUICtrlSetData($Label_[$X + 9], "00:00:00") $TButton_[$X + 9] = GUICtrlCreateButton("Start", $Left, $Top + 150, 50, 20) $SButton_[$X + 9] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 150, 50, 20) $Input_[$X + 9] = GUICtrlCreateInput("", $Left, $Top + 170, 100, 20, 0x1000) ; row 3 GUICtrlCreateLabel($Header_2 & " " & $X, $Left, $Top + 220, 100, 20, $SS_CENTER) $Label_[$X + 18] = GUICtrlCreateLabel("", $Left, $Top + 240, 100, 30, 0x1000) GUICtrlSetFont($Label_[$X + 18], 16) GUICtrlSetData($Label_[$X + 18], "00:00:00") $TButton_[$X + 18] = GUICtrlCreateButton("Start", $Left, $Top + 270, 50, 20) $SButton_[$X + 18] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 270, 50, 20) $Input_[$X + 18] = GUICtrlCreateInput("", $Left, $Top + 290, 100, 20, 0x1000) ; row 4 If $X < 7 Then GUICtrlCreateLabel($Header_3 & " " & $X, $Left, $Top + 340, 100, 20, $SS_CENTER) $Label_[$X + 27] = GUICtrlCreateLabel("", $Left, $Top + 360, 100, 30, 0x1000) GUICtrlSetFont($Label_[$X + 27], 16) GUICtrlSetData($Label_[$X + 27], "00:00:00") $TButton_[$X + 27] = GUICtrlCreateButton("Start", $Left, $Top + 390, 50, 20) $SButton_[$X + 27] = GUICtrlCreateButton("Stop", $Left + 50, $Top + 390, 50, 20) $Input_[$X + 27] = GUICtrlCreateInput("", $Left, $Top + 410, 100, 20, 0x1000) EndIf $Left = $Left + 110 Next GUISetState() While 1 $msg = GUIGetMsg() For $xk = 1 To $count If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then GUICtrlSetState($TButton_[$xk], $GUI_DISABLE) GUICtrlSetState($Input_[$xk], $GUI_DISABLE) $TimerActive_[$xk] = 1 $Timer_[$xk] = TimerInit() ElseIf $msg = $TButton_[$xk] Then MsgBox(64, "User Error", "Please Type in a User Name ", 3) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($SButton_[$xk]) = "Reset" Then GUICtrlSetData($Label_[$xk], "00:00:00") GUICtrlSetData($Input_[$xk], "") GUICtrlSetData($SButton_[$xk], "Stop") GUICtrlSetState($TButton_[$xk], $GUI_ENABLE) GUICtrlSetState($Input_[$xk], $GUI_ENABLE) EndIf If $msg = $SButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" And GUICtrlRead($SButton_[$xk]) = "Stop" Then $TimerActive_[$xk] = 0 GUICtrlSetData($SButton_[$xk], "Reset") ; GUICtrlSetColor($Label_[$xk], 0x000000) $Name = GUICtrlRead($Input_[$xk]) ; If $xk < 19 Then $Unit = $Header_1 & " " & $xk EndIf If $xk >= 19 And $xk < 28 Then $Unit = $Header_2 & " " & $xk - 18 EndIf If $xk >= 28 Then $Unit = $Header_3 & " " & $xk - 27 EndIf RecordStuff() EndIf If $xk = 33 Then ExitLoop Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func AllTimers() Local $Secs, $Mins, $Hour For $ck = 1 To $count If $TimerActive_[$ck] Then _TicksToTime(Int(TimerDiff($Timer_[$ck])), $Hour, $Mins, $Secs) $Time_[$ck] = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) If $sTime_[$ck] <> $Time_[$ck] Then GUICtrlSetData($Label_[$ck], $Time_[$ck]) If $Mins > 29 Then GUICtrlSetColor($Label_[$ck], 0xff0000) EndIf Next EndFunc;==>AllTimers Func RecordStuff() $LogStuff = FileOpen($Today_File, 1) FileWriteLine($LogStuff, "Station: " & $Unit & @CRLF) FileWriteLine($LogStuff, "User name: " & (GUICtrlRead($Input_[$xk])) & @CRLF) FileWriteLine($LogStuff, "Total time: " & (GUICtrlRead($Label_[$xk])) & @CRLF & @CRLF) FileClose($LogStuff) EndFunc;==>RecordStuff
  19. i believe you should use $CBS_DROPDOWNLIST
  20. I did reviewing of automation tool for my comapny as well and I reviewed automate. Generally, I would say AutoMate is much more easier than autoit. It's like using autoit without writng much code. Almost as good as autoit in terms of funtionality. Can detect more COM/API objects(I don't know what the heck is that, but there are some buttons and controls which autoit can't pick up, where automate can) than autoit. very low learning curve but -automate couldn't support Win9x platforms -not portable(you can't compile an EXE and use it on another computer) -the license isn't cheap -not very customizable(GUI creation and some others) there's quite a couple more software/tools which i reviewed, but we chose autoit in the end
  21. sorry to chime on this topic again When Valik replied to the topic, I was totally stumped. Sad to say I don't know anything about API and DLLs and all these seems pretty hard to understand for me. As I knew absolutely nothing about this API and DLL thing, I thought I'd research and study abit more before asking for more info, to help my understanding. From the tiny bits of info I've gathered up to now and after reading Valik's reply for the second time, I think what Valik meant is that the DLL command used in "ControCommand - SelectString" is similar to gafrost's DLL call command. I understand Valik's point that SendMessage() would still block my intended script execution, but I want to figure out what's the difference between the DLL command used in "ControCommand - SelectString" from gafrost's, which makes it able to bring up the pop-up dialog?
  22. wow, that's pretty long let me take sometime to digest I'll try to work it out the AutoIt way after the digesting Thanks!!
  23. Got this command from Scriptomatic snipped a little to get what I want $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output= "" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PrintJob", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $Output = $Output & "Document: " & $objItem.Document & @CRLF If Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_PrintJob" ) EndIf The code works when something's in the spooler but doesn't display the messagebox when the spooler's empty My purpose for this code is to : Display what's inside the spooler if it's not empty if it's empty, prompt or return me something Anyone who's familiar with this please help?
  24. I remember seeing something from beta that can read console output OK, found it here
×
×
  • Create New...