Last active
October 12, 2015 04:48
-
-
Save sinancetinkaya/3973600 to your computer and use it in GitHub Desktop.
Vodafone Fatura Döküm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#Warn ; Recommended for catching common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; A=Hat sahibinin adı, B=GSM numarası olacak şekilde hazırlanmış excel tablosu | |
HatListeDosya := "E:\Belgelerim\Excel\Çizelgeler\Şirket Hatları.xls" | |
; IniDosya dosyası aşağıdaki gibi hazırlanmış kullanıcı adı ve şifre kısımları yazılmış bir ini dosyası olmalıdır. | |
; [Vodafone] | |
; username= | |
; password= | |
IniDosya := "E:\Belgelerim\Linkler\AutoHotkey\ini\Vodafone.ini" | |
IfWinNotExist, Microsoft Excel | |
Excel := ComObjCreate("Excel.Application") | |
else | |
Excel := ComObjActive("Excel.Application") | |
SayfaAcik:=False | |
SplitPath, HatListeDosya, name, dir, ext, name_no_ext, drive | |
For Book in Excel.Workbooks | |
If InStr(Book.name, name_no_ext) | |
SayfaAcik:=True | |
If SayfaAcik | |
Kitap := Excel.Workbooks(name) | |
else | |
Kitap := Excel.Workbooks.Open(HatListeDosya) | |
Excel.Visible | |
Kitap.Activate | |
SatirNo := 1 | |
While Kitap.Sheets("Sayfa1").Cells(SatirNo,2).Text <> "" | |
{ | |
Numara := Round(Kitap.Sheets("Sayfa1").Cells(SatirNo,2).Value) | |
Personel%Numara% := Kitap.Sheets("Sayfa1").Cells(SatirNo,1).Text | |
NumaraFormatli%Numara% := Kitap.Sheets("Sayfa1").Cells(SatirNo,2).Text | |
SatirNo++ | |
} | |
Kitap.Close(True) | |
COM_Release(Kitap) | |
COM_Release(Excel) | |
pwb:=ComObjCreate("InternetExplorer.Application") | |
pwb.Navigate("https://www.vodafone.com.tr/MyVodafone/myvodafone.php?pageId=CorporatePostpaidMainPage") | |
pwb.Visible:=true | |
while, pwb.busy | |
sleep, 1000 | |
IniRead, username, %IniDosya%, Vodafone, username | |
IniRead, password, %IniDosya%, Vodafone, password | |
if (username = "ERROR" or password = "ERROR") { | |
MsgBox, Şifre veya kullanıcı bilgisi yok! | |
exit | |
} | |
pwb.document.all.username2.value := username | |
pwb.document.all.password2.value := password | |
pwb.document.getElementById("formLogin234").submit() | |
while, pwb.busy | |
sleep, 1000 | |
elements := pwb.document.getElementsByTagName("STRONG") | |
rapor:= elements[0].innerText "`n`n" | |
pwb.Navigate("https://www.vodafone.com.tr/MyVodafone/myvodafone.php?pageId=Fatura-Goruntuleme") | |
while, pwb.busy | |
sleep, 1000 | |
Toplam := 0 | |
PTableData := 0 | |
Hatlar := pwb.document.getElementById("subNumber") | |
HatSayisi := Hatlar.options.length - 1 | |
HatNo := 0 | |
Loop, % HatSayisi { | |
Hatlar := pwb.document.getElementById("subNumber") ;Döngüde sayfa her değiştiğinde Dropdown'u tekrar güncellemek gerekiyor. | |
Hatlar.selectedIndex := A_Index | |
Hatlar.fireEvent("onchange") | |
Numara := Hatlar.value | |
sleep, 2000 | |
While, (pwb.readyState = 3) | |
sleep, 1000 | |
sleep, 2000 | |
TableHeader := pwb.document.getElementsByTagName("TH") | |
TableData := pwb.document.getElementsByTagName("TD") | |
YeniFaturaVar := 1 | |
loop % TableData.length { | |
if (TableData[A_Index-1].innerText = "Ödenmemiş fatura kaydı bulunamamıştır.") { | |
YeniFaturaVar := 0 | |
break | |
} | |
} | |
if (YeniFaturaVar = 1) { | |
if (PTableData = 0) { | |
loop % TableData.length { | |
var := TableData[A_Index-1].innerText | |
StringRight, var, var, 3 | |
If (var = " TL") { | |
PTableData := A_Index - 2 | |
break | |
} | |
} | |
} | |
Tarih := TableData[PTableData].innerText | |
Tutar := TableData[PTableData+2].innerText | |
Toplam += SubStr(Tutar,1,InStr(Tutar," TL")) | |
HatNo++ | |
fatura := HatNo "." Personel%Numara% A_Tab A_Tab NumaraFormatli%Numara% A_Tab Tarih A_Tab Tutar | |
rapor .= fatura "`n" | |
TrayTip , Rapor, %fatura%, 2 | |
} | |
} | |
rapor .= "`nToplam: " Round(Toplam, 2) | |
Clipboard:=rapor | |
COM_Release(pwb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment