persmash Posted January 18, 2013 Share Posted January 18, 2013 S.A. Arkadaşlar, Outlook'da her mail gönder al yaptığımda sunucu ayarlarından dolayı çıkan güvenlik penceresine Evet demem gerekiyor. Ben AutoIt ile bu pencereye Evet dedirtebiliyorum. Hatta arka planda da çalıştırabiliyorum bunu aşağıdaki kod ile ama çok fazla CPU tüketiyor. Bunun için daha pratik bir tavsiyede bulunabilir misiniz acaba? Teşekkürler... While 1=1 If WinExists ("Internet Security Warning", "") Then ControlClick("Internet Security Warning", "", "Button2" ) EndIf TraySetState(2) Wend Quote Link to comment Share on other sites More sharing options...
blue_life Posted January 19, 2013 Share Posted January 19, 2013 @persmash Döngüde Sleep komutuyla bekleme yapmalısın. While 1 If WinExists ("Internet Security Warning", "") Then ControlClick("Internet Security Warning", "", "Button2" ) EndIf Sleep(50) ;Cpu save (süreyi artırabilirsin)Wend Quote Link to comment Share on other sites More sharing options...
persmash Posted January 19, 2013 Author Share Posted January 19, 2013 @persmash Döngüde Sleep komutuyla bekleme yapmalısın. While 1 If WinExists ("Internet Security Warning", "") Then ControlClick("Internet Security Warning", "", "Button2" ) EndIf Sleep(50) ;Cpu save (süreyi artırabilirsin) Wend Çok teşekkürler hocam, tam olarak aradığım şey buydu. :) CPU kullanımı %0'da düştü. Son birşey daha sormak istiyorum. Programın 2 kere açılmasını nasıl engelleyebilirim. Yani program açıksa tekrar çalıştırmasın aynı .exe'yi. Tekrar teşekkürler... Quote Link to comment Share on other sites More sharing options...
blue_life Posted January 19, 2013 Share Posted January 19, 2013 _Singleton()While 1If WinExists ("Internet Security Warning", "") ThenControlClick("Internet Security Warning", "", "Button2" )EndIfSleep(50) ;Cpu save (süreyi artırabilirsin)Wend;istersen @ScriptName yerine farklı sabit bir şey yazabilirsinFunc _Singleton($sOccurenceName = @ScriptName)Local Const $ERROR_ALREADY_EXISTS = 183Local $handle = DllCall("kernel32.dll", "ptr", "CreateMutexW", "int", 0, "long", 1, "wstr", $sOccurenceName);~ Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", 0, "bool", 1, "wstr", $sOccurenceName)If @error Then Return SetError(@error, @extended, 0)Local $lastError = DllCall("kernel32.dll", "dword", "GetLastError")If @error Then Return SetError(@error, @extended, 0)If $lastError[0] = $ERROR_ALREADY_EXISTS ThenExit -1EndIfReturn $handle[0]EndFunc ;==>_Singleton Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted January 19, 2013 Share Posted January 19, 2013 (edited) Son birşey daha sormak istiyorum. Programın 2 kere açılmasını nasıl engelleyebilirim. Yani program açıksa tekrar çalıştırmasın aynı .exe'yi. ayrıca bir kod daha denemek istersen bu kodu programın başına koymanız yeterli iki kere çalışmaya engelleyecektir. If UBound(ProcessList(@ScriptName)) > 2 Then Exit yada If UBound(ProcessList(@ScriptName)) > 2 Then MsgBox(16, "Hata!", "Zaten çalışan bir program mevcut!", 5) Exit 0 EndIf Edited January 19, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.