Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/20/2012 in all areas

  1. Bravo AdmiralAlkex. Apparenly you can see both trees and the forest.
    1 point
  2. I meant the dll. Never mind, I know what's wrong. Will be fixed for next release. Thank you for your cooperation.
    1 point
  3. #include <File.au3> $sDir = FileSelectFolder("Select","") If @error Then Exit $Counter = 1 $Files = _FileListToArray($sDir,"*",1) For $Index = 1 To $Files[0] If StringRight($Files[$Index],4) = ".doc" Then FileMove($sDir & "" & $Files[$Index],$sDir & "Document_" & $Counter & ".doc") ; Rename $Counter += 1 Else FileDelete($sDir & "" & $Files[$Index]) EndIf Next
    1 point
  4. If you really want to get thses events in your loop you can use a Dummy control. #include <GUIConstantsEx.au3> #include <ListboxConstants.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <File.au3> #include <Timers.au3> Dim $LogWindow=0 Func CreateLogWindow($Title,$Width,$Height) If $LogWindow<>0 Then MsgBox(0,"Internal Error","Log window was already created") Return EndIf GUICreate($Title,$Width,$Height) $LogWindow=GUICtrlCreateList("",5,5,$Width-10,$Height-10,$LBS_NOSEL+$WS_VSCROLL) GUISetState() EndFunc Func LogString($LogText) If $LogWindow=0 Then MsgBox(0,"Internal Error","Log window used but not yet created") CreateLogWindow("LogWindow",800,300) EndIf GUICtrlSetData($LogWindow,$LogText) GUICtrlSendMsg($LogWindow,$WM_VSCROLL,$SB_LINEDOWN,0) EndFunc ; Start of program Global $Dummy CreateLogWindow("Log",900,500) $MainWindow=GUICreate("Test-1",370,86) ; The main window $Button_1=GUICtrlCreateButton("Button_1",10,53) $Button_2=GUICtrlCreateButton("Button_2",100,53) $Exit=GUICtrlCreateButton("Cancel (Exit)",190,53) $Dummy = GUICtrlCreateDummy() GUISetState() $Timer_1=_Timer_SetTimer($MainWindow,1000,"TimerCallback",-1) LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Started Timer_1 1000ms") $Timer_2=_Timer_SetTimer($MainWindow,1900,"TimerCallback",-1) LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Started Timer_2 1900ms") $cnt=0 While 1 $Msg = GUIGetMsg() Switch $Msg Case $Dummy Switch GUICtrlRead($Dummy) Case $Timer_1 LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Received event via Timer_1") Case $Timer_2 LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Received event via Timer_2") EndSwitch Case $Button_1 LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Received Button_1 event") Case $Button_2 LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Received Button_2 event") Case $Exit LogString(@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&": Received Exit event") MsgBox(0,"Handling Exit event","Exiting") Exit Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func TimerCallback($hWnd, $Msg, $iIDTimer, $dwTime) GUICtrlSendToDummy($Dummy,$iIDTimer) EndFunc
    1 point
  5. If you have a large list, you'll find the _Array UDF functions painfully slow. You could play around with something liek this: Local $array[14]= [1, 3, 1, 0, 1, "0","2","2","3", 0, "1", "", "Arf!", "Arf!"] For $x = 0 to UBound($array) - 1 ; count 'em up $y = "__" & $array[$x] If IsString($array[$x]) Then $y &= "_s" If IsDeclared($y) Then Assign($y, Eval($y) + 1) $array[$x] = Chr(0) Else Assign($y, 1) EndIf Next For $x = 0 to UBound($array) - 1 ; display results If $array[$x] == Chr(0) Then ContinueLoop If IsString($array[$x]) Then $suffix = "_s" $desc = "str" Else $suffix = "" $desc = "num" EndIf ConsoleWrite("Value: " & $array[$x] & " (" & $desc & ") first found in element: " & $x & " occurs: " & Eval("__" & $array[$x] & $suffix) & @CRLF) Next You could almost cut that code in half if you didn't care about distinguishing between 1 and "1", or 0 and "0" and "".
    1 point
  6. I have no problem trying to answer general questions that everyone can learn from. In this case I think you are right on all counts. I'm outa here!
    1 point
  7. My guess is that whatever it is he's trying to automate violates the forum rules which is why he's being so obtuse. Either that or he has no clue what he's doing either.
    1 point
  8. czardas

    HTML editor

    Probably because you're all too lazy to read the whole thread.
    1 point
  9. Thanks Melba! While not a beginner, up 'til now i haven't had to deal with them. i'm not really a programmer, i'm just someone trying to make my job easier and quicker, if that means quickly throwing something together that works, i'll give it a try. Elegance in programming constructs is not in me, brute force on the other hand... i'll read through that tutorial too. Thanks! Dave
    1 point
×
×
  • Create New...