Jump to content

greenmachine

Active Members
  • Posts

    1,246
  • Joined

  • Last visited

Everything posted by greenmachine

  1. I just thought of something related to the clock and the click-through option. If you are considering implementing the option, keep reading. I would suggest that it is not used with a modifier key. Take this for example: suppose I have the clock enlarged (full-screen-ish, just for the sake of the story), and I want to be able to click through it and deal with the files and such in a folder behind the clock. If I'm currently pressing Ctrl or Alt or Shift or any combination, the action that I might want to take on the files will be affected by the modifier key used to toggle the click-through. In other words, you would want to be able to have those keys free to interact with the screen behind the clock (as if it wasn't there). Long story short, this is why it's a good reason for it to be a toggle from the tray (or something similar).
  2. I don't remember how it is in AutoIt, but this works in C++ to allow windows to be clicked-through. I used it as a context/tray menu toggle. It might be useful for you. if ( isClickable ) { SetWindowLong ( hWnd, GWL_EXSTYLE, GetWindowLong ( hWnd, GWL_EXSTYLE ) | WS_EX_TRANSPARENT ); } else { SetWindowLong ( hWnd, GWL_EXSTYLE, GetWindowLong ( hWnd, GWL_EXSTYLE ) ^ WS_EX_TRANSPARENT ); } isClickable = !isClickable;
  3. I saw that my topic had gotten recent replies, and you linked to this topic, so I figured I ought to take a look. I tried out your clock, and had to log in (for the first time in a long while) to voice my approval. I haven't fully tested it, but what I've seen so far is nice. Good work. [Edit] Also figured I'd give it 5 stars...
  4. What do you mean it does not work? It goes through the specified directory and lists all the files contained within. That sounds like a working piece of code to me.
  5. I shortened down the code for all the inputs to this: Global $Left[9] = [0, 5, 60, 120, 175, 235, 290, 350, 405] For $i = 1 To 8 If Mod ($i, 2) = 1 Then GUICtrlCreateInput ("100.00", $Left[$i], 40, 50, 20) For $j = 1 To 5 GuiCtrlCreateInput("100.00", $Left[$i], 65 + ($j-1)*25, 50, 20) Next Next Of course, you're going to want to store those in an array so that you can access them later. But you can figure that out yourself.
  6. I don't see how hard it is to look in the helpfile under FileFindFirstFile (as been suggested several times). Very slightly modified version of the helpfile script gives me this: $First = FileFindFirstFile (@ScriptDir & "\*.*") If $First = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf $filestr = "" While 1 $file = FileFindNextFile($First) If @error Then ExitLoop $filestr &= $file & @CRLF WEnd MsgBox(4096, "Files:", $filestr) FileClose($First)
  7. #include <GUIConstants.au3> opt ("GUIOnEventMode",1) ;make GUI1 $GUI1=GUICreate("GUI1") $button1=GUICtrlCreateButton("button1", 50, 50) GUICtrlSetOnEvent($button1, "action1") ;Make GUI2 $GUI2 = GUICreate("GUI2") $button2=GUICtrlCreateButton("button2", 50, 50) GUICtrlSetOnEvent($button2,"action2") GUISetOnEvent ($GUI_EVENT_CLOSE, "timetogo") GUIsetstate(@SW_SHOW,$GUI1) While 1 sleep (1000) WEnd func action1 () GUISetState(@SW_SHOW,$GUI2) endfunc func action2 () MsgBox(0,"OK","You pressed button2") endfunc Func timetogo() Exit EndFunc When you use GUIOnEventMode, it doesn't respond while inside functions (not sure why). Since all you're doing is sleeping inside the function, just let it return to the global sleep.
  8. I was reading Simucal's thread about his Sliding Toolbar, and I decided to make my own. This one places itself in either the upper-left or lower-right of the screen (can be changed to suit your needs), doesn't take up much space, and forms to the height of the desktop. It can be fully customized from within the script itself. Requires beta to run. Please let me know if there are any bugs left over - most of my scripting was done while I had a completed INI file ready, but I think it works as it should. Toolbar.au3
  9. Just so you guys know, the dealer in BlackJack always stops at 17 or higher - they do not try to get higher than the player. Thus, when the player has 18 and the dealer has 17, the dealer stops. It does not try to hit again (potentially getting a 2, 3, or 4 to win). The code fix is really simple, but I just thought you should know.
  10. This works. You were almost there, but you just have to put the window styles in the right places. HotKeySet ("+{ESC}", "IWannaQuit") Global $Width = 100, $Height = 100, $Left = MouseGetPos (0) - $Width/2, $Top = MouseGetPos (1) - $Height/2 $ClickWin = GUICreate ("Click Through Me", $Width, $Height, $Left, $Top, $WS_POPUP, BitOR ($WS_EX_TRANSPARENT, $WS_EX_LAYERED, $WS_EX_TOPMOST)) WinSetTrans ($ClickWin, "", 150) GUISetState () While 1 Sleep (10) TheMouseMoved() WEnd Func TheMouseMoved() $WinPos = WinGetPos ($ClickWin) WinMove ($ClickWin, "", MouseGetPos (0) - $Width/2, MouseGetPos (1) - $Height/2) EndFunc Func IWannaQuit() Exit EndFunc
  11. Created a quick digital clock based off the one in my room. It's really simplified right now, but I plan to combine it with the analog clock and have both work together. The alarm notification doesn't do anything right now because there is no alarm attached to it (it is on the analog clock). Global Const $SS_RIGHT = 2 HotKeySet ("{SPACE}", "SpeakTime") Global $Mid = 300, $MidStep = $Mid/3, $Alarm_OnOff = 0, $IsMilitary = 0 Global $Digital_Clock, $Alarm_Text, $PM_Text, $Military_Text, $Alarm_Light, $PM_Light, $Military_Light Global $Time_TensHours, $Time_Hours, $Time_Colon, $Time_TensMins, $Time_Minutes, $Hour, $Min $Digital_Clock = GUICreate ("Digital Clock", $Mid*2, 90, 100, 100, 0x80000000) GUISetBkColor (0x000000) $Alarm_Text = GUICtrlCreateLabel ("Alarm", 5, 10, 30, -1, $SS_RIGHT) GUICtrlSetColor (-1, 0xFFFFFF) $PM_Text = GUICtrlCreateLabel ("PM", 5, 40, 30, -1, $SS_RIGHT) GUICtrlSetColor (-1, 0xFFFFFF) $Military_Text = GUICtrlCreateLabel ("Military", 2, 70, 33, -1, $SS_RIGHT) GUICtrlSetColor (-1, 0xFFFFFF) GUISetFont (10, Default, Default, "Wingdings") $Alarm_Light = GUICtrlCreateLabel ("l", 40, 10) GUICtrlSetColor (-1, $Alarm_OnOff * 0xFF0000) $PM_Light = GUICtrlCreateLabel ("l", 40, 40) GUICtrlSetColor (-1, IsPM($IsMilitary) * 0xFF0000) $Military_Light = GUICtrlCreateLabel ("l", 40, 70) GUICtrlSetColor (-1, $IsMilitary * 0xFF0000) GUISetFont (60, 400, Default, "Lucida Console") $Time_TensHours = GUICtrlCreateLabel (GetTensHours($IsMilitary), $MidStep, 10) GUICtrlSetColor (-1, GetTensHoursColor($IsMilitary)) $Time_Hours = GUICtrlCreateLabel (GetHours($IsMilitary), $MidStep*2, 10) GUICtrlSetColor (-1, 0xFF0000) $Time_Colon = GUICtrlCreateLabel (":", $MidStep*3, 5) GUICtrlSetColor (-1, 0xFF0000) $Time_TensMins = GUICtrlCreateLabel (Int (@MIN/10), $MidStep*4, 10) GUICtrlSetColor (-1, 0xFF0000) $Time_Minutes = GUICtrlCreateLabel (@MIN - Int (@MIN/10)*10, $MidStep*5, 10) GUICtrlSetColor (-1, 0xFF0000) GUISetState () $Hour = @HOUR $Min = @MIN While 1 If @HOUR <> $Hour Then GUICtrlSetColor ($PM_Light, IsPM($IsMilitary) * 0xFF0000) GUICtrlSetData ($Time_TensHours, GetTensHours($IsMilitary)) GUICtrlSetColor (-1, GetTensHoursColor($IsMilitary)) GUICtrlSetData ($Time_Hours, GetHours($IsMilitary)) GUICtrlSetColor (-1, 0xFF0000) $Hour = @HOUR EndIf If @MIN <> $Min Then GUICtrlSetData ($Time_TensMins, Int (@MIN/10)) GUICtrlSetColor (-1, 0xFF0000) GUICtrlSetData ($Time_Minutes, @MIN - Int (@MIN/10)*10) GUICtrlSetColor (-1, 0xFF0000) $Min = @MIN EndIf Sleep (100) WEnd Func GetTensHours($MilitaryTime = 0) If @HOUR = "00" And Not $MilitaryTime Then Return 1 If $MilitaryTime Or @HOUR <= 12 Then Return Int (@HOUR/10) Return Int ((@HOUR-12)/10) EndFunc Func GetHours($MilitaryTime = 0) If @HOUR = "00" Then Return 2 If $MilitaryTime Or @HOUR <= 12 Then Return @HOUR - Int (@HOUR/10)*10 Return @HOUR - Int ((@HOUR-12)/10)*10 - 12 EndFunc Func GetTensHoursColor($MilitaryTime = 0) If $MilitaryTime Then Return 0xFF0000 If GetTensHours(0) = 0 Then Return 0x000000 Return 0xFF0000 EndFunc Func IsPM($MilitaryTime = 0) If $MilitaryTime Then Return 0 If @HOUR >= 12 Then Return 1 Return 0 EndFunc Func SpeakTime() Local $o_speech = ObjCreate("SAPI.SpVoice") If $IsMilitary Then $o_speech.Speak ("The time is " & @HOUR & @MIN) Else If @HOUR > 12 Then If @MIN = "00" Then $o_speech.Speak ("The time is " & @HOUR-12 & " O'Clock P M") Else $o_speech.Speak ("The time is " & @HOUR-12 & " " & @MIN & " P M") EndIf ElseIf @HOUR = "00" Then If @MIN = "00" Then $o_speech.Speak ("The time is 12 O'Clock A M") Else $o_speech.Speak ("The time is 12 " & @MIN & " A M") EndIf Else If @MIN = "00" Then $o_speech.Speak ("The time is " & @HOUR & " O'Clock A M") Else $o_speech.Speak ("The time is " & @HOUR & " " & @MIN & " A M") EndIf EndIf EndIf $o_speech = 0 EndFunc
  12. Hmm, lots to catch up on... @mr.underperson - Click+Drag to move, Ctrl+Click+Drag to resize, maybe Alt+Click+Drag to change transparency? I could do that with Larry's Mouse Hook dll... but if there's a way to do it without relying on third-party scripts I'd really like to know. INI saving is a piece of cake, I agree. I'll get to that too. @Neoborn - Allowing color changing shouldn't be too tough, but I don't know how to go about making my hands anti-aliased. Do you have any ideas? @odklizec - Could you clarify on how I would go about making the "jump" smoother? I'm not exactly sure what you mean. @Daniel W - What? @nitekram - Default settings and user-defined settings? I can do that.
  13. Just thought I'd let you know that I feel question #12 on the third exam is poorly worded. That was the only one I got stuck on because I couldn't figure out what it was trying to say.
  14. It would also work to change the placement of the checks: If (@Error=1) And (Not IsArray($FileList)) Then The reason is because each function resets the value of @error, which means that the IsArray function sets @error to 0 (unless it fails, which isn't the case here). That's why checking for @error = 1 after the IsArray check didn't get where you wanted to, and why checking it beforehand will work.
  15. In this part: For $i = 1 to $var[0] MsgBox(4096,"Drive " & $i, $var[$i]) Next Simply change the msgbox to include the labels. For $i = 1 to $var[0] MsgBox(4096,"Drive " & $i, $var[$i] & @CRLF & "label = " & DriveGetLabel ($var[$i])) Next
  16. "What I want to do is: When the two pixels match then break the loop, but only then. If only one pixel is matched stay in the loop." This will work: While ((PixelGetColor (71, 921) <> 16711680) Or (PixelGetColor (350, 250) <> 255)) Sleep (500) WEnd This will also work (they are essentially the same thing): Do Sleep (500) Until ((PixelGetColor (71, 921) = 16711680) And (PixelGetColor (350, 250) = 255)) The reason they work: While: 1st case - neither pixel matches: since you want the loop to continue, one or the other needs to be true. Both are true, so it continues. 2nd case - first pixel matches, second doesn't: you still want the loop to continue; the first case is false, but the second case is true. Since I used Or, the loop will continue. 3rd case - first pixel doesn't match, second does: same as 2nd case, but other way around. 4th case - both match: you want the loop to stop. Since both will be false, the loop will stop. Success. Do/Until: This one is much more straightforward, since it says do this UNTIL both match. So, when both pixel match the checks, the loop stops. Edit - forgot to finish. Another point: The reason the "While this and that" acts like an OR is because it is. What you're saying is that while both this and that are true, continue the loop. Another way of putting it is "if this or that is false, break the loop". You happen to be checking for negatives (if pixel is not color), so it got confusing.
  17. They REALLY look the same. Still, that's some ugly code for more than just that reason. If you set $i to be something while it's looping, the loop never ends. If it were to get past the part where $i is set to o, then it would be out of bounds because $x_val is 75 and the max index of $x_va1 is 20.... I'm starting to think I really don't know what's going on here - the code isn't really understandable and I still can't tell what he's trying to do.
  18. I'll assume by "state" of the checkbox you mean whether it is checked or not. For your code exactly how it is, this should work: $msg = "" For $i = 5 to 29 $msg &= "Checkbox " & $i & " state: " & GUICtrlRead (Eval ("Checkbox_" & $i)) & @CRLF Next MsgBox (0, "State - 1 is checked, 4 is unchecked", $msg) Uses beta for &=, change to $msg = $msg & ... for production. You could also turn the checkbox vars into an array and make accessing them simpler. Edit - this is how to check the state of each one. To attach it to a button, put it in the GUIGetMsg() loop (if you have one), or set a GUI Event to point to that function. In order to do something if a certain checkbox is checked, just use if statements where applicable.
  19. Heh, right.. I used a test file that already has all the includes. You need #include <file.au3> at the top.
  20. What error? I used 3.1.1.118 and got no error.
  21. Uhh, you can't have an int variable and an array with the same name. Rename your variables to be unique and you'll be ok.
  22. It's all in your head. That error means that you tried to use [] notation on a variable that wasn't an array. It is likely that the variable is supposed to be an array if the code goes as planned, and you didn't error check properly. It's really not that tough....
  23. There's no need for the Dim inside the loop - that tries to recreate the array each time. What are you trying to do exactly? Where did $x_val come from? Why are you trying to turn an integer into an array?
  24. If you know the file, can I assume you know the extension? If so, this searches C:\ and all subdirectories for that extension, and then finds the file from the output. #include <file.au3> Global $ReadArray[2], $found = 0 ; example file $File = "welcome" $Ext = ".html" RunWait (@ComSpec & " /c dir c:\*" & $Ext & " /s /b > c:\outputfile.txt", "", @SW_HIDE) _FileReadToArray ("c:\outputfile.txt", $ReadArray) For $i = 1 To $ReadArray[0] If StringInStr($ReadArray[$i], $File & $Ext) Then MsgBox (0, "Found File", $ReadArray[$i]) $found = 1 EndIf Next If $found = 0 Then MsgBox (0, "Finished", "No Files Found") FileDelete ("c:\outputfile.txt") Edit - D'oh! Forgot #include.
×
×
  • Create New...