Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/03/2014 in all areas

  1. DatMCEyeBall

    Button problem

    I started this recursion mess, so I'll fix it. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ; Switch to event mode Global $fRunning = True Global $fPaused = False Global $fCounting = False Global $iCount = 0 $Form1 = GUICreate("Form1", 310, 437, 345, 194) $Button2 = GUICtrlCreateButton("Pauza", 80, 128, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Exit", 80, 70, 75, 25, $WS_GROUP) $Button4 = GUICtrlCreateButton("Count", 80, 95, 75, 25, $WS_GROUP) ; Register events GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlSetOnEvent($Button2, "_Pause") GUICtrlSetOnEvent($Button3, "_Exit") GUICtrlSetOnEvent($Button4, "_Count") HotKeySet("p", "_Pause") GUISetState(@SW_SHOW) Global $hTimer = TimerInit() While $fRunning If Not $fPaused Then ;Only do other stuff when we are not paused If $fCounting And TimerDiff($hTimer) >= 1000 Then $hTimer = TimerInit() $iCount += 1 ToolTip("Time: " & $iCount, 0, 0) EndIf EndIf Sleep(100) ; Sleep to avoid high CPU usage WEnd Func _Pause() $fPaused = Not $fPaused If Not $fPaused Then _ShowTip("Program is running", 0, 0) GUICtrlSetData($Button2, "Pause") Else _ShowTip("Program is paused", 0, 0) GUICtrlSetData($Button2, "Run") EndIf EndFunc ;==>_Pause Func _Count() If _CheckIfPaused() Then Return ; Checks if the fPaused flag is set, and returns if so $fCounting = Not $fCounting If Not $fCounting Then _ShowTip("Counting stopped") EndIf EndFunc ;==>_Count Func _Exit() ; Uncomment if you want the user to be able to exit if the script is paused ;~ If _CheckIfPaused() Then Return $fRunning = False EndFunc ;==>_Exit Func _CheckIfPaused() If $fPaused Then _ShowTip("", 0, 0) ToolTip("You can't run script while the program is paused", 0, 0) Return True EndIf Return False EndFunc ;==>_CheckIfPaused Func _ShowTip($sText, $iX, $iY, $iTime = 2000) ToolTip($sText, $iX, $iY) AdlibRegister("_CloseTips", $iTime) EndFunc ;==>_ShowTip Func _CloseTips() AdlibUnRegister("_CloseTips") ToolTip("") EndFunc ;==>_CloseTips If you want me to explain any line in the above code, then please do so by commenting.
    1 point
  2. BrewManNH

    Button problem

    Do NOT use that like that or eventually your script will crash. You're calling the _Pause function from within the _Pause function, you're going to get a recursion error eventually if you use this for any length of time.You should be returning from all your functions and use one While loop, not a separate one in each function, not only is it a bitch to troubleshoot problems that way, it's not necessary if you write the code to deal with things like this. Check out the GUIRegisterMsg demo I have linked in my signature, you can use one loop and still action buttons without needing to use the terrible code I see in this thread.
    1 point
  3. Mat

    Android development

    Every android app has a list of permissions, which the user then agrees to when they install the app. The full list is here: http://developer.android.com/reference/android/Manifest.permission.html This one may allow you to do what you want. I'm not a phone developer, and have no experience with this, but it looks like the most likely option.
    1 point
  4. JohnOne

    Button problem

    #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 310, 437, 345, 194) $Button2 = GUICtrlCreateButton("Pauza", 80, 128, 75, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Exit", 80, 70, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $fPaused = False HotKeySet("{p}", "_Pause") Func _Pause() $fPaused = Not $fPaused If Not $fPaused Then ToolTip("Program is running", 0, 0) GUICtrlSetData($Button2, "Pause") Else ToolTip("Program is pause.", 0, 0) GUICtrlSetData($Button2, "Run") EndIf While $fPaused Switch GUIGetMsg() Case $Button2 _Pause() Case $Button3 _Exit() EndSwitch WEnd EndFunc ;==>_Pause Func _Exit() Exit EndFunc ;==>_Exit While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button2 _Pause() Case $Button3 _Exit() EndSwitch WEnd
    1 point
  5. This if not @error then Needs to changed to test that both $firstfile and $secondfile are arrays (IsArray() function). You can leave continueloop and get shut of recursive _Test()
    1 point
  6. 1) Because PixelSearch fails 2) _WinAPI_RedrawWindow
    1 point
  7. trancexx

    Get CLSID from IID

    You actually don't need to call QueryInterface by yourself because ObjCreateInterface will do that for you by definition. So, just call ObjCreateInterface for $sIID_IPersistFile on ShellLink object. To furher reduce the code, it should be obvious after that being said, that you can simply call ObjCreateInterface with $CLSID_ShellLink as CLSID, $sIID_IPersistFile as IID and $tagIPersistFile interface description to get (wanted) IPersistFile object.
    1 point
  8. Melba23

    Mix array

    AutID, You can remove the count in the [0] element by using the $STR_NOCOUNT flag - the Help file explains this clearly. As to randomising the array order - if you use the latest Beta there is a new function _ArrayShuffle that does exactly that. If you wish I could post the code here for you to use in the current release. M23
    1 point
×
×
  • Create New...