Jump to content
Sign in to follow this  
minhlaobao

Could not update variables

Recommended Posts

minhlaobao

Hi All

I have one project, I want to select button 1, the account will change, but it does not seem to work are looking forward to helping

#include <GUIListBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GUIConstants.au3>
#include <GuiButton.au3>
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Global $version = "1.0.2"
Global $hListBox,$origHWND,$lastCopied='',$WM_CLIPUPDATE=0x031D
Local $hminh_set, $Account_1, $Account_2, $Account_3, $hGUI, $linklist, $dllist, $listviewcontrols, $username, $password, $retry = 0, $loggedin = 0, $cookies[1][2] = [["", ""]], $f = "account.txt", $processing = 0

; GUI
$hGUI = GUICreate("GetLink Fshare " & $version & " - BeGood.Vn", 800, 600)
;GUISetIcon(@SystemDir & "\mspaint.exe", 0)
; Intercept Windows command messages with out own handler
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
;Clipboard monitor
$origHWND = DLLCall("user32.dll","int","AddClipboardFormatListener","hwnd",$hGUI)
If IsArray($origHWND) Then
$origHWND = $origHWND[0]
EndIf
GUIRegisterMsg($WM_CLIPUPDATE,"OnClipBoardChange")
Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam)
; do what you need when clipboard changes
CBmonitor(ClipGet())
EndFunc
; Input link box
GUICtrlCreateLabel("Fshare links (Đưa link fshare vào đây, phân cách bởi xuống dòng hoặc space)" & @CRLF & "Nếu có mật khẩu thì thêm vào sau link kèm theo ký tự | (vd : link | matkhau) Nếu không nhập mật khẩu cùng link, tool sẽ tự động hỏi.", 5, 3)
$LinkInput = GUICtrlCreateEdit("", 5, 40, 500, 185)
; LIST VIEW
Local $iListView = GUICtrlCreateListView("", 5, 235, 790,180)
_GUICtrlListView_AddColumn($iListView, "Fshare Link", 200)
_GUICtrlListView_AddColumn($iListView, "Download Link", 530)
_GUICtrlListView_AddColumn($iListView, "Size", 55)
;buttons
$btnStop = GUICtrlCreateButton ("DỪNG LẤY LINK !", 520, 40, 250, 40)
_GUICtrlButton_Show($btnStop, False)
$btnGetLink = GUICtrlCreateButton ("Lấy Link Download >>>", 520, 40, 250, 40)
$btnClearlinks = GUICtrlCreateButton ("Xóa danh sách download", 520, 420, 180, 45)
_GUICtrlButton_Enable($btnClearlinks, False)
$btnSendToIDM = GUICtrlCreateButton ("Gửi link sang IDM", 520, 475, 180, 45)
_GUICtrlButton_Enable($btnSendToIDM, False)
$btnCopy = GUICtrlCreateButton ("Copy links download", 520, 530, 180, 45)
_GUICtrlButton_Enable($btnCopy, False)
;checkbox
;GUICtrlCreateCheckbox("Xóa list cũ", 710, 20, 80, 20)
;GUICtrlSetState(-1, $GUI_CHECKED)
; Listbox Progress
$hListBox = _GUICtrlListBox_Create($hGUI, "", 5, 420, 500, 170, BitOR($LBS_NOSEL, $WS_VSCROLL, $WS_HSCROLL, $LBS_HASSTRINGS))
GUISetState(@SW_SHOW)
_GUICtrlListBox_ResetContent($hListBox)
;_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
addText("GetLink Fshare " & $version & ' - BeGood.Vn',$hListBox);
addText("Phần mềm này được xây dựng dựa trên code của bạn lnt900, chỉnh sửa và phát triển thêm bởi Mr.Minh",$hListBox)
addText("Mọi thắc mắc các bạn có thể gửi về Email: huuminh@begood.vn, Phần mềm này được chia sẻ và",$hListBox)
addText("download duy nhất tại địa chỉ http://begood.vn. Hãy đóng góp account cho chúng tôi bằng cách",$hListBox)
addText("gửi tài khoản về địa chỉ email trên hoặc gửi tin nhắn FSHARE VIP 1572606 gửi đến 8777",$hListBox)
addText("Cám ơn các bạn !",$hListBox)
addText("----------------------------------------------------------------------------------------",$hListBox)

;function to add text and scroll listbox to bottom
Func addText($txt,$listBox)
     _GUICtrlListBox_InsertString($listBox, $txt, -1)
$num = _SendMessage($hListBox, 0x18B, 0, 0)
_GUICtrlListBox_SetCurSel($listBox, $num -1)
EndFunc
;account info
Dim $aRecords
If Not _FileReadToArray($f, $aRecords) Then
$username = ""
$password = ""
ElseIf $hminh_set == 1 Then
$username = "aaaa"
$password = "aaaa"
ElseIf $hminh_set == 2 Then
$username = "bbbb"
$password = "bbbb"
ElseIf $hminh_set == 3 Then
$username = "ccccc"
$password = "cccc"

ElseIf $aRecords[0] > 1 Then
$usernamed = $aRecords[1]
$passwordd = $aRecords[2]

addText("[Account] Sử dụng tài khoản " & $username & " ...",$hListBox)
EndIf

