Jump to content

Yaptığımız Gui Herzaman Üstte Veya Altta Kodu.?


Mehmet
 Share

Recommended Posts

Arkadaşlar yaptığımız gui nekadar pencere açılırsa açılsın en üstte veya en altta kalması için hangi kodu yazmalıyız
birde şu While döngüsünde örneğin bir buton var butona tıklandığında not defterine ahmet yazdı tekrar tıkladığımda mehmet yani bir butonla iki farklı isim veya yazı yazdırma ve bunu sürekli tekrarlatma.
Link to comment
Share on other sites

[font="Tahoma"][b]GUI nin en üstte kalması için gereken kod [color="#ff0000"]WinSetOnTop ( "title", "text", flag )[/color] bunu kullanabilirsin.Veyahut [color="#ff0000"]GUICreate("FORM1", 100, 500,-1,-1,-1,$WS_EX_TOPMOST[/color][color="#ff0000"])[/color] bunu da kullanabilirsin fakat bunu kullanacağın zaman #include <WindowsConstants.au3> kütüphanesini kullanman gerekir seçim senin tabi ama böyle ufak codlar için library kullanma bence.Ufak bir örnek verecek olursak[/b][/font];
[codebox]Local $Form1 = GUICreate("Form1", 273, 155, 192, 124)
Local $Checkbox1 = GUICtrlCreateCheckbox("Her zaman üstte", 144, 120, 113, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $nMsg = $Checkbox1
If GUICtrlRead($Checkbox1) = 1 Then
WinSetOnTop("Form1", "", 1)
Else
WinSetOnTop("Form1", "", 0)
EndIf

EndSwitch
WEnd[/codebox]

[font="Tahoma"][b]Diğer sorun bana biraz saçma geldi doğrusu. Onu while döngüsüyle yapamazsın! Hem kaç kere yazdırmak istiyorsun bu da önemli tek butonla olacağına pek sanmıyorum.Daha mantıklı bir şey yapacaksan 2 butonla yapabilir belki..[/b][/font]

Edited by SimpsoN_Bart
Link to comment
Share on other sites

@SimpsoN_Bart Demek istediğim böyle birşey sitemizdeki şeçtiğim üyeye farklı mesajlar göndermek.
[img]http://www.tnctr.com/uploads/imgs/pre_1314854191__mesaj.jpg[/img]
ad,soyad,gün sabit
buradaki mesajınız bölümüne herzaman aynı mesaj değilde farklı farklı yazdırmak
şöyle bir şayde olabilir ben daha önceden hazırladığım bir txt dosyasına
alt alta
lütfen ara
toplantıdayım
geç dönerim
dışardayım
gibi hazır mesaj şablonu oluştursam bunları yazdırsamda olur
kodlarım bu
[codebox]
#include<IE.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
_ProcessCheck()

Global $ISLEM = False
Opt("GUIOnEventMode", 1)

Global $Form1 = GUICreate("Form1", 300, 200, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP))
GUISetOnEvent(-3, "_cik")
Global $Baslat_Durdur = GUICtrlCreateButton("Baslat", 18, 130, 120, 25)
GUICtrlSetOnEvent(-1, "_Baslat_Durdur")
Global $Button2 = GUICtrlCreateButton("Hakkında", 160, 130, 120, 25)
GUICtrlSetOnEvent(-1, "_About")
Global $Button2 = GUICtrlCreateButton("Çık", 100, 165, 120, 25)
GUICtrlSetOnEvent(-1, "_cik")
WinSetTrans($Form1, "", 170)
GUIRegisterMsg(0x0201, "_blue_life_WinMove")
GUISetState(@SW_SHOW)
WinSetOnTop("Form1", "", 1)

While 1
If $ISLEM = True Then

