Jump to content

Programdan İki Tane Açılmamasını Sağlamak


blackman12
 Share

Recommended Posts

ya da şöyle yapabiliriz .

If WinExists("Program Başlığı") Then

MsgBox(48, "Uyarı!", "....... Programı Zaten Çalışıyor")

Exit

EndIf

Program Başlığını AutoIT Info'dan Öğreniyoruz tabi .

Edited by Dj Demir
Link to comment
Share on other sites

pek fazla bilmeyenler için söyledim

gördüm bir kaç yerde

kimileri basma kalıpla birşeyler yazıyor ama neyin ne olduğunu onlar da bilmiyor

program başlığını atmıştır ama nerede kullanacağını bilmiyordur gibisinden :Q

Link to comment
Share on other sites

  • 1 yıl yıl...

@mehmetben

Şifreni yanlış girdiğinde program aslında kapanmıyor, arkaplanda çalışıyor olabilir.
Şifreni yanlış girip, görev yöneticisinden kontrol etmelisin!
Belki guiyi silmiştirsin ama çalışman döngü içinde kalmış olabilir...

Kodlamanın kontrol edip, ilgili kısıma exit ekle...

Tabi yukarıdaki örnekte,görev yöneticisindeki program isimlerine bakılıyor.
Eğer farklı bir program aynı isimi kullanıyorsa haliyle bu kod cortlar.

Hadi size benim kullandığım yöntemlerden bir tanesini vereyim...

[codebox]_ProcessCheck()

MsgBox(64,"BlueLife","Deneme 123")
;Normal kodlama