; Add Link
$account_link = GUICtrlCreateButton ("More Account", 710, 420, 80, 45)
$homepage_link = GUICtrlCreateButton ("HomePage", 710, 475, 80, 45)
$visit_info = GUICtrlCreateButton ("Check Version", 710, 530, 80, 45)
;Account
GUIStartGroup()
$Account_1 = GUICtrlCreateRadio("Tài khoản 1", 530, 213, 80, 20)
$Account_2 = GUICtrlCreateRadio("Tài khoản 2", 610, 213, 80, 20)
$Account_3 = GUICtrlCreateRadio("Account.txt", 690, 213, 75, 20)
GUICtrlSetState($Account_1, $GUI_CHECKED)
; GROUP / Input fshare account
GUICtrlCreateGroup("Thông tin Fshare Account", 520, 80,250,155)
GUICtrlCreateLabel("Email :", 540, 100)
$txtAccEmail = GUICtrlCreateInput($username, 540, 115, 210, 22)
GUICtrlCreateLabel("Mật khẩu :", 540, 140)
$txtAccPassword = GUICtrlCreateInput($password, 540, 155, 210, 22, 0x0020)
$btnSaveAccInfo = GUICtrlCreateButton ("Lưu lại", 600, 185, 100, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
;function to save account to tzt file
Func saveAcc($usr, $pw,$file)
$usrx = GUICtrlRead($usr)
$pwx = GUICtrlRead($pw)
FileDelete($file)
$fxx = FileOpen($file, 1)
FileSetPos($fxx,0,0)
FileFlush($fxx)
If Random() < 0.5 Then
$Letter0 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter1 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter3 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter4 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
Else
$Letter0 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter1 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter3 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter4 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
Endif
$lt = $Letter0 & $Letter1 & $Letter2 & $Letter3 & $Letter4 & $Letter5
FileWrite($fxx, $usrx & @CRLF)
FileWrite($fxx, $pwx & @CRLF)
FileClose($fxx)
addText("[Account] Đã lưu thông tin tài khoản fshare ...",$hListBox)
EndFunc
;function logout of fshare
Func logoutF()
addText("[Fshare] Logout khỏi fshare ...",$hListBox)
$res = getHTTP("http://www.fshare.vn/logout.php", mkCookies())
$res = getHTTP("http://www.fshare.vn/", mkCookies(), 'http://www.fshare.vn/logout.php')
If StringInStr($res[2], "login.php") <> 0 Then
addText(" -> Đã thoát.",$hListBox)
$loggedin = 0
Else
addText("[Lỗi] chưa thoát được khỏi fshare !",$hListBox)
EndIf
EndFunc
;Function Login to Fshare
Func loginF()
$user = GUICtrlRead($txtAccEmail)
$pword = GUICtrlRead($txtAccPassword)
addText("[Fshare] Đăng nhập vào Fshare ...",$hListBox)
$res = getHTTP("https://www.fshare.vn/login.php?url_refe=https%3A%2F%2Fwww.fshare.vn%2Findex.php&login_useremail=" & URLEncode($user) & '&login_password=' & URLEncode($pword), mkCookies(),"https://www.fshare.vn/login.php",0, 1, 0)
$res = getHTTP("http://www.fshare.vn/", mkCookies())
If StringInStr($res[2], "logout.php") <> 0 Then
addText(" -> Đăng nhập thành công !",$hListBox)
If StringInStr($res[2], "VIP.gif") <> 0 Then
addText(" -> Tài khoản VIP ... OK !",$hListBox)
$loggedin = 1
Else
addText(" -> Không phải tài khoản VIP. Thoát khỏi Fshare ...",$hListBox)
logoutF()
EndIf
Else
addText(" -> Đăng nhập thất bại, kiểm tra lại tk fshare",$hListBox)
EndIf
EndFunc
;function to parse links input
Func parseLinks($input, $loggoutthen = 1)
If $processing = 0 Then
$links = StringReplace($input, @CRLF, " ")
$links = StringReplace($links, @TAB, " ")
$aLink = StringSplit($links, " ")
$hasfsharelinks = StringRegExp($links,'http:/(.*?)fshare.vn/(.*?)')
If $hasfsharelinks = 1 Then
_GUICtrlButton_Show($btnGetLink, False)
_GUICtrlButton_Show($btnStop, True)
;_GUICtrlButton_SetText($btnGetLink, "DỪNG LẤY LINK !")
$processing = 1
If $loggedin = 0 Then
;Login to Fshare
loginF()
EndIf
If $loggedin = 1 Then
For $x=1 To $aLink[0]
     If $loggedin = 1 And $processing = 1 Then
     $retry = 0
     parseLink($aLink[$x])
     EndIf
Next
EndIf
If $loggoutthen = 1 And $loggedin = 1 Then
logoutF()
EndIf
If $retry < 4 And $processing = 1 Then
addText("[OK] Đã xử lý xong tất cả các links !",$hListBox)
ElseIf $retry < 4 And $processing = 0 Then
addText("[Fshare] Đã ngừng lấy link !",$hListBox)
Else
addText("[Lỗi] trùng phiên đăng nhập quá 4 lần, vui lòng thử lại sau vài phút !",$hListBox)
$retry = 0
EndIf
;_GUICtrlButton_SetText($btnGetLink, "Lấy Link Download >>>")
_GUICtrlButton_Enable($btnStop, True)
_GUICtrlButton_Show($btnStop, False)
_GUICtrlButton_Show($btnGetLink, True)
$processing = 0
Else
addText("[Lỗi] Không có link fshare trong danh sách link !",$hListBox)
EndIf
EndIf
EndFunc
;function to get fshare download link
Func parseLink($lnk)
If $processing = 1 Then
$validLink = StringRegExp($lnk,'http:/(.*?)fshare.vn/file(.*?)')
$isfolder = StringRegExp($lnk,'http:/(.*?)fshare.vn/folder(.*?)')
If $validLink = 1 Then

If StringInStr($lnk, '|') <> 0 Then
;$lnk = StringReplace($lnk, '*', '|')
$plink = StringSplit($lnk, '|')
$lnk = $plink[1]
$dlpw = $plink[2]
Else
$dlpw = ''
EndIf
If StringInStr($lnk, '?') <> 0 Then
$plink = StringSplit($lnk, '?')
$slink = $plink[1]
addText("[Fshare] Lấy link cho file " & $slink & " ...",$hListBox)
$res = getHTTP($lnk, mkCookies(), $slink, 1, 1)
Else
$slink = $lnk
addText("[Fshare] Lấy link cho file " & $slink & " ...",$hListBox)
$res = getHTTP($lnk, mkCookies(), '', 1)
EndIf

If (StringInStr($res[2], "logout.php") <> 0) Or ($res[1] = 1) Then
$filesize = "unknown"
If $res[1] = 1 Then
     ;GUICtrlSetData($LinkInput,GUICtrlRead($LinkInput) & @CRLF & "Có redir đến " & $res[0])
     $size = InetGetSize($res[0])
     If $size > 1000000000 Then
     $filesize = Round($size/(1024^3),2) & " GB"
     ElseIf $size > 1000000 Then
     $filesize = Round($size/(1024^2),2) & " MB"
     ElseIf $size > 1000 Then
     $filesize = Round($size/(1024),2) & " KB"
     EndIf
     $listviewcontrols = arradd($listviewcontrols, GUICtrlCreateListViewItem($slink & "|" & $res[0] & "|" & $filesize, $iListView))
     $linklist = arradd($linklist, $res[0])
     $dllist = arradd($dllist, $slink)
     _GUICtrlButton_Enable($btnClearlinks, True)
     _GUICtrlButton_Enable($btnCopy, True)
     _GUICtrlButton_Enable($btnSendToIDM, True)
     addText(" -> Done.",$hListBox)
ElseIf StringInStr($res[2], "vip_package_bt.png") <> 0 AND StringInStr($res[2], "fshare.vn/vip") <> 0 Then
     $arr = StringRegExp($res[2], '<form action="(.*?)" method="post" name="frm_download">', 3)
     If UBound($arr) > 0 Then
     ;GUICtrlSetData($LinkInput,GUICtrlRead($LinkInput) & @CRLF & "Lấy được link download " & $arr[0])
     $size = InetGetSize($arr[0])
     If $size > 1000000000 Then
     $filesize = Round($size/(1024^3),2) & " GB"
     ElseIf $size > 1000000 Then
     $filesize = Round($size/(1024^2),2) & " MB"
     ElseIf $size > 1000 Then
     $filesize = Round($size/(1024),2) & " KB"
     EndIf
     $listviewcontrols = arradd($listviewcontrols, GUICtrlCreateListViewItem($slink & "|" & $arr[0] & "|" & $filesize, $iListView))
     $linklist = arradd($linklist, $arr[0])
     $dllist = arradd($dllist, $slink)
     _GUICtrlButton_Enable($btnClearlinks, True)
     _GUICtrlButton_Enable($btnCopy, True)
     _GUICtrlButton_Enable($btnSendToIDM, True)
     addText(" -> Done.",$hListBox)
     EndIf
ElseIf StringInStr($res[2], "vip_package_bt.png") <> 0 AND StringInStr($res[2], '<input type="text" name="link_file_pwd_dl"/>') <> 0 Then
     addText(" -> Link Download có mật khẩu ...",$hListBox)
     If StringInStr($res[2], '<ul class="message-error">') <> 0 Then
     $announce = 'Mật khẩu không đúng. Nhập lại ?'
     Else
     $announce = 'File này yêu cầu nhập mật khẩu để tải.'
     EndIf
     if $dlpw = '' Then
     $filename = StringRegExp($res[2], '<p><b>(.*?):</b>(.*?)</p>', 3)
     $pos = WinGetPos($hGUI)
     $dlpw = InputBox("Mật khẩu", $slink & @CRLF & '-> ' & $filename[1] & @CRLF & @CRLF & $announce & ' Bỏ trống hoặc Cancel để bỏ qua link này. Nếu không nhập mật khẩu sau 15 giây sẽ tự động bỏ qua', '', '', - 1, 240, $pos[0]+200, $pos[1]+200, 15)
     If $dlpw = '' Then
     $err = '[Fshare] Bỏ qua link ' & $slink & ' -> unknown error !'
     Select
     Case @error = 0
         $err = '[Fshare] Bỏ qua link ' & $slink & ' -> bởi người dùng'
     Case @error = 1
         $err = '[Fshare] Bỏ qua link ' & $slink & ' -> bởi người dùng'
     Case @error = 2
         $err = '[Fshare] Bỏ qua link ' & $slink & ' -> Timeout 15s'
     EndSelect
     EndIf
     EndIf
     If $dlpw = '' Then
     addText($err ,$hListBox)
     Else
     $fileid = StringRegExp($res[2], '<input type="hidden" name="file_id" value="(.*?)"/>', 3)
     $newlnk = $lnk & '?action=download_file&file_id=' & $fileid[0] & '&link_file_pwd_dl=' & URLEncode($dlpw)
     parseLink($newlnk)
     EndIf
ElseIf StringInStr($res[2], '<ul class="message-error">') <> 0 Then
     addText("[Fshare][Lỗi] Có thể đang trùng phiên đăng nhập với người khác !",$hListBox)
     logoutF()
     addText(" -> Đợi xử lý lại sau 1 phút ...",$hListBox)
     $retry += 1
     If $retry < 4 Then
     Sleep(60000)
     loginF()
     parseLink($lnk)
     EndIf
Else
     addText("[Fshare] Error: No Download Link !",$hListBox)
EndIf
EndIf
;Sleep(200)
ElseIf $isfolder = 1 Then
addText("[Fshare] Link " & $lnk & " là thư mục !",$hListBox)
$res = getHTTP($lnk, mkCookies(), '', 1)
If StringInStr($res[2], "fshare.vn/file/") <> 0 Then
$arr = StringRegExp($res[2], '<a href="(.*?)" target="_blank"><span class="filename">', 3)
addText("[Fshare] Có " & UBound($arr) & " file trong thư mục ...",$hListBox)
;parseLinks(_ArrayToString($arr, " "), 0)
For $i = 0 To UBound($arr) - 1
     parseLink($arr[$i])
Next
Else
addText("[Fshare] Thư mục trống !",$hListBox)
EndIf
EndIf
Else
logoutF()
;_GUICtrlButton_Enable($btnStop, False)
;_GUICtrlButton_SetText($btnGetLink, "Đang dừng ...")
EndIf
EndFunc
;function to get/post http links
Func getHTTP($lnk, $cookie = '', $refer = '', $ignorecookies = 0, $post = 0, $redir = 0)
$method = "GET"
$weblink = StringSplit($lnk, '?')
;addText($weblink[2],$hListBox)
If $post = 1 Then
$method = "POST"
$linklink = $weblink[1]
$poststring = $weblink[2]
Else
$linklink = $lnk
EndIf
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
If $redir = 0 Then
$oHTTP.Option(6) = False
EndIf
$oHTTP.Open($method, $linklink , False)
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0")
If StringLen($refer)>1 Then
$oHTTP.SetRequestHeader("Referer", $refer)
EndIf
If StringLen($cookie)>1 Then
$oHTTP.SetRequestHeader("Cookie", $cookie)
EndIf
If $post = 1 Then
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.SetRequestHeader("Content-Length", StringLen($poststring))
$oHTTP.Send($poststring)
Else
$oHTTP.Send()
EndIf
$oHTTP.WaitForResponse
$HeaderResponses = $oHTTP.GetAllResponseHeaders()
If $ignorecookies = 0 Then
; Handle Cookies
$array = StringRegExp($HeaderResponses, 'Set-Cookie: (.+)\r\n', 3)
;$cookies = ''
for $i = 0 to UBound($array) - 1
; Add all cookies to a single string, and then clean it up.
$cook = $array[$i] & ';'
; Removing parts we do not use..
$cook = StringRegExpReplace($cook, "( path| domain| expires)=[^;]+", "")
$cook = StringRegExpReplace($cook, " HttpOnly", "")
$cook = StringRegExpReplace($cook, "[;]{2,}", ";")
$cook1 = StringSplit($cook,";")
For $k=1 To $cook1[0]
If StringInStr($cook1[$k],"=") Then
     $cook2 = StringSplit(StringReplace($cook1[$k]," ", ""),"=")
     if $cookies[0][0] == "" Then
     $cookies[0][0] = $cook2[1]
     $cookies[0][1] = $cook2[2]
     Else
     $inserted = 0
     for $j = 0 to UBound($cookies) - 1
     If $cook2[1] == $cookies[$j][0] Then
     $cookies[$j][1] = $cook2[2]
     $inserted = 1
     ElseIf ($j == (UBound($cookies) - 1)) And ($inserted == 0) Then
     ReDim $cookies[UBound($cookies) + 1][2]
     $cookies[UBound($cookies) - 1][0] = $cook2[1]
     $cookies[UBound($cookies) - 1][1] = $cook2[2]
     EndIf
     Next
     EndIf
EndIf
Next
Next
EndIf
Dim $ret[4]
If StringInStr($HeaderResponses, "Location:") <> 0 Then
$ret["0"] = $oHTTP.GetResponseHeader("Location")
$ret["1"] = 1
Else
$ret["0"] = ""
$ret["1"] = 0
EndIf
$ret["2"] = $oHTTP.Responsetext
;$ret["method"] = $method
$ret["3"] = $oHTTP.GetAllResponseHeaders()
Return $ret
EndFunc
;function to encode url for websurfing
Func URLEncode($urlText)
$url = ""
For $i = 1 To StringLen($urlText)
     $acode = Asc(StringMid($urlText, $i, 1))
     Select
         Case ($acode >= 48 And $acode <= 57) Or _
                 ($acode >= 65 And $acode <= 90) Or _
                 ($acode >= 97 And $acode <= 122)
             $url = $url & StringMid($urlText, $i, 1)
         Case $acode = 32
             $url = $url & "+"
         Case Else
             $url = $url & "%" & Hex($acode, 2)
     EndSelect
Next
Return $url
EndFunc
;function to make cookies from array
Func mkCookies()
$rt = ""
for $j = 0 to UBound($cookies) - 1
$rt = $rt & $cookies[$j][0] & "=" & $cookies[$j][1]
If $j <> (UBound($cookies) - 1) Then
$rt = $rt & "; "
EndIf
Next
Return $rt
EndFunc
;function to add element to array ( fuck autoit )
Func arradd($array, $value)
If IsArray($array) Then
_ArrayAdd($array, $value)
Return $array
Else
Dim $rt[1] = [$value]
Return $rt
EndIf
EndFunc
;function to clear links list
Func ClearLinks()
$linklist = 0
$dllist = 0
GUICtrlSetData($LinkInput,'')
For $i = 0 to UBound($listviewcontrols) - 1
GUICtrlDelete($listviewcontrols[$i])
Next
$listviewcontrols = 0
_GUICtrlButton_Enable($btnClearlinks, False)
_GUICtrlButton_Enable($btnCopy, False)
_GUICtrlButton_Enable($btnSendToIDM, False)
EndFunc
;function to send download links to IDM
Func SendToIDM()
If UBound($linklist) > 0 Then
$clsid = "{AC746233-E9D3-49CD-862F-068F7B7CCCA4}"
$idd = "{4BD46AAE-C51F-4BF7-8BC0-2E86E33D1873}"
$desc = "SendLinkToIDM hresult(bstr;bstr;bstr;bstr;bstr;bstr;bstr;bstr;long);"
$idm = ObjCreateInterface($clsid,$idd,$desc)
For $i = 0 to UBound($linklist) - 1
$idm.SendLinkToIDM($linklist[$i], $dllist[$i], '', '', '', '','', '', 2)
Next
addText("[IDM] Đã gửi link download sang IDM",$hListBox)
EndIf
EndFunc
Func _ErrFunc()
ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
         "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
         "err.description is: " & @TAB & $oError.description & @CRLF & _
         "err.source is: " & @TAB & $oError.source & @CRLF & _
         "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
         "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
         "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
         "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
         "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc
;function executing when clipboard changed
Func CBmonitor($data)
If $data<>$lastCopied Then
$lastCopied=$data
$isfsharelink = StringRegExp($data,'http://(.*?)fshare.vn/file(.*?)')
$isfsharefolder = StringRegExp($data,'http://(.*?)fshare.vn/folder(.*?)')
$data = StringReplace($data, @CRLF, " ")
$data = StringReplace($data, @TAB, " ")
$datax = StringSplit($data, " ")
If $isfsharelink = 1 Or $isfsharefolder = 1 Then
dim $tmprt
For $i = 0 to $datax[0]
$i1 = StringRegExp($datax[$i],'http://(.*?)fshare.vn/file(.*?)')
$i2 = StringRegExp($datax[$i],'http://(.*?)fshare.vn/folder(.*?)')
If $i1 = 1 Or $i2 = 1 Then
     $tmprt = arradd($tmprt, $datax[$i])
EndIf
Next
$data = _ArrayToString($tmprt, @CRLF)
addText("[Clipboard Monitor] Đã lấy link fshare từ clipboard",$hListBox)
$ctb = GUICtrlRead($LinkInput)
If StringLen($ctb)>0 Then
$ctb = $ctb & @CRLF
EndIf
GUICtrlSetData($LinkInput,$ctb & $data)
EndIf
EndIf
EndFunc
;WM_COMMAND overwrite
Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
If BitAND($wParam, 0x0000FFFF) = $btnStop Then
$processing = 0
_GUICtrlButton_Enable($btnStop, False)
EndIf
     Return $GUI_RUNDEFMSG
EndFunc
Func _Base64Encode($sData)
Local $oXml = ObjCreate("Msxml2.DOMDocument")
If Not IsObj($oXml) Then
     SetError(1, 1, 0)
EndIf
Local $oElement = $oXml.createElement("b64")
If Not IsObj($oElement) Then
     SetError(2, 2, 0)
EndIf
$oElement.dataType = "bin.base64"
$oElement.nodeTypedValue = Binary($sData)
Local $sReturn = $oElement.Text
If StringLen($sReturn) = 0 Then
     SetError(3, 3, 0)
EndIf
Return $sReturn
EndFunc
;Ma hoa
Func _Base64Decode($sData)
Local $oXml = ObjCreate("Msxml2.DOMDocument")
If Not IsObj($oXml) Then
     SetError(1, 1, 0)
EndIf
Local $oElement = $oXml.createElement("b64")
If Not IsObj($oElement) Then
     SetError(2, 2, 0)
EndIf
$oElement.dataType = "bin.base64"
$oElement.Text = $sData
Local $sReturn = BinaryToString($oElement.nodeTypedValue, 4)
If StringLen($sReturn) = 0 Then
     SetError(3, 3, 0)
EndIf
Return $sReturn
EndFunc ;==>_Base64Decode
; GUI MESSAGE LOOP
$link_site = "xxxxxxxxxxxx"
$link_homepage = "xxxxxxxxxxxxx"
$link_account = "xxxxxxxxxxxxxxx"
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btnGetLink
parseLinks(GUICtrlRead($LinkInput))
Case $msg = $btnClearlinks
ClearLinks()
Case $msg = $btnSendToIDM
SendToIDM()
Case $msg = $btnCopy
;_ArrayToClip($linklist);
ClipPut(_ArrayToString($linklist, @CRLF))
addText("[Clipboard Monitor] Đã Copy Link vào clipboard",$hListBox)
Case $msg = $btnSaveAccInfo
saveAcc($txtAccEmail, $txtAccPassword,$f)
Case $msg = $visit_info
ShellExecute($link_site)
Case $msg = $homepage_link
ShellExecute($link_homepage)
Case $msg = $account_link
ShellExecute($link_account)
Case $msg = $Account_1
     GUICtrlSetData($hminh_set, "1")
Case $msg = $Account_2
     GUICtrlSetData($hminh_set, "2")
Case $msg = $Account_3
     GUICtrlSetData($hminh_set, "3")
EndSelect
WEnd

I'm referring to the

This UI

GUIStartGroup()
$Account_1 = GUICtrlCreateRadio("Tài khoản 1", 530, 213, 80, 20)
$Account_2 = GUICtrlCreateRadio("Tài khoản 2", 610, 213, 80, 20)
$Account_3 = GUICtrlCreateRadio("Account.txt", 690, 213, 75, 20)
GUICtrlSetState($Account_1, $GUI_CHECKED)

I set the data by

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btnGetLink
parseLinks(GUICtrlRead($LinkInput))
Case $msg = $btnClearlinks
ClearLinks()
Case $msg = $btnSendToIDM
SendToIDM()
Case $msg = $btnCopy
;_ArrayToClip($linklist);
ClipPut(_ArrayToString($linklist, @CRLF))
addText("[Clipboard Monitor] Đã Copy Link vào clipboard",$hListBox)
Case $msg = $btnSaveAccInfo
saveAcc($txtAccEmail, $txtAccPassword,$f)
Case $msg = $visit_info
ShellExecute($link_site)
Case $msg = $homepage_link
ShellExecute($link_homepage)
Case $msg = $account_link
ShellExecute($link_account)
Case $msg = $Account_1
     GUICtrlSetData($hminh_set, "1")
Case $msg = $Account_2
     GUICtrlSetData($hminh_set, "2")
Case $msg = $Account_3
     GUICtrlSetData($hminh_set, "3")
EndSelect
WEnd
[/code]

and it is not work at

[code]
Dim $aRecords
If Not _FileReadToArray($f, $aRecords) Then
$username = ""
$password = ""
ElseIf $hminh_set == 1 Then
$username = "aaaa"
$password = "aaaa"
ElseIf $hminh_set == 2 Then
$username = "bbbb"
$password = "bbbb"
ElseIf $hminh_set == 3 Then
$username = "ccccc"
$password = "cccc"

ElseIf $aRecords[0] > 1 Then
$usernamed = $aRecords[1]
$passwordd = $aRecords[2]

addText("[Account] Sử dụng tài khoản " & $username & " ...",$hListBox)
EndIf

Thanks for All

Edited by minhlaobao

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Please put your code between [autoit][/autoit] tags. This enhances readability.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
minhlaobao

Welcome to AutoIt and the forum!

Please put your code between [autoit][/autoit] tags. This enhances readability.

Thanks you, I have update code Edited by minhlaobao

Share this post


Link to post
Share on other sites
water

Looks good now ;)