Local $mailtxt = "mehmetben"
Local $passtxt = "tnctr"
Local $guntxt = "pazartesi"
Local $yazitxt = "Salı günü toplantı var"
$Mail = $mailtxt
$Pass = $passtxt
$yazi = $yazitxt
$gun = $guntxt
$oIE = _IECreate("http://www.sitem.com/user/hasanyilmaz/", 0, 1, 1)
WinSetState ( "sitem-uye-hasanyilmaz - Windows Internet Explorer", "", @SW_HIDE )
$oForm = _IEFormGetObjByName($oIE, "uyem1form")
$oQuery = _IEFormElementGetObjByName($oForm, "ad")
$o_Query = _IEFormElementGetObjByName($oForm, "soy")
$ogun = _IEFormElementGetObjByName($oForm, "gun")
$oyazi = _IEFormElementGetObjByName($oForm, "yazi")
$oSubmit = _IEFormElementGetObjByName($oForm, "submit")
_IEFormElementSetValue($oQuery, $Mail)
_IEFormElementSetValue($o_Query, $Pass)
_IEFormElementSetValue($oyazi, $yazi)
_IEFormElementSetValue($ogun, $gun)
_IEAction($oSubmit, "click")

Else
Sleep(100)
EndIf
WEnd

Func _Baslat_Durdur()
If $ISLEM = True Then
GUICtrlSetData($Baslat_Durdur, "Başlat")
Else
GUICtrlSetData($Baslat_Durdur, "Durdur")
EndIf
$ISLEM = Not $ISLEM
EndFunc

Func _Durdur()
$ISLEM = False
EndFunc

Func _About()
MsgBox(0, "Kodlayan", "Bu program benim tarafından kodlanmıştır", 0, $Form1)
EndFunc

Func _cik()
Exit
EndFunc

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 $aReturn[3]
EndFunc ;==>_ProcessGetLocation

Func _ProcessCheck()
Local $Plist
If @Compiled Then
$Plist = ProcessList(@ScriptName)
For $i = 1 To $Plist[0][0]
If $Plist[$i][1] = @AutoItPID Then ContinueLoop ;Çalıştırdığımız programın pid bilgisi listen alınana uyuyorsa atlıyoruz.
If FileGetLongName(_ProcessGetLocation($Plist[$i][1])) = FileGetLongName(@AutoItExe) Then ;Dosya konumları bir birine uyuyorsa, uygulamayı kapatıyoruz
ProcessClose($Plist[$i][1])

EndIf
Next
EndIf
EndFunc ;==>_ProcessCheck

Func _blue_life_WinMove($hwnd)
If BitAND(WinGetState($hwnd), 32) Then Return "GUI_RUNDEFMSG"
DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x0112, "int", 0xF009, "int", 0)
EndFunc ;==>_WinMove
[/codebox]

Edited by mehmetben
Link to comment
Share on other sites