Func _ProcessCheck()
Local $Plist
$Plist = ProcessList(StringTrimLeft(@AutoItExe,StringInStr(@AutoItExe,"\",0,-1)))
For $i = 1 To $Plist[0][0]
If _ProcessGetLocation($Plist[$i][1]) = @AutoItExe And $Plist[$i][1] <> @AutoItPID Then
;Kodların buraya yazılacak.
;Misal çalışan programın ekranını WinActivate ile aktif yapabilirsiniz.
;Sizin becerinize kalımş..
MsgBox(16,"","Program zaten çalışıyor...")
Exit
EndIf
Next
EndFunc ;==>_ProcessCheck

;Bu fonkisyon, programın pid bilgisinden konumunu bulmaktadır.
Func _ProcessGetLocation($iPID); Programın çalıştığı dizin
Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
If $aProc[0] = 0 Then Return SetError(1, 0, '')
Local $vStruct = DllStructCreate('int[1024]')
DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048)
If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '')
Return FileGetLongName($aReturn[3])
EndFunc ;==>_ProcessGetLocation[/codebox]

Link to comment
Share on other sites

@blue_life

ben beceremedim ya açmadan zaten program çalışıyor hatası veriyor yada çalışmıyor
işte kod
[codebox]
#requireadmin
#include<IE.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>

$Form = GUICreate("Oto Giriş", 350, 400, 460, 250)
$Msn = GUICtrlCreateButton("Msn Aç", 10, 10, 150, 20)
$Facebook = GUICtrlCreateButton("Facebook Giriş", 10, 40, 150, 20)
$Hakkinda = GUICtrlCreateButton("Hakkında", 270, 5, 75, 20)
$Hotmail = GUICtrlCreateButton("Hotmail", 10, 75, 150, 20)

func sifre()
GUISetState(@SW_SHOW)
EndFunc
$a=InputBox("Doğrulama","Şifreyi Giriniz","","*")
if $a="1234" then
sifre()
else
msgbox(0,"Lütfen Tekrar Deneyin","Şifre Yanlış", 3)
EndIf

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit

Case $Hakkinda
MsgBox(0, "Hakkında", "TNCTR", 3)

Case $Msn
Run(@ProgramFilesDir & "\Windows Live\Messenger\msnmsgr.exe")
WinWait("Windows Live Messenger","")
WinActive("Windows Live Messenger","")
ClipPut("e-mail")
Send("^v")
Send("{TAB}")
ClipPut("password")
Send("^v")
Send("{ENTER}")

Case $Facebook
Local $mailtxt = "e-mail"
Local $passtxt = "password"
$Mail = $mailtxt
$Pass = $passtxt
$oIE = _IECreate("http://www.facebook.com/login.php", 0, 1, 1)
$oForm = _IEFormGetObjByName($oIE, "login_form")
$oQuery = _IEFormElementGetObjByName($oForm, "email")
$o_Query = _IEFormElementGetObjByName($oForm, "pass")
$oSubmit = _IEFormElementGetObjByName($oForm, "login")
_IEFormElementSetValue($oQuery, $Mail)
_IEFormElementSetValue($o_Query, $Pass)
_IEAction($oSubmit, "click")

Case $Hotmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")
_IEFormElementSetValue($o_login, "EMAİL ADRESİNİZ")
_IEFormElementSetValue($o_password, "ŞİFRENİZ")
Sleep(2000)
_IEFormSubmit($o_form)

EndSwitch
WEnd
[/codebox]

Link to comment
Share on other sites

Kaba taslak düzeltiyorum....
Edit: Unuttum şifre 123 idi!
[codebox]#RequireAdmin
#include<IE.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>

_ProcessCheck()
_SIFRE()


$Form = GUICreate("Oto Giriş", 350, 400, 460, 250)
$Msn = GUICtrlCreateButton("Msn Aç", 10, 10, 150, 20)
$Facebook = GUICtrlCreateButton("Facebook Giriş", 10, 40, 150, 20)
$Hakkinda = GUICtrlCreateButton("Hakkında", 270, 5, 75, 20)
$Hotmail = GUICtrlCreateButton("Hotmail", 10, 75, 150, 20)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case -3
Exit

Case $Hakkinda
MsgBox(0, "Hakkında", "TNCTR", 3)

Case $Msn
Run(@ProgramFilesDir & "\Windows Live\Messenger\msnmsgr.exe")
WinWait("Windows Live Messenger", "")
WinActive("Windows Live Messenger", "")
ClipPut("e-mail")
Send("^v")
Send("{TAB}")
ClipPut("password")
Send("^v")
Send("{ENTER}")

Case $Facebook
Local $mailtxt = "e-mail"
Local $passtxt = "password"
$Mail = $mailtxt
$Pass = $passtxt
$oIE = _IECreate("http://www.facebook.com/login.php", 0, 1, 1)
$oForm = _IEFormGetObjByName($oIE, "login_form")
$oQuery = _IEFormElementGetObjByName($oForm, "email")
$o_Query = _IEFormElementGetObjByName($oForm, "pass")
$oSubmit = _IEFormElementGetObjByName($oForm, "login")
_IEFormElementSetValue($oQuery, $Mail)
_IEFormElementSetValue($o_Query, $Pass)
_IEAction($oSubmit, "click")

Case $Hotmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")
_IEFormElementSetValue($o_login, "EMAİL ADRESİNİZ")
_IEFormElementSetValue($o_password, "ŞİFRENİZ")
Sleep(2000)
_IEFormSubmit($o_form)

EndSwitch
WEnd

Func _SIFRE($Sire = "123")
Local $Inputbox
For $I = 1 to 5
$Inputbox = InputBox("Doğrulama", "Şifreyi Giriniz", "", "*")
If @error Then
Exit
ElseIf $Sire = $Inputbox Then
ExitLoop
Else
MsgBox(0, "Lütfen Tekrar Deneyin", "Şifre Yanlış " & $I, 3)
EndIf
Next
If $Sire <> $Inputbox Then Exit
EndFunc

Func _ProcessCheck()
Local $Plist
$Plist = ProcessList(StringTrimLeft(@AutoItExe,StringInStr(@AutoItExe,"\",0,-1)))
For $i = 1 To $Plist[0][0]
If _ProcessGetLocation($Plist[$i][1]) = @AutoItExe And $Plist[$i][1] <> @AutoItPID Then
;Kodların buraya yazılacak.
;Misal çalışan programın ekranını WinActivate ile aktif yapabilirsiniz.
;Sizin becerinize kalımş..
MsgBox(16,"","Program zaten çalışıyor...")
Exit
EndIf
Next
EndFunc ;==>_ProcessCheck

;Bu fonkisyon, programın pid bilgisinden konumunu bulmaktadır.
Func _ProcessGetLocation($iPID); Programın çalıştığı dizin
Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
If $aProc[0] = 0 Then Return SetError(1, 0, '')
Local $vStruct = DllStructCreate('int[1024]')
DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048)
If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '')
Return FileGetLongName($aReturn[3])
EndFunc ;==>_ProcessGetLocation[/codebox]

Edited by blue_life
Link to comment
Share on other sites

@blue_life
abi seni bu mubarek günlerde yoruyoruz ama hakkını helal et 2 sorum olucak bu gui hakkında
1-$Form = GUICreate("Oto Giriş", 350, 400, 460, 250)ortalamak için ayrı bir kodmu yazmak gerekir forumda araştırdım bulamadım. ben leptopda derledim masa üstü bilgisayarda açtığımda program başka bir tarafa kayıyor
2-birde WebIdExtractor diye bir program paylaşmıştın sanırım sen paylaşmıştın hatırlamıyorum onunla ben hotmail sayfasında login formunun idini alıyorum yinede hotmaile girmiyor
o programın linkide bu başka arkadaşlarda faydalansın diye linkide vereyim:)
[code]http://www.iyidosya.com/public/5317/WEBBUTONOGREN.rar[/code]

Edited by mehmetben
Link to comment
Share on other sites

[quote name='blue_life' date='11 August 2011 - 20:31 ' timestamp='1313094660' post='1061214']
Yukarıdaki örneklerde mevcut! Biraz kurcalamalısın...
Bu arada @mehmetben dikkatimi çektide, şifre kısmında bir yere exit koymayı unutmuşum.
Ilgli örneğe sadece bir satır daha ekleyelim... :)
[/quote]
abi exit'i nereye eklicem 5 denemeden sonra açılıyor program :D