Is function _WM_Command called when you press button 1? Insert a MsgBx or Consolewrite statement into the function.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
minhlaobao

Looks good now ;)

Is function _WM_Command called when you press button 1? Insert a MsgBx or Consolewrite statement into the function.

You can correct for me the above code, I'm trying to learn AutoIt, thank you very much.

Share this post


Link to post
Share on other sites
water

I haven't found an error. I'm just asking questions.

If your program doesn't work as expected, you need to do some kind of debugging. That'ts the best way to learn AutoIt.

Insert

MsgBox(0, "","Function called!")
after line
Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
and test if you get the MsgBox when clicking the button.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Mechaflash

@water it's a webpage login script...


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
minhlaobao

Well here is one login site script. But I want it to have the option of different for accounts.

Share this post


Link to post
Share on other sites
Melba23

Mechaflash,

And where is the problem in that? The Forum rules only mention "log-in and security dialogs" - this looks like a normal page to me. I am happy for the thread to stay open. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Mechaflash

My mistake. I thought we blocked web login scripts in the past.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
water

@water it's a webpage login script...

Where do you see that it is a web login script? I can't see any web related code in the script :huh:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

Mechaflash,

I thought we blocked web login scripts in the past

Correct - but no longer, which is why this script is not a problem. ;)

No harm done. But please go and read the current Rules - there is a link at bottom right of each page. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
minhlaobao