[quote name='SimpsoN_Bart' date='30 August 2011 - 21:45 ' timestamp='1314740758' post='1072123']
[font="Tahoma"][b]GUI nin en üstte kalması için gereken kod [color="#ff0000"]WinSetOnTop ( "title", "text", flag )[/color] bunu kullanabilirsin.Veyahut [color="#ff0000"]GUICreate("FORM1", 100, 500,-1,-1,-1,$WS_EX_TOPMOST[/color][color="#ff0000"])[/color] bunu da kullanabilirsin fakat bunu kullanacağın zaman #include <WindowsConstants.au3> kütüphanesini kullanman gerekir seçim senin tabi ama böyle ufak codlar için library kullanma bence.Ufak bir örnek verecek olursak[/b][/font];
[codebox]Local $Form1 = GUICreate("Form1", 273, 155, 192, 124)
Local $Checkbox1 = GUICtrlCreateCheckbox("Her zaman üstte", 144, 120, 113, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $nMsg = $Checkbox1
If GUICtrlRead($Checkbox1) = 1 Then
WinSetOnTop("Form1", "", 1)
Else
WinSetOnTop("Form1", "", 0)
EndIf

EndSwitch
WEnd[/codebox]

[font="Tahoma"][b]Diğer sorun bana biraz saçma geldi doğrusu. Onu while döngüsüyle yapamazsın! Hem kaç kere yazdırmak istiyorsun bu da önemli tek butonla olacağına pek sanmıyorum.Daha mantıklı bir şey yapacaksan 2 butonla yapabilir belki..[/b][/font]
[/quote]

Bu şekilde yapmayı düşünüyorum ama böyle kodlarsak çok uzun yazmamız gerekecek

TestFunc1()
TestFunc2()
MsgBox(0, "çıkış", "Mesaj sonaerdi")
Exit
Func TestFunc1()
MsgBox(0, "1.mesaj", "mesaj1")
EndFunc
Func TestFunc2()
MsgBox(0, "2.mesaj", "mesaj2")
EndFunc

az kodla bu işlemi yapamazmıyız

Link to comment
Share on other sites

[font="Georgia"]Anladığım kadarıyla kodları istediğin şekilde çok da kısaltmak pek mümkün değil ama emin değilim! (Belki Blue_Life akılıcı bir yöntemle sana yardım edebilir.) Göndermek istediğin sabit bilgileri mesaj isim vs. bir database nin içine önceden girmen daha iyi olur bence. bu .ini veya .txt dosyası olabilir.veya script içinde değişken tanımlayıp da yapabilirsin.veya şöyle yap mesajlarını random komutuyla karıştır her mesaj yazdığında farklı şekilde yazsın.Combobox da bunları tanımlayıp da yapabilirsin.Yani sana kalmış pek yardımcı olamadım sanıırm :( evde değilim bilgisayar da bana ait değil maalesef yapabileceğim bu kadar kolay gelsin.[/font]

Link to comment
Share on other sites

@mehmetben

Forumlarda genelde ad, soyad olmaz diyebilirim. Yani nickimiz (kullanıcı adımız) olur ve bunun üzerinden mesaj göndeririz.
Peki mesaj genderilecek kullanıcı bilgisini nerden alacaksın!
Gönderilecek sabit mesajlar için bir ini dosyası iş görür...

Kısaca guini tasarlayıp, yapmak istediğini biraz daha netleştirdikten sonra bizimle paylaşırsan, seni yönlendirmeye çalışırız...

Link to comment
Share on other sites

@blue_life bu forum değil abi normal bir site admin olarak giriş yaptığımda bir üye seçtiğimde arama çubuğunda http://www.sitem.com/user/hasanyilmaz/diye bir link oluşuyor. sayfadaki form verdiğim resimdeki örnek gibi o üyeye mesaj gönderiyorum
form ve elemanlarının ismide aşağıdaki gibi ama ben bunu hotmaildeki formun örneğiyle yaptım soy ad kısmınada kendi soy ismimi yazıyorum

$oForm = _IEFormGetObjByName($oIE, "uyem1form")
$oQuery = _IEFormElementGetObjByName($oForm, "ad")
$o_Query = _IEFormElementGetObjByName($oForm, "soy")
$ogun = _IEFormElementGetObjByName($oForm, "gun")
$oyazi = _IEFormElementGetObjByName($oForm, "yazi") ----burası değişken olucak yani mesaj kısmı.
$oSubmit = _IEFormElementGetObjByName($oForm, "submit")

Edited by mehmetben
Link to comment
Share on other sites

@mehmetben

Ilgili linkte herangi bir form vs. yok!
Ayrıntılı bilgi vs. de malesef vermedin.
Neyse senin için bir gui tasarlayalım.
Belki işini görür...
Kolay gelsin...

[codebox]#include<IE.au3>
#NoTrayIcon

_ProcessCheck()

Global $MAIL = "mehmetben"
Global $SIFRE = "tnctr"
Global $GUN = _Blue_WDAY()

Global $DEF_SABLON = "Tamam bekliyorum"
Global $SABLON = "Selam Millet|Bu bün hava güzel|Alo oradamısın?|Salı günü toplantı var|" & $DEF_SABLON

Global $BlueForum = GUICreate("Form1", 360, 350, -1, -1, -2146959360)
GUISetFont(10, 800, 0, "Tahoma")
GUISetBkColor(0xFFFFFF)
GUICtrlCreateLabel("Seçilen Üye:", 5, 5, 90, 17,-1,0x00100000)
GUICtrlCreateLabel($MAIL, 100, 5, 90, 17,-1,0x00100000)

GUICtrlCreateLabel("Ad:", 5, 35, 90, 17,-1,0x00100000)
GUICtrlCreateLabel("Şifre:", 5, 55, 90, 17,-1,0x00100000)
GUICtrlCreateLabel("Gün:", 5, 75, 90, 17,-1,0x00100000)
GUICtrlCreateLabel("Şablon:", 5, 110, 90, 17,-1,0x00100000)

Global $Input_Mail = GUICtrlCreateInput($MAIL, 100, 35, 250, 20)
Global $Input_sifre = GUICtrlCreateInput($SIFRE, 100, 55, 250, 20)
Global $Input_gun = GUICtrlCreateInput($GUN, 100, 75, 250, 20)
Global $Combo_sablon = GUICtrlCreateCombo("", 100, 105, 250, 20)
GUICtrlSetData($Combo_sablon, $SABLON, $DEF_SABLON)


GUICtrlCreateLabel("Mesajınız", 5, 140, 90, 17,-1,0x00100000)
Global $Edit_Mesaj = GUICtrlCreateEdit("", 5, 160, 350, 150)
GUICtrlSetData(-1, $DEF_SABLON)


Global $Gonder = GUICtrlCreateButton("Mesajı Gönder", 5, 320, 140, 24)
GUICtrlSetState(-1,256)
Global $About = GUICtrlCreateButton("Hakkında", 150, 320, 100, 24)
Global $KAPAT = GUICtrlCreateButton("Kapat", 255, 320, 100, 24)
GUIRegisterMsg(0x0201, "_blue_life_WinMove")
WinSetTrans($BlueForum, "", 170)
WinSetOnTop($BlueForum, "", 1)
GUISetState(@SW_SHOW)

Local $Read_Value1, $Read_Value2
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $KAPAT, -3
Exit
Case $Combo_sablon
$Read_Value1 = GUICtrlRead($Combo_sablon)
GUICtrlSetData($Edit_Mesaj, $Read_Value1)
Case $About
MsgBox(64, "Kodlayan", "Bu program xxx tarafından kodlanmıştır", 0, $BlueForum)

Case $Gonder
$MAIL = GUICtrlRead($Input_Mail)
$SIFRE = GUICtrlRead($Input_sifre)
$GUN = GUICtrlRead($Input_gun)
$MAIL = GUICtrlRead($Input_Mail)
$Read_Value1 = GUICtrlRead($Edit_Mesaj)


;Bu kısım hakkında ne desem boş!
;Şimdilik bu kısma dokunmuyorum.
;Bu kısma müdehale etmem için ilgili site için login bilgilerine ihtiyacım var!
; ===================================================================

$oIE = _IECreate("", 0, 1, 1)
WinSetState("sitem-uye-hasanyilmaz - Windows Internet Explorer", "", @SW_HIDE)
$oForm = _IEFormGetObjByName($oIE, "uyem1form")
$oQuery = _IEFormElementGetObjByName($oForm, "ad")
$o_Query = _IEFormElementGetObjByName($oForm, "soy")
$ogun = _IEFormElementGetObjByName($oForm, "gun")
$oyazi = _IEFormElementGetObjByName($oForm, "yazi")
$oSubmit = _IEFormElementGetObjByName($oForm, "submit")
_IEFormElementSetValue($oQuery, $MAIL)
_IEFormElementSetValue($o_Query, $SIFRE)
_IEFormElementSetValue($oyazi, $Read_Value1)
_IEFormElementSetValue($ogun, $GUN)
_IEAction($oSubmit, "click")
; ===================================================================
EndSwitch
WEnd

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 $aReturn[3]
EndFunc ;==>_ProcessGetLocation

Func _ProcessCheck()
Local $Plist
If @Compiled Then
$Plist = ProcessList(@ScriptName)
For $i = 1 To $Plist[0][0]
If $Plist[$i][1] = @AutoItPID Then ContinueLoop ;Çalıştırdığımız programın pid bilgisi listen alınana uyuyorsa atlıyoruz.
If FileGetLongName(_ProcessGetLocation($Plist[$i][1])) = FileGetLongName(@AutoItExe) Then ;Dosya konumları bir birine uyuyorsa, uygulamayı kapatıyoruz
ProcessClose($Plist[$i][1])

EndIf
Next
EndIf
EndFunc ;==>_ProcessCheck

Func _blue_life_WinMove($hwnd)
If BitAND(WinGetState($hwnd), 32) Then Return "GUI_RUNDEFMSG"
DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x0112, "int", 0xF009, "int", 0)
EndFunc ;==>_blue_life_WinMove

Func _Blue_WDAY()
Local $ReturnWday
Switch @WDAY
Case 1
$ReturnWday = "Pazar"
Case 2
$ReturnWday = "Pazartesi"
Case 3
$ReturnWday = "Salı"
Case 4
$ReturnWday = "Çarşamba"
Case 5
$ReturnWday = "Perşembe"
Case 6
$ReturnWday = "Cuma"
Case 7
$ReturnWday = "Cumartesi"
EndSwitch
Return $ReturnWday
EndFunc ;==>_Blue_WDAY[/codebox]

Edited by blue_life
Link to comment
Share on other sites

link örnek verdim sadece reklam olmasın diye mesajlarımın hiç birine gerçek link vermem reklamı hiç sevmiyorum eline sağlık blue_life hemen bakıyorum
Tam benim istediğim gibi olmuş
bir tek sorun kaldı abi ard arda mesaj gönderdiğimde görev yöneticisinde 4 5 tane IEXPLORE.EXE
[img]http://www.tnctr.com/uploads/imgs/pre_1315024984__explorer.jpg[/img]

Edited by mehmetben
Link to comment
Share on other sites

@mehmetben

Örnek itemeizin ismi www.sitem.com olsun.

Kodlarda yazdığım üzere, www.sitem.com daki ilgili formun nasıl işlediğini bilmediğim için yardımcı olamam. :(
Yardımcı olabilmem için, www.sitem.com daki ilgili formun tam linkini ve kullanıcı bilgilerini vermen gerekecek.
Yani kodlar www.sitem.com için yazılacaksa, test için bu sitedeki formun tam linktini ve test için bir kullanıcı bilgisi vermen gerekiyor.

Bu arada www.sitem.com daki forma göre iexplore.exe ye gerek olmayabilir...
Ie komutları biraz sıkıntılı...

Link to comment
Share on other sites

@mehmetben

ObjCreate ile autoit içinde, internet explorer alt yapısını kullan nesneler oluşturabiliyoruz.
Yani autoit ekranında ilgili sitelerdeki forumlara giriş yapmak mümkün.
Tabi sistenin verdiği desteğe göre herangi bir arayüz olmadan da bu işler yapılabiliyor.

Kısacası bu sitenin verdiği desteğe bağlı.
Ben sana sadece objcreate ile bir örnek vereyim.
Ben bu tip işler ile fazla ilgili deyilim...

[codebox]Opt("GUIResizeMode", 768)
Global $BLUE_OIE = ObjCreate("Shell.Explorer.2")
Global $BLUE_GUI = GUICreate("BluLife Test", 640, 480, -1, -1, 0x00040000 + 0x00020000 + 0x00010000)
$IE_OBJECT = GUICtrlCreateObj($BLUE_OIE, 0, 0, 640, 456)
GUICtrlSetResizing(-1, 102)

GUISetState(@SW_SHOW)

$BLUE_OIE.navigate("http://www.google.com.tr")
DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit

EndSwitch
WEnd[/codebox]

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...