Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/25/2015 in all areas

  1. Gianni

    Snowfall

    it's snowing.... #include <WindowsConstants.au3> #include <WINAPI.au3> Local $isnowflakes = 500 ; number of snowflakes Local $iMinR = 5 ; minimum length of the snowflake's side Local $iMaxR = 8 ; max length Local $aSnow[$isnowflakes][5] Local $AlphaKey = 0xABABAB, $hBackground = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUPWINDOW, $WS_EX_LAYERED + $WS_EX_TOPMOST) GUISetBkColor($AlphaKey, $hBackground) _WinAPI_SetLayeredWindowAttributes($hBackground, $AlphaKey, 0, $LWA_COLORKEY) GUISetState(@SW_SHOW, $hBackground) For $i = 0 To UBound($aSnow) - 1 _Randomize($aSnow, $i, $iMinR, $iMaxR) $aSnow[$i][3] = GUICtrlCreateLabel("", $aSnow[$i][1], $aSnow[$i][2], $aSnow[$i][0], $aSnow[$i][0]) GUICtrlSetBkColor(-1, 16777215) ; snow white Next While 1 For $i = 0 To UBound($aSnow) - 1 $aSnow[$i][2] += $aSnow[$i][4] ; increment y pos GUICtrlSetPos($aSnow[$i][3], $aSnow[$i][1], $aSnow[$i][2]) If $aSnow[$i][2] > @DesktopHeight Then _Randomize($aSnow, $i, $iMinR, $iMaxR) GUICtrlSetPos($aSnow[$i][3], $aSnow[$i][1], $aSnow[$i][2], $aSnow[$i][0], $aSnow[$i][0]) EndIf Next WEnd Func _Randomize(ByRef $aSnow, $i, $iMinR, $iMaxR) $aSnow[$i][0] = Random($iMinR, $iMaxR, 0) ; dimension of snow $aSnow[$i][1] = Random(0 - $iMaxR, @DesktopWidth + $iMaxR, 0) ; x position $aSnow[$i][2] = 0 - $iMaxR ; y position (out of screen at startup) $aSnow[$i][4] = Random(0.1, $iMaxR * 3) EndFunc ;==>_Randomize
    6 points
  2. langthang084, I think not - Accelerator keys are only active if the GUI with which they are associated is active, so as soon as one of the other GUIs has focus the dummy control will not fire. You could do something like this - store the GUI handles and associated ControlDs in an array: #include <GUIConstantsEx.au3> Global $hMain = GUICreate("New AutoIt v3 Script", 228, 130, -1, -1) Global $Button_1 = GUICtrlCreateButton("Button1", 60, 20, 140, 40) Global $Button_2 = GUICtrlCreateButton("Button2", 60, 80, 140, 40) GUISetState() $Gui1 = GUICreate("GUI - 1", 200, 100, 0, 0) $ButtonGui1 = GUICtrlCreateButton("Test Gui1", 60, 20, 100, 40) GUISetState(@SW_HIDE, $Gui1) $Gui2 = GUICreate("GUI - 2", 200, 100, 0, 0) $ButtonGui2 = GUICtrlCreateButton("Test Gui2", 60, 20, 100, 40) GUISetState(@SW_HIDE, $Gui2) ; Array holding GUI handles and controls Global $aGUIData[3][2] = [[0, 0], [$Gui1, $ButtonGui1], [$Gui2, $ButtonGui2]] Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 GUISetState(@SW_SHOW, $Gui1) GUISetState(@SW_HIDE, $Gui2) _SetAccel(1) Case $Button_2 GUISetState(@SW_SHOW, $Gui2) GUISetState(@SW_HIDE, $Gui1) _SetAccel(2) Case $ButtonGui1 MsgBox(0, "", "Test GUI 1") Case $ButtonGui2 MsgBox(0, "", "Test GUI 2") EndSwitch Until False Func _SetAccel($iIndex) ; Set accelerators for the active GUI Local $aAccelKeys[1][2] = [["{ENTER}", $aGUIData[$iIndex][1]]] GUISetAccelerators($aAccelKeys, $aGUIData[$iIndex][0]) EndFunc ;==>_SetAccelM23
    1 point
  3. langthang084, Just reset the accelerator key each time you change the GUI: #include <GUIConstantsEx.au3> Global $hMain = GuiCreate("New AutoIt v3 Script", 228, 130, -1, -1) Global $Button_1 = GuiCtrlCreateButton("Button1", 60, 20, 140, 40) Global $Button_2 = GuiCtrlCreateButton("Button2", 60, 80, 140, 40) GUISetState() $Gui1 = GUICreate("GUI - 1", 200, 100, 0, 0) $ButtonGui1 = GUICtrlCreateButton("Test Gui1", 60, 20, 100, 40) GuiSetState(@SW_HIDE, $Gui1) $Gui2 = GUICreate("GUI - 2", 200, 100, 0, 0) $ButtonGui2 = GUICtrlCreateButton("Test Gui2", 60, 20, 100, 40) GuiSetState(@SW_HIDE, $Gui2) Do Switch GuiGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 GUISetState(@SW_SHOW, $Gui1) GuiSetState(@SW_HIDE, $Gui2) Local $aAccelKeys[1][2] = [["{enter}", $ButtonGui1]] GUISetAccelerators($aAccelKeys, $Gui1) Case $Button_2 GUISetState(@SW_SHOW, $Gui2) GuiSetState(@SW_HIDE, $Gui1) Local $aAccelKeys[1][2] = [["{enter}", $ButtonGui2]] GUISetAccelerators($aAccelKeys, $Gui2) case $ButtonGui1 MsgBox(0, "", "Test GUI 1") case $ButtonGui2 MsgBox(0, "", "Test GUI 2") EndSwitch Until FalseM23
    1 point
  4. Note that even with C you don't have direct control over how dynamically allocated variables and storage get destroyed. This is pretty low-level stuff and also depends on the development platform. Not saying it can't be done, just that this isn't as easy as is may sound. C++ destructors give you a much better control, for instance.
    1 point
  5. I found the problem in the UDF. The function _APEv2Tag_ReadFromFile is missing a FileClose before it returns at the end. So if there's no APE tags found in the file, the handle doesn't get closed. Add this line just before the return statement. FileClose($hfile) ; <<<<<<<<<<<<<<<<<<<<<<<< Add this line Return $APEv2_TAGINFO
    1 point
  6. RaySS, Why do you insist on using FindFirst/NextFile when we have perfectly good functions (_FilListToArray/_FileListToArrayRec) which make coding so much easier? The latter of those functions will even let you search for multiple patterns within a single pass. This appears to do what you require when I test with dummy files in my system: #include <File.au3> #include <Array.au3> Local $sTopDirectory = "E:\Clif\DoublestarSAVED\" Global $aFilesFound[1] = [0] $aList = _FileListToArray($sTopDirectory, Default, $FLTA_FOLDERS) ;How many subdirectories in top directory? ;Allocate space for number of subdirectories. Local $aConCat[$aList[0]], $aDateTime[$aList[0] + 1], $aFiles[$aList[0] + 1], $aComment[$aList[0] + 1] If IsArray($aList) Then For $a = 1 To $aList[0] If StringInStr($aList[$a], "for lucky") Then ContinueLoop $sSubdirectoryName = $sTopDirectory & $aList[$a] ConsoleWrite(@CRLF & "Subdirectory Name: " & $sSubdirectoryName & @CRLF) $aFound = _FileListToArrayRec($sSubdirectoryName, "*_0000.fit;*_1999.fit;*-9999.fit", $FLTA_FILES) ; ;_ArrayDisplay($aFound, $aList[$a], Default, 8) ; Should you want to check If IsArray($aFound) Then ; Increase size of array $aFilesFound[0] += 1 ReDim $aFilesFound[$aFilesFound[0] + 1] ; Get time for each folder and add to array $aFilesFound[$aFilesFound[0]] = FileGetTime($sTopDirectory & $aList[$a], $FT_CREATED, $FT_STRING) & "|" & $aList[$a] & "|" & $aFound[0] EndIf Next EndIf _ArrayDisplay($aFilesFound, "Final", Default, 8)M23
    1 point
  7. Wow, this script resurfaced again huh? Frankly I'm surprised it still worked somewhat, not just because AutoIt has updated, but so has Windows. I've grown a lot as an AutoIt scripter since then and felt like this script could use a face lift. I've updated/rewrote the code to incorporate some standards and best practices I've adopted. I also left the old script up so people can compare the two and see what code improvement looks like over time...in this very specific instance. Might be eye-opening for some. See my first post in this thread with the updated code. @llewxam - Might want to take a looksie just to see what I did.
    1 point
  8. Jon

    Forum Rules

    We want the forum to be a pleasant place for everyone to discuss AutoIt scripting, and we also want to protect the reputation of AutoIt. So we ask you to respect these simple rules while you are here: Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. 2. Do not post material that could be considered pornographic, violent or explicit - or express personal opinions that would not be acceptable in a civilized society. Do not post any copyrighted material unless the copyright is owned by you or by this site. 3. To protect this community, any files posted by you are subject to checks to ensure that they do not contain malware. This includes, but is not limited to, decompilation and reverse engineering. 4. Do not flame or insult other members - and just report the thread to a Moderator (see below) if you are so attacked. 5. Do not PM other users asking for support - that is why the forum exists, so post there instead. 6. Do not create multiple accounts - if you inadvertently created multiple accounts then contact a Moderator to close the unwanted ones. 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. 9. Do not post in a thread while the Moderating team are actively trying to determine whether it is legal. The Moderation team will do their best to act in fair and reasonable manner. Sanctions will only be applied as a last resort and any action taken will be explained in the relevant thread. If moderation action is taken, you will need to acknowledge this through a dialog or you will be unable to post further in the forum. Please note that this dialog is not an agreement that the warning was justified - it is only there so that members are aware that moderation action has been taken and that they may have certain restrictions applied to their account. If you feel that you have been unfairly moderated then contact the Moderator concerned - using a PM or the "Report" button is preferable to opening a new thread (although new members may have to do this). But do be aware that the Moderation team has the final word - the rules are set out by the site owner and you are only welcome here if you respect his wishes. Signatures and Avatars There is no formal policy for the use of signatures but if a moderator thinks it is too big and/or distracting then you may be asked to tone it down. No-one likes wading through signatures that are a page high. Similarly for avatars, expect distracting flashing and animated gifs to be removed. Reporting If you feel a post needs Moderator attention, please use the "Report" button next to the post date at the top. You can then enter details of why you have reported the post - but there is no need to include the content of the post as that is done automatically. The Moderating team will be alerted to the post and will deal with it as soon as they can. If you suspect a EULA violation, do not expect the Moderating team to do all the work - please provide some evidence in the report such as a copy of (or link to) the EULA in question, as well as the section you believe has been violated. Finally, please do not enter into an argument with the original poster - that is why we have Moderators. Spam Please do not react to spam in any way other than reporting it. Multiple reports are combined by the forum software, so there is no need to announce that you have reported the spam - in fact doing so only increases the work for the Moderator who deals with it. Interacting with this website Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login. Automated posting or sending messages on the forum. Automated manipulation of polls, user reputation or other forum features. Automated creation or comments on issue tracker tickets. Automated creation or editing of wiki pages. Other abuses which are either examples of excessive bandwidth usage or automation of the site. Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.
    1 point
  9. Well, that's exactly the behavior I expected from ControlClick() with no ControlID. Glad you found a solution.
    1 point
×
×
  • Create New...