@Melba23 I'm login my account :( I do not have to use it for destructive purposes: (

Share this post


Link to post
Share on other sites
Melba23

minhlaobao,

Do not be concerned, there is no problem with this script that I can see. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
careca

Ok, so, this bit would never run, placed a msgbox, and it never came up:

Dim $aRecords
If Not _FileReadToArray($f, $aRecords) Then
$username = ""
$password = ""
ElseIf $hminh_set == 1 Then
$username = "aaaa"
$password = "aaaa"
ElseIf $hminh_set == 2 Then
$username = "bbbb"
$password = "bbbb"
ElseIf $hminh_set == 3 Then
$username = "ccccc"
$password = "cccc"

ElseIf $aRecords[0] > 1 Then
$usernamed = $aRecords[1]
$passwordd = $aRecords[2]

addText("[Account] Sử dụng tài khoản " & $username & " ...",$hListBox)
EndIf

I changed == to = because where're not comparing if strings are case sensitive, it's just numbers.

In addition to that, there wasn't anything that would write the control.

Sure you had

ElseIf $hminh_set == 2 Then
$username = "bbbb"
$password = "bbbb"

But that doesn't write to the control, just changes the variable.

Try this

#include <GUIListBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GUIConstants.au3>
#include <GuiButton.au3>
Opt("TrayIconDebug", 1)
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Global $version = "1.0.2"
Global $hListBox,$origHWND,$lastCopied='',$WM_CLIPUPDATE=0x031D
Local $hminh_set, $Account_1, $Account_2, $Account_3, $hGUI, $linklist, $dllist, $listviewcontrols, $username, $password, $retry = 0, $loggedin = 0, $cookies[1][2] = [["", ""]], $f = "account.txt", $processing = 0