Link to comment
Share on other sites

@mehmetben

Ilgili örneği düzeltmiştim!
Diğer soruna gelirsek;
GUICreate("Oto Giriş", 350, 400, 460, 250) yerine GUICreate("Oto Giriş", 350, 400) yapmalısın.

WebIdExtractor adında bir şey yazmadım ben!
Neyse ben kaçar, kolay gelsin...

Link to comment
Share on other sites

senin yazdığın değil abi ya senin paylaştığındı sanırım hatırlamıyorum ama tnc den aldığımı hatırlıyorum programla ilgili bir sorun yok allah razı olsun kim paylaşmışsa. Demek istediğim hotmaildeki form'un girişi için yazılan bu kodun $o_form = _IEFormGetObjByName($oIE, "f1")kısmına hangi form id'ini verdiysem olmadı
kodda bu
[codebox]; Log into Hotmail
Opt("TrayIconHide", 1)
#include <IE.au3>

; Create a browser window and navigate to hotmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.hotmail.com")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "f1")
$o_login = _IEFormElementGetObjByName($o_form, "login")
$o_password = _IEFormElementGetObjByName($o_form, "passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "EMAİL ADRESİNİZ")
_IEFormElementSetValue($o_password, "ŞİFRENİZ")
Sleep(2000)
_IEFormSubmit($o_form)

Exit[/codebox]

Edited by mehmetben
Link to comment
Share on other sites

Şu adresleri bir incele istersen. Bluelife varken bize laf düşmez.

[html]http://www.autoitscript.com/forum/topic/25631-ieau3-t20-helpfile/page__hl__DOCUMENTATION[/html]
[html]http://www.autoitscript.com/forum/topic/118037-read-email-on-hotmail/page__p__824472__hl__hotmail+login__fromsearch__1#entry824472[/html]

Link to comment
Share on other sites

@mehmetben

Sen hotmaile otomatik giriş mi yapmak istiyorsun.
Bir ara aşağıdaki konuda bir şeyler karalamışız...

[color="#0000FF"][u][b]http://www.tnctr.com/topic/174322-cdocuments-and-settingsadministrator/[/b][/u][/color]

[codebox]#include <IE.au3>

Global $MaileAdres = "mailadresi"
Global $PassWord = "sifre"

$oIE = _IECreate ("https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&ct=1308475769&rver=6.1.6206.0" & _
"&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&lc=1055&id=64855&NewUser=1&login=" & $MaileAdres & "&passwd=BlueLife")
WinSetState ("[active]", "", @SW_MAXIMIZE)
_IELoadWait($oIE)
Send($PassWord) ; Şifreyi giriyoruz
Send("{ENTER}") ; Giriş
_IELoadWait($oIE)
_IENavigate ($oIE, "http://by164w.bay164.mail.live.com/mail/InboxLight.aspx?n=343539984")
Exit[/codebox]

Link to comment
Share on other sites

[quote name='blue_life' date='12 August 2011 - 00:48 ' timestamp='1313110102' post='1061302']
@mehmetben

Sen hotmaile otomatik giriş mi yapmak istiyorsun.
Bir ara aşağıdaki konuda bir şeyler karalamışız...

[color="#0000FF"][u][b]http://www.tnctr.com/topic/174322-cdocuments-and-settingsadministrator/[/b][/u][/color]

[codebox]#include <IE.au3>

Global $MaileAdres = "mailadresi"
Global $PassWord = "sifre"

$oIE = _IECreate ("https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&ct=1308475769&rver=6.1.6206.0" & _
"&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&lc=1055&id=64855&NewUser=1&login=" & $MaileAdres & "&passwd=BlueLife")
WinSetState ("[active]", "", @SW_MAXIMIZE)
_IELoadWait($oIE)
Send($PassWord) ; Şifreyi giriyoruz
Send("{ENTER}") ; Giriş
_IELoadWait($oIE)
_IENavigate ($oIE, "http://by164w.bay164.mail.live.com/mail/InboxLight.aspx?n=343539984")
Exit[/codebox]
[/quote]
blue_life bu kod çalışıyor ama giriş anında mause ile başka bir yere tıklandığında girmiyor

Link to comment
Share on other sites

Sen tam olarak ne yapmak istiyorsun?
Sadece maillerine bakmak istiyorsan, bence hotmail sayfası autoit içinde açılsın :)
[codebox]
#include <IE.au3>

Global $MaileAdres = "mailadresi"
Global $PassWord = "sifre"

Local $oIE = _IECreate ("https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&ct=1308475769&rver=6.1.6206.0" & _
"&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&lc=1055&id=64855&NewUser=1&login=" & $MaileAdres & "&passwd=BlueLife")
_IELoadWait($oIE)

Local $Hwnd = 0 ,$Winlist = WinList("[Class:IEFrame]")
For $i = 1 to $Winlist[0][0]
If StringInStr($Winlist[$i][0],"Oturum A") <> 0 Then
$Hwnd = $Winlist[$i][1]
ExitLoop
EndIf
Next
WinSetState ($Hwnd, "", @SW_MAXIMIZE)
ControlSend($Hwnd, "", "Internet Explorer_Server1",$PassWord & @CRLF)
;~ Send($PassWord) ; Şifreyi giriyoruz
;~ Send("{ENTER}") ; Giriş
_IELoadWait($oIE)
_IENavigate ($oIE, "http://by164w.bay164.mail.live.com/mail/InboxLight.aspx?n=343539984")[/codebox]

Link to comment
Share on other sites

Evet maillerime bakmak istiyorum
Local $oIE = _IECreate ("https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&ct=1308475769&rver=6.1.6206.0" & _
"&wp=MBI&wreply=http:%2F%2Fmail.live.com%2Fdefault.aspx&lc=1055&id=64855&NewUser=1&login=" & $MaileAdres & "&passwd=BlueLife")
bunun yerine bunu yazssak https://login.live.com/login.srf? yada bunu http://www.hotmail.com
birde bu link nedir abi
_IENavigate ($oIE, "http://by164w.bay164.mail.live.com/mail/InboxLight.aspx?n=343539984")

Edited by mehmetben
Link to comment
Share on other sites

Ilgili linkte mail adresi mevcut. Link açılınca mail adresi kutuya yansıtılmış oluyor ve ayrıca şifre kutusu focus oluyor.
Bu sayede fazla uğraşmadan istediğimiz bilgileri kutulara girdirmiş oluyoruz.
Diğer link ise, mail kısmına ulaşmak içindi!

Link to comment
Share on other sites

@blue_life
bunları scriptimin başına eklersem sorun olurmu.?
#Region
#NoTrayIcon
#requireadmin
#include<IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <File.au3>
#include <GuiComboBoxEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <Timers.au3>
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_Language=1055
#EndRegion

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...