; GUI
$hGUI = GUICreate("GetLink Fshare " & $version & " - BeGood.Vn", 800, 600)
;GUISetIcon(@SystemDir & "\mspaint.exe", 0)
; Intercept Windows command messages with out own handler
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
;Clipboard monitor
$origHWND = DLLCall("user32.dll","int","AddClipboardFormatListener","hwnd",$hGUI)
If IsArray($origHWND) Then
$origHWND = $origHWND[0]
EndIf
GUIRegisterMsg($WM_CLIPUPDATE,"OnClipBoardChange")
Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam)
; do what you need when clipboard changes
CBmonitor(ClipGet())
EndFunc
; Input link box
GUICtrlCreateLabel("Fshare links (Ðua link fshare vào dây, phân cách b?i xu?ng dòng ho?c space)" & @CRLF & "N?u có m?t kh?u thì thêm vào sau link kèm theo ký t? | (vd : link | matkhau) N?u không nh?p m?t kh?u cùng link, tool s? t? d?ng h?i.", 5, 3)
$LinkInput = GUICtrlCreateEdit("", 5, 40, 500, 185)
; LIST VIEW
Local $iListView = GUICtrlCreateListView("", 5, 235, 790,180)
_GUICtrlListView_AddColumn($iListView, "Fshare Link", 200)
_GUICtrlListView_AddColumn($iListView, "Download Link", 530)
_GUICtrlListView_AddColumn($iListView, "Size", 55)
;buttons
$btnStop = GUICtrlCreateButton ("D?NG L?Y LINK !", 520, 40, 250, 40)
_GUICtrlButton_Show($btnStop, False)
$btnGetLink = GUICtrlCreateButton ("L?y Link Download >>>", 520, 40, 250, 40)
$btnClearlinks = GUICtrlCreateButton ("Xóa danh sách download", 520, 420, 180, 45)
_GUICtrlButton_Enable($btnClearlinks, False)
$btnSendToIDM = GUICtrlCreateButton ("G?i link sang IDM", 520, 475, 180, 45)
_GUICtrlButton_Enable($btnSendToIDM, False)
$btnCopy = GUICtrlCreateButton ("Copy links download", 520, 530, 180, 45)
_GUICtrlButton_Enable($btnCopy, False)
;checkbox
;GUICtrlCreateCheckbox("Xóa list cu", 710, 20, 80, 20)
;GUICtrlSetState(-1, $GUI_CHECKED)
; Listbox Progress
$hListBox = _GUICtrlListBox_Create($hGUI, "", 5, 420, 500, 170, BitOR($LBS_NOSEL, $WS_VSCROLL, $WS_HSCROLL, $LBS_HASSTRINGS))
GUISetState(@SW_SHOW)
_GUICtrlListBox_ResetContent($hListBox)
;_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
addText("GetLink Fshare " & $version & ' - BeGood.Vn',$hListBox);
addText("Ph?n m?m này du?c xây d?ng d?a trên code c?a b?n lnt900, ch?nh s?a và phát tri?n thêm b?i Mr.Minh",$hListBox)
addText("M?i th?c m?c các b?n có th? g?i v? Email: huuminh@begood.vn, Ph?n m?m này du?c chia s? và",$hListBox)
addText("download duy nh?t t?i d?a ch? http://begood.vn. Hãy dóng góp account cho chúng tôi b?ng cách",$hListBox)
addText("g?i tài kho?n v? d?a ch? email trên ho?c g?i tin nh?n FSHARE VIP 1572606 g?i d?n 8777",$hListBox)
addText("Cám on các b?n !",$hListBox)
addText("----------------------------------------------------------------------------------------",$hListBox)

$txtAccEmail = GUICtrlCreateInput($username, 540, 115, 210, 22)
$txtAccPassword = GUICtrlCreateInput("", 540, 155, 210, 22, 0x0020)
;function to add text and scroll listbox to bottom
Func addText($txt,$listBox)
     _GUICtrlListBox_InsertString($listBox, $txt, -1)
$num = _SendMessage($hListBox, 0x18B, 0, 0)
_GUICtrlListBox_SetCurSel($listBox, $num -1)
EndFunc
;account info
Dim $aRecords

; Add Link
$account_link = GUICtrlCreateButton ("More Account", 710, 420, 80, 45)
$homepage_link = GUICtrlCreateButton ("HomePage", 710, 475, 80, 45)
$visit_info = GUICtrlCreateButton ("Check Version", 710, 530, 80, 45)
;Account
GUIStartGroup()
$Account_1 = GUICtrlCreateRadio("Tài kho?n 1", 530, 213, 80, 20)
$Account_2 = GUICtrlCreateRadio("Tài kho?n 2", 610, 213, 80, 20)
$Account_3 = GUICtrlCreateRadio("Account.txt", 690, 213, 75, 20)
GUICtrlSetState($Account_1, $GUI_CHECKED)
; GROUP / Input fshare account
GUICtrlCreateGroup("Thông tin Fshare Account", 520, 80,250,155)
GUICtrlCreateLabel("Email :", 540, 100)
GUICtrlCreateLabel("M?t kh?u :", 540, 140)
$btnSaveAccInfo = GUICtrlCreateButton ("Luu l?i", 600, 185, 100, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
;function to save account to tzt file
Func saveAcc($usr, $pw,$file)
$usrx = GUICtrlRead($usr)
$pwx = GUICtrlRead($pw)
FileDelete($file)
$fxx = FileOpen($file, 1)
FileSetPos($fxx,0,0)
FileFlush($fxx)
If Random() < 0.5 Then
$Letter0 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter1 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter3 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter4 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
Else
$Letter0 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter1 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter3 = Chr(Random(Asc("a"), Asc("z"), 1))
$Letter4 = Chr(Random(Asc("A"), Asc("Z"), 1))
$Letter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
Endif
$lt = $Letter0 & $Letter1 & $Letter2 & $Letter3 & $Letter4 & $Letter5
FileWrite($fxx, $usrx & @CRLF)
FileWrite($fxx, $pwx & @CRLF)
FileClose($fxx)
addText("[Account] Ðã luu thông tin tài kho?n fshare ...",$hListBox)
EndFunc
;function logout of fshare
Func logoutF()
addText("[Fshare] Logout kh?i fshare ...",$hListBox)
$res = getHTTP("http://www.fshare.vn/logout.php", mkCookies())
$res = getHTTP("http://www.fshare.vn/", mkCookies(), 'http://www.fshare.vn/logout.php')
If StringInStr($res[2], "login.php") <> 0 Then
addText(" -> Ðã thoát.",$hListBox)
$loggedin = 0
Else
addText("[L?i] chua thoát du?c kh?i fshare !",$hListBox)
EndIf
EndFunc
;Function Login to Fshare
Func loginF()
$user = GUICtrlRead($txtAccEmail)
$pword = GUICtrlRead($txtAccPassword)
addText("[Fshare] Ðang nh?p vào Fshare ...",$hListBox)
$res = getHTTP("https://www.fshare.vn/login.php?url_refe=https%3A%2F%2Fwww.fshare.vn%2Findex.php&login_useremail=" & URLEncode($user) & '&login_password=' & URLEncode($pword), mkCookies(),"https://www.fshare.vn/login.php",0, 1, 0)
$res = getHTTP("http://www.fshare.vn/", mkCookies())
If StringInStr($res[2], "logout.php") <> 0 Then
addText(" -> Ðang nh?p thành công !",$hListBox)
If StringInStr($res[2], "VIP.gif") <> 0 Then
addText(" -> Tài kho?n VIP ... OK !",$hListBox)
$loggedin = 1
Else
addText(" -> Không ph?i tài kho?n VIP. Thoát kh?i Fshare ...",$hListBox)
logoutF()
EndIf
Else
addText(" -> Ðang nh?p th?t b?i, ki?m tra l?i tk fshare",$hListBox)
EndIf
EndFunc
;function to parse links input
Func parseLinks($input, $loggoutthen = 1)
If $processing = 0 Then
$links = StringReplace($input, @CRLF, " ")
$links = StringReplace($links, @TAB, " ")
$aLink = StringSplit($links, " ")
$hasfsharelinks = StringRegExp($links,'http:/(.*?)fshare.vn/(.*?)')
If $hasfsharelinks = 1 Then
_GUICtrlButton_Show($btnGetLink, False)
_GUICtrlButton_Show($btnStop, True)
;_GUICtrlButton_SetText($btnGetLink, "D?NG L?Y LINK !")
$processing = 1
If $loggedin = 0 Then
;Login to Fshare
loginF()
EndIf
If $loggedin = 1 Then
For $x=1 To $aLink[0]
     If $loggedin = 1 And $processing = 1 Then
     $retry = 0
     parseLink($aLink[$x])
     EndIf
Next
EndIf
If $loggoutthen = 1 And $loggedin = 1 Then
logoutF()
EndIf
If $retry < 4 And $processing = 1 Then
addText("[OK] Ðã x? lý xong t?t c? các links !",$hListBox)
ElseIf $retry < 4 And $processing = 0 Then
addText("[Fshare] Ðã ng?ng l?y link !",$hListBox)
Else
addText("[L?i] trùng phiên dang nh?p quá 4 l?n, vui lòng th? l?i sau vài phút !",$hListBox)
$retry = 0
EndIf
;_GUICtrlButton_SetText($btnGetLink, "L?y Link Download >>>")
_GUICtrlButton_Enable($btnStop, True)
_GUICtrlButton_Show($btnStop, False)
_GUICtrlButton_Show($btnGetLink, True)
$processing = 0
Else
addText("[L?i] Không có link fshare trong danh sách link !",$hListBox)
EndIf
EndIf
EndFunc
;function to get fshare download link
Func parseLink($lnk)
If $processing = 1 Then
$validLink = StringRegExp($lnk,'http:/(.*?)fshare.vn/file(.*?)')
$isfolder = StringRegExp($lnk,'http:/(.*?)fshare.vn/folder(.*?)')
If $validLink = 1 Then

If StringInStr($lnk, '|') <> 0 Then
;$lnk = StringReplace($lnk, '*', '|')
$plink = StringSplit($lnk, '|')
$lnk = $plink[1]
$dlpw = $plink[2]
Else
$dlpw = ''
EndIf
If StringInStr($lnk, '?') <> 0 Then
$plink = StringSplit($lnk, '?')
$slink = $plink[1]
addText("[Fshare] L?y link cho file " & $slink & " ...",$hListBox)
$res = getHTTP($lnk, mkCookies(), $slink, 1, 1)
Else
$slink = $lnk
addText("[Fshare] L?y link cho file " & $slink & " ...",$hListBox)
$res = getHTTP($lnk, mkCookies(), '', 1)
EndIf

If (StringInStr($res[2], "logout.php") <> 0) Or ($res[1] = 1) Then
$filesize = "unknown"
If $res[1] = 1 Then
     ;GUICtrlSetData($LinkInput,GUICtrlRead($LinkInput) & @CRLF & "Có redir d?n " & $res[0])
     $size = InetGetSize($res[0])
     If $size > 1000000000 Then
     $filesize = Round($size/(1024^3),2) & " GB"
     ElseIf $size > 1000000 Then
     $filesize = Round($size/(1024^2),2) & " MB"
     ElseIf $size > 1000 Then
     $filesize = Round($size/(1024),2) & " KB"
     EndIf
     $listviewcontrols = arradd($listviewcontrols, GUICtrlCreateListViewItem($slink & "|" & $res[0] & "|" & $filesize, $iListView))
     $linklist = arradd($linklist, $res[0])
     $dllist = arradd($dllist, $slink)
     _GUICtrlButton_Enable($btnClearlinks, True)
     _GUICtrlButton_Enable($btnCopy, True)
     _GUICtrlButton_Enable($btnSendToIDM, True)
     addText(" -> Done.",$hListBox)
ElseIf StringInStr($res[2], "vip_package_bt.png") <> 0 AND StringInStr($res[2], "fshare.vn/vip") <> 0 Then
     $arr = StringRegExp($res[2], '<form action="(.*?)" method="post" name="frm_download">', 3)
     If UBound($arr) > 0 Then
     ;GUICtrlSetData($LinkInput,GUICtrlRead($LinkInput) & @CRLF & "L?y du?c link download " & $arr[0])
     $size = InetGetSize($arr[0])
     If $size > 1000000000 Then
     $filesize = Round($size/(1024^3),2) & " GB"
     ElseIf $size > 1000000 Then
     $filesize = Round($size/(1024^2),2) & " MB"
     ElseIf $size > 1000 Then
     $filesize = Round($size/(1024),2) & " KB"
     EndIf
     $listviewcontrols = arradd($listviewcontrols, GUICtrlCreateListViewItem($slink & "|" & $arr[0] & "|" & $filesize, $iListView))
     $linklist = arradd($linklist, $arr[0])
     $dllist = arradd($dllist, $slink)
     _GUICtrlButton_Enable($btnClearlinks, True)
     _GUICtrlButton_Enable($btnCopy, True)
     _GUICtrlButton_Enable($btnSendToIDM, True)
     addText(" -> Done.",$hListBox)
     EndIf
ElseIf StringInStr($res[2], "vip_package_bt.png") <> 0 AND StringInStr($res[2], '<input type="text" name="link_file_pwd_dl"/>') <> 0 Then
     addText(" -> Link Download có m?t kh?u ...",$hListBox)
     If StringInStr($res[2], '<ul class="message-error">') <> 0 Then
     $announce = 'M?t kh?u không dúng. Nh?p l?i ?'
     Else
     $announce = 'File này yêu c?u nh?p m?t kh?u d? t?i.'
     EndIf
     if $dlpw = '' Then
     $filename = StringRegExp($res[2], '<p><b>(.*?):</b>(.*?)</p>', 3)
     $pos = WinGetPos($hGUI)
     $dlpw = InputBox("M?t kh?u", $slink & @CRLF & '-> ' & $filename[1] & @CRLF & @CRLF & $announce & ' B? tr?ng ho?c Cancel d? b? qua link này. N?u không nh?p m?t kh?u sau 15 giây s? t? d?ng b? qua', '', '', - 1, 240, $pos[0]+200, $pos[1]+200, 15)
     If $dlpw = '' Then
     $err = '[Fshare] B? qua link ' & $slink & ' -> unknown error !'
     Select
     Case @error = 0
         $err = '[Fshare] B? qua link ' & $slink & ' -> b?i ngu?i dùng'
     Case @error = 1
         $err = '[Fshare] B? qua link ' & $slink & ' -> b?i ngu?i dùng'
     Case @error = 2
         $err = '[Fshare] B? qua link ' & $slink & ' -> Timeout 15s'
     EndSelect
     EndIf
     EndIf
     If $dlpw = '' Then
     addText($err ,$hListBox)
     Else
     $fileid = StringRegExp($res[2], '<input type="hidden" name="file_id" value="(.*?)"/>', 3)
     $newlnk = $lnk & '?action=download_file&file_id=' & $fileid[0] & '&link_file_pwd_dl=' & URLEncode($dlpw)
     parseLink($newlnk)
     EndIf
ElseIf StringInStr($res[2], '<ul class="message-error">') <> 0 Then
     addText("[Fshare][L?i] Có th? dang trùng phiên dang nh?p v?i ngu?i khác !",$hListBox)
     logoutF()
     addText(" -> Ð?i x? lý l?i sau 1 phút ...",$hListBox)
     $retry += 1
     If $retry < 4 Then
     Sleep(60000)
     loginF()
     parseLink($lnk)
     EndIf
Else
     addText("[Fshare] Error: No Download Link !",$hListBox)
EndIf
EndIf
;Sleep(200)
ElseIf $isfolder = 1 Then
addText("[Fshare] Link " & $lnk & " là thu m?c !",$hListBox)
$res = getHTTP($lnk, mkCookies(), '', 1)
If StringInStr($res[2], "fshare.vn/file/") <> 0 Then
$arr = StringRegExp($res[2], '<a href="(.*?)" target="_blank"><span class="filename">', 3)
addText("[Fshare] Có " & UBound($arr) & " file trong thu m?c ...",$hListBox)
;parseLinks(_ArrayToString($arr, " "), 0)
For $i = 0 To UBound($arr) - 1
     parseLink($arr[$i])
Next
Else
addText("[Fshare] Thu m?c tr?ng !",$hListBox)
EndIf
EndIf
Else
logoutF()
;_GUICtrlButton_Enable($btnStop, False)
;_GUICtrlButton_SetText($btnGetLink, "Ðang d?ng ...")
EndIf
EndFunc
;function to get/post http links
Func getHTTP($lnk, $cookie = '', $refer = '', $ignorecookies = 0, $post = 0, $redir = 0)
$method = "GET"
$weblink = StringSplit($lnk, '?')
;addText($weblink[2],$hListBox)
If $post = 1 Then
$method = "POST"
$linklink = $weblink[1]
$poststring = $weblink[2]
Else
$linklink = $lnk
EndIf
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
If $redir = 0 Then
$oHTTP.Option(6) = False
EndIf
$oHTTP.Open($method, $linklink , False)
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0")
If StringLen($refer)>1 Then
$oHTTP.SetRequestHeader("Referer", $refer)
EndIf
If StringLen($cookie)>1 Then
$oHTTP.SetRequestHeader("Cookie", $cookie)
EndIf
If $post = 1 Then
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.SetRequestHeader("Content-Length", StringLen($poststring))
$oHTTP.Send($poststring)
Else
$oHTTP.Send()
EndIf
$oHTTP.WaitForResponse
$HeaderResponses = $oHTTP.GetAllResponseHeaders()
If $ignorecookies = 0 Then
; Handle Cookies
$array = StringRegExp($HeaderResponses, 'Set-Cookie: (.+)\r\n', 3)
;$cookies = ''
for $i = 0 to UBound($array) - 1
; Add all cookies to a single string, and then clean it up.
$cook = $array[$i] & ';'
; Removing parts we do not use..
$cook = StringRegExpReplace($cook, "( path| domain| expires)=[^;]+", "")
$cook = StringRegExpReplace($cook, " HttpOnly", "")
$cook = StringRegExpReplace($cook, "[;]{2,}", ";")
$cook1 = StringSplit($cook,";")
For $k=1 To $cook1[0]
If StringInStr($cook1[$k],"=") Then
     $cook2 = StringSplit(StringReplace($cook1[$k]," ", ""),"=")
     if $cookies[0][0] == "" Then
     $cookies[0][0] = $cook2[1]
     $cookies[0][1] = $cook2[2]
     Else
     $inserted = 0
     for $j = 0 to UBound($cookies) - 1
     If $cook2[1] == $cookies[$j][0] Then
     $cookies[$j][1] = $cook2[2]
     $inserted = 1
     ElseIf ($j == (UBound($cookies) - 1)) And ($inserted == 0) Then
     ReDim $cookies[UBound($cookies) + 1][2]
     $cookies[UBound($cookies) - 1][0] = $cook2[1]
     $cookies[UBound($cookies) - 1][1] = $cook2[2]
     EndIf
     Next
     EndIf
EndIf
Next
Next
EndIf
Dim $ret[4]
If StringInStr($HeaderResponses, "Location:") <> 0 Then
$ret["0"] = $oHTTP.GetResponseHeader("Location")
$ret["1"] = 1
Else
$ret["0"] = ""
$ret["1"] = 0
EndIf
$ret["2"] = $oHTTP.Responsetext
;$ret["method"] = $method
$ret["3"] = $oHTTP.GetAllResponseHeaders()
Return $ret
EndFunc
;function to encode url for websurfing
Func URLEncode($urlText)
$url = ""
For $i = 1 To StringLen($urlText)
     $acode = Asc(StringMid($urlText, $i, 1))
     Select
         Case ($acode >= 48 And $acode <= 57) Or _
                 ($acode >= 65 And $acode <= 90) Or _
                 ($acode >= 97 And $acode <= 122)
             $url = $url & StringMid($urlText, $i, 1)
         Case $acode = 32
             $url = $url & "+"
         Case Else
             $url = $url & "%" & Hex($acode, 2)
     EndSelect
Next
Return $url
EndFunc
;function to make cookies from array
Func mkCookies()
$rt = ""
for $j = 0 to UBound($cookies) - 1
$rt = $rt & $cookies[$j][0] & "=" & $cookies[$j][1]
If $j <> (UBound($cookies) - 1) Then
$rt = $rt & "; "
EndIf
Next
Return $rt
EndFunc
;function to add element to array ( fuck autoit )
Func arradd($array, $value)
If IsArray($array) Then
_ArrayAdd($array, $value)
Return $array
Else
Dim $rt[1] = [$value]
Return $rt
EndIf
EndFunc
;function to clear links list
Func ClearLinks()
$linklist = 0
$dllist = 0
GUICtrlSetData($LinkInput,'')
For $i = 0 to UBound($listviewcontrols) - 1
GUICtrlDelete($listviewcontrols[$i])
Next
$listviewcontrols = 0
_GUICtrlButton_Enable($btnClearlinks, False)
_GUICtrlButton_Enable($btnCopy, False)
_GUICtrlButton_Enable($btnSendToIDM, False)
EndFunc
;function to send download links to IDM
Func SendToIDM()
If UBound($linklist) > 0 Then
$clsid = "{AC746233-E9D3-49CD-862F-068F7B7CCCA4}"
$idd = "{4BD46AAE-C51F-4BF7-8BC0-2E86E33D1873}"
$desc = "SendLinkToIDM hresult(bstr;bstr;bstr;bstr;bstr;bstr;bstr;bstr;long);"
$idm = ObjCreateInterface($clsid,$idd,$desc)
For $i = 0 to UBound($linklist) - 1
$idm.SendLinkToIDM($linklist[$i], $dllist[$i], '', '', '', '','', '', 2)
Next
addText("[IDM] Ðã g?i link download sang IDM",$hListBox)
EndIf
EndFunc
Func _ErrFunc()
ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
         "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
         "err.description is: " & @TAB & $oError.description & @CRLF & _
         "err.source is: " & @TAB & $oError.source & @CRLF & _
         "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
         "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
         "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
         "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
         "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc
;function executing when clipboard changed
Func CBmonitor($data)
If $data<>$lastCopied Then
$lastCopied=$data
$isfsharelink = StringRegExp($data,'http://(.*?)fshare.vn/file(.*?)')
$isfsharefolder = StringRegExp($data,'http://(.*?)fshare.vn/folder(.*?)')
$data = StringReplace($data, @CRLF, " ")
$data = StringReplace($data, @TAB, " ")
$datax = StringSplit($data, " ")
If $isfsharelink = 1 Or $isfsharefolder = 1 Then
dim $tmprt
For $i = 0 to $datax[0]
$i1 = StringRegExp($datax[$i],'http://(.*?)fshare.vn/file(.*?)')
$i2 = StringRegExp($datax[$i],'http://(.*?)fshare.vn/folder(.*?)')
If $i1 = 1 Or $i2 = 1 Then
     $tmprt = arradd($tmprt, $datax[$i])
EndIf
Next
$data = _ArrayToString($tmprt, @CRLF)
addText("[Clipboard Monitor] Ðã l?y link fshare t? clipboard",$hListBox)
$ctb = GUICtrlRead($LinkInput)
If StringLen($ctb)>0 Then
$ctb = $ctb & @CRLF
EndIf
GUICtrlSetData($LinkInput,$ctb & $data)
EndIf
EndIf
EndFunc
;WM_COMMAND overwrite
Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
If BitAND($wParam, 0x0000FFFF) = $btnStop Then
$processing = 0
_GUICtrlButton_Enable($btnStop, False)
EndIf
     Return $GUI_RUNDEFMSG
EndFunc
Func _Base64Encode($sData)
Local $oXml = ObjCreate("Msxml2.DOMDocument")
If Not IsObj($oXml) Then
     SetError(1, 1, 0)
EndIf
Local $oElement = $oXml.createElement("b64")
If Not IsObj($oElement) Then
     SetError(2, 2, 0)
EndIf
$oElement.dataType = "bin.base64"
$oElement.nodeTypedValue = Binary($sData)
Local $sReturn = $oElement.Text
If StringLen($sReturn) = 0 Then
     SetError(3, 3, 0)
EndIf
Return $sReturn
EndFunc
;Ma hoa
Func _Base64Decode($sData)
Local $oXml = ObjCreate("Msxml2.DOMDocument")
If Not IsObj($oXml) Then
     SetError(1, 1, 0)
EndIf
Local $oElement = $oXml.createElement("b64")
If Not IsObj($oElement) Then
     SetError(2, 2, 0)
EndIf
$oElement.dataType = "bin.base64"
$oElement.Text = $sData
Local $sReturn = BinaryToString($oElement.nodeTypedValue, 4)
If StringLen($sReturn) = 0 Then
     SetError(3, 3, 0)
EndIf
Return $sReturn
EndFunc ;==>_Base64Decode
; GUI MESSAGE LOOP
$link_site = "xxxxxxxxxxxx"
$link_homepage = "xxxxxxxxxxxxx"
$link_account = "xxxxxxxxxxxxxxx"
While 1
ToolTip("$hminh_set "&$hminh_set)
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btnGetLink
parseLinks(GUICtrlRead($LinkInput))
Case $msg = $btnClearlinks
ClearLinks()
Case $msg = $btnSendToIDM
SendToIDM()
Case $msg = $btnCopy
;_ArrayToClip($linklist);
ClipPut(_ArrayToString($linklist, @CRLF))
addText("[Clipboard Monitor] Ðã Copy Link vào clipboard",$hListBox)
Case $msg = $btnSaveAccInfo
saveAcc($txtAccEmail, $txtAccPassword,$f)
Case $msg = $visit_info
ShellExecute($link_site)
Case $msg = $homepage_link
ShellExecute($link_homepage)
Case $msg = $account_link
ShellExecute($link_account)
Case $msg = $Account_1
     $hminh_set = 1
MsgBox(0, '1', '1')
Case $msg = $Account_2
     $hminh_set = 2
MsgBox(0, '2', '2')
Case $msg = $Account_3
     $hminh_set = 3
MsgBox(0, '3', '3')
EndSelect

If Not _FileReadToArray($f, $aRecords) Then
$username = ""
$password = ""
ElseIf $hminh_set = 1 Then
GUICtrlSetData($txtAccEmail, "aaaa")
GUICtrlSetData($txtAccPassword, "aaaa")
ElseIf $hminh_set = 2 Then
GUICtrlSetData($txtAccEmail, "bbbb")
GUICtrlSetData($txtAccPassword, "bbbb")
ElseIf $hminh_set = 3 Then
GUICtrlSetData($txtAccEmail, "cccc")
GUICtrlSetData($txtAccPassword, "cccc")
ElseIf $aRecords[0] > 1 Then
$usernamed = $aRecords[1]
$passwordd = $aRecords[2]

addText("[Account] S? d?ng tài kho?n " & $username & " ...",$hListBox)
EndIf

WEnd

I understand the way of thinking, you had a variable in the data field, and expected that uppon the change of the variable, it would update automatically, but it doesn't, gotta use guictrlsetdata.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
careca

Thanks you Careca, i try it add below one message to see if the value changes, but it still does not alert

ElseIf $hminh_set = 2 Then
GUICtrlSetData($txtAccEmail, "bbbb")
GUICtrlSetData($txtAccPassword, "bbbb")
MsgBox(0, '2', '2')

Try the code i posted.
  • Like 1

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.