
blackandwhite
Active Members-
Posts
21 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
blackandwhite's Achievements

Seeker (1/7)
1
Reputation
-
Marcelos reacted to a post in a topic: Add toolbar icons to SciTe editor
-
Hello all! is it possible to add new toolbar icons like run/build/compile to SciTE4AutoIt (by editing config, properties files etc..) except using additional scripts or tools? And will these features be included/added in next releases?
-
blackandwhite reacted to a post in a topic: Fill forms by unicode characters with _WinHttpSimpleFormFill
-
WinHttp.au3 upload photo to fb group
blackandwhite replied to blackandwhite's topic in AutoIt General Help and Support
Is there any ways to upload more than 3 files? I'm really don't have any idea how to realize that -
hello trancexx thats sad I'm trying to modify your code from here: to upload more than 3 files for this I need to click on image with source above, or return to upload page after 1st 3 files, but last way not return previews for these pictures #include "WinHttp.au3" #include <array.au3> Global $sFB_Email = "email@domain.com" ;<- your email here Global $sFB_sPassword = "password" ;<- your password here Global $sGroupID = "group_id" ; group ID you want to post to $sPic = FileOpenDialog('2 or More Files', @DesktopDir, "Images (*.jpg;*.bmp;*.gif;*.png)", 4 + 1) ; choose a file you want to post Global $splits = StringSplit($sPic, '|') Global $dim = UBound($splits) - 1 If $sPic Then MsgBox(0,'',FB_PostPicToGroup($sGroupID, $sPic),1) Func FB_PostPicToGroup($sGroupID, $sPic) ; Open session Local $hOpen = _WinHttpOpen() ; Connect Local $hConnect = _WinHttpConnect($hOpen, "https://m.facebook.com/") ; Login first (by filling login form) Local $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle "login.php", _ ; target page "login_form", _ ; form identifier "name:email", $sFB_Email, _ ; first field identifier paired with field data "name:pass", $sFB_sPassword) ; second field identifier paired with data ; Navigate to the Group and ask for pic upload Local $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle "/groups/" & $sGroupID, _ ; target page "index:1", _ ; form identifier (by index here, because id or name doesn't exist) "name:view_photo", True, _ ; identify submit control and click it "[RETURN_ARRAY]") ; return array because current URL is needed ;FileWrite('s1.html',$aRead[1]) ; upload page source ; Read current URL (go with the flow) Local $aURL = _WinHttpCrackUrl($aRead[2]) $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle $aURL[6] & $aURL[7], _ ; target page Default, _ ; form identifier (default is used for simplicity because it's the only form on that page) "name:file1", $splits[2], _ "name:file2", $splits[3], _ "name:file3", $splits[4], _ "[RETURN_ARRAY]") ;_ArrayDisplay($aRead, 'return after 3 files') ;FileWrite('s2.html',$aRead[1]) ;page with preview ;;;;;;;;;;;;Return to previous page and upload again next 3 files $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle $aURL[6] & $aURL[7], _ ; target page Default, _ ; form identifier (default is used for simplicity because it's the only form on that page) "name:file1", $splits[5], _ "name:file2", $splits[6], _ "name:file3", $splits[7], _ "[RETURN_ARRAY]") FileWrite('next 3.html',$aRead[1]) ;here must be preview but nothing $aURL = _WinHttpCrackUrl($aRead[2]) $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle $aURL[6] & $aURL[7], _ ; target page Default, _ ; form identifier (by index here, because id or name doesn't exist) "name:view_post", True, _ ; identify submit control and click it "[RETURN_ARRAY]") ;FileWrite('s4.html',$aRead[1]) ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Bye... ;Return $iSuccess EndFunc
-
WinHttp.au3 upload photo to fb group
blackandwhite replied to blackandwhite's topic in AutoIt General Help and Support
ma gosh yes yes, it's actually what I was need, also I thought about to use _WinHttpSimpleFormFill, but it was little complicated to me, thaaank youuu ! -
blackandwhite reacted to a post in a topic: WinHttp.au3 upload photo to fb group
-
WinHttp.au3 upload photo to fb group
blackandwhite posted a topic in AutoIt General Help and Support
Hello everybody! tried everything I can found around web/forums, also trying to clone all headers and POST parameters with data(payload), but this code to upload 1 simple picture to facebook group still sucks & don't returns the page with preview image #include <WinHttp.au3> #include <WinHttpConstants.au3> #include <String.au3> Func _FBStart() Local $HOST = "m.facebook.com" Local $hSession = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; rv:44.0) Gecko/20100101 Firefox/44.0") If @error Then Return SetError(1, 0, 0) Else Local $HTTP_ConnectFB = _WinHttpConnect($hSession, $HOST, $INTERNET_DEFAULT_HTTPS_PORT) If @error Then Return SetError(2, 0, 0) Else Return $HTTP_ConnectFB EndIf EndIf EndFunc Global $startttttttt = _FBStart() $login = _FBLogin() Func _FBLogin() ;$Email = StringReplace($Email, '@', '%40', 1) $Email = 'yaEmail.@domain.com' $Password = 'p@$$w0rd' $profile_id = 'profile_id' $target_group = 'group_id' If @error Then Return SetError(1, 0, 0) Else Local $HTML = _WinHttpSimpleSSLRequest($startttttttt, "GET", "", Default, Default, Default, 1) If @error Then Return SetError(2, 0, 0) Else ;;;;;;;;;;;FileWrite("m.fb.com.html", $HTML[1]) Local $returnvalue = _StringBetween($HTML[1], 'value="', '"') If @error Then Return SetError(3, 0, 0) Else ;If UBound($returnvalue) < 9 Then ;Return False ;Else Local $value0 = $returnvalue[0] ; Local $value7 = $returnvalue[7] ;0 Local $value8 = $returnvalue[8] ;1 Local $HTML2 = _WinHttpSimpleSSLRequest($startttttttt, "POST", "/login.php?m=m&refsrc=http%3A%2F%2Fm.facebook.com%2F&refid=8", "m.facebook.com", "lsd=&charset_test=" & $value0 & "&version=1&ajax=1&width=1680&pxr=1&gps=1&email=" & $Email & "&pass=" & $Password & "&m_ts=" & $value7 & "&li=" & $value8, Default, 1) If @error Then Return SetError(4, 0, 0) Else FileWrite("logged in.html", $HTML2[1]) Local $get_group = _WinHttpSimpleSSLRequest($startttttttt, "GET", "/groups/" & $target_group, Default, Default, Default, 1) FileWrite('group_page.html',$get_group[1]) $fb_dtsg = StringRegExp($get_group[1], 'name="fb_dtsg" value="(.+?)"', 3) FileWrite('$fb_dtsg.txt',$fb_dtsg[0] & @CRLF) $charset_test = '%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84' ;%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84 ;'€,´,€,´,水,Д,Є' Local $click_photos_add = _WinHttpSimpleSSLRequest($startttttttt, "POST", "/composer/mbasic/?av=" & $profile_id & "&refid=18", 'https://m.facebook.com/groups/' & $target_group, 'fb_dtsg=' & $fb_dtsg[0] & '&charset_test=' & $charset_test & '&target=' & $target_group & '&c_src=group&cwevent=composer_entry&referrer=group&ctype=inline&cver=amber&rst_icv=&xc_message=&view_photo=Add+Photos', Default, True, 1) FileWrite('after click.html', $click_photos_add) FileWrite('after click[0].html', $click_photos_add[0]) FileWrite('after click[1].html', $click_photos_add[1]) $csid = StringRegExp($click_photos_add[1], 'csid=(.+?)&', 3) $fb_dtsg2 = StringRegExp($click_photos_add[1], 'name="fb_dtsg" value="(.+?)"', 3) FileWrite('$csid.txt', $csid[0] & @CRLF) FileWrite('$fb_dtsg2.txt', $fb_dtsg2[0] & @CRLF) $fileopen = FileOpen('7.jpg', 16); Open in read only mode $fileread = FileRead($fileopen) FileClose($fileopen) ;ConsoleWrite($fileread & @CRLF) Local $boundary = Random(1000000000, 99999999999, 1) MsgBox(0,'',$boundary) Local $sData = '' $sData &= 'Content-Type: multipart/form-data; boundary=--' & $boundary & @CRLF ;$sData &= 'Content-Length:' & '66365' & @CRLF & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="fb_dtsg"' & @CRLF & @CRLF $sData &= $fb_dtsg2[0] & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="charset_test"' & @CRLF & @CRLF $sData &= $charset_test & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="file1"; filename="7.jpg"' & @CRLF $sData &= 'Content-Type: image/jpeg' & @CRLF & @CRLF $sData &= $fileread & @CRLF;;;;;;;;;;;;;;;;;;;;;;;;; $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="file2"; filename=""' & @CRLF $sData &= 'Content-Type: application/octet-stream' & @CRLF & @CRLF & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="file3"; filename=""' & @CRLF $sData &= 'Content-Type: application/octet-stream' & @CRLF & @CRLF & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="add_photo_done"' & @CRLF & @CRLF $sData &= 'Preview' & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="filter_type"' & @CRLF & @CRLF $sData &= '5' & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="target_id"' & @CRLF & @CRLF $sData &= $target_group & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="waterfall_source"' & @CRLF & @CRLF $sData &= 'composer_group' & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="waterfall_id"' & @CRLF & @CRLF $sData &= $csid[0] & @CRLF $sData &= '--' & $boundary & @CRLF $sData &= 'Content-Disposition: form-data; name="waterfall_app_name"' & @CRLF & @CRLF $sData &= 'web_m_basic' & @CRLF $sData &= '--' & $boundary & '--' & @CRLF ;Local $len = StringLen($sData) Local $sHead = '' $sHead &= 'Host: m.facebook.com' & @CRLF $sHead &= 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:44.0) Gecko/20100101 Firefox/44.0' & @CRLF $sHead &= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' & @CRLF $sHead &= 'Accept-Language: en-US,en;q=0.5' & @CRLF $sHead &= 'Accept-Encoding: gzip, deflate, br' & @CRLF $sHead &= 'DNT: 1' & @CRLF $sHead &= 'Referer: https://m.facebook.com/composer/mbasic/?mnt_query&csid=' & $csid[0] & '&ctype=inline&errcode=0&cwevent=composer_entry&tag_friends_query&filter_type=0&av=' & $profile_id & '&rst_icv&icv&ogi_offset=0&ogi_limit=0&lat&lon&pos&x-acc=0&view_photo&_rdr' & @CRLF $sHead &= 'Connection: keep-alive' & @CRLF $sHead &= 'Content-Type: multipart/form-data; boundary=' & $boundary & @CRLF ;$sHead &= 'Content-Length: 66365' & @CRLF Local $photos_preview = _WinHttpSimpleSSLRequest($startttttttt, "POST", '/composer/mbasic/?csid=' & $csid[0] & '&av=' & $profile_id & '&view_overview', Default, $sData, $sHead, True, 1) FileWrite('preview.html', $photos_preview) FileWrite('preview[0].html', $photos_preview[0]) FileWrite('preview[1].html', $photos_preview[1]) ;Local $get_photos_preview = _WinHttpSimpleSSLRequest($startttttttt, "GET", '/composer/mbasic/?csid=' & $csid[0] & '&view_overview&av=' & $profile_id & '&_rdr', Default, Default, Default, 1) ;FileWrite('get_photos_preview.html', $get_photos_preview) ;FileWrite('get_photos_preview[0].html', $get_photos_preview[0]) ;FileWrite('get_photos_preview[1].html', $get_photos_preview[1]) EndIf ;EndIf EndIf EndIf EndIf EndFunc _FBLogout($startttttttt, $login) Func _FBLogout($FBStart, $FBLogin) Local $FBHome = _WinHttpSimpleSSLRequest($FBStart, 'GET') If @error Then Return SetError(1, 0, 0) Else Local $Logout = StringRegExp($FBHome, '<a class=".+?" href="(/logout.php.+?)">Logout', 3) If @error Then Return SetError(2, 0, 0) Else Local $HTML3 = _WinHttpSimpleSSLRequest($FBStart, 'GET', $Logout[0]) If @error Then Return SetError(3, 0, 0) Else Return 1 EndIf EndIf EndIf ;;;;;;;;;;;FileWrite("logged out.html", $HTML3[1]) EndFunc pls heelp to correct this -
Hi people here is pathlinks.txt file: pathlink1 pathlink2 pathlink3 pathlink4 . . ....etcand part code is: Func _GO() $aURL = FileReadToArray("pathlinks.txt") For $i = 0 To $aURL[1] $page = _WinHttpSimpleSSLRequest($Start, 'GET', '/path/' & $aURL[$i], Default, Default, Default, 1) FileWrite('page' & $aURL[$i] & '.html', $page[1]) ;here ;some ;operations Next EndFuncor Func _GO() $aURL = FileReadToArray("pathlinks.txt") For $i = 0 To UBound($aURL) - 1 $page = _WinHttpSimpleSSLRequest($Start, 'GET', '/path/' & $aURL[$i], Default, Default, Default, 1) FileWrite('page' & $aURL[$i] & '.html', $page[1]) ;here ;some ;operations Next EndFuncboth of them wont get correctly path pages and writes zero(empty) data to files, what should I do? using _WinHttpSimpleSSLRequest is important, because I''ll be already authorized on the website before saving pages
-
blackandwhite reacted to a post in a topic: Find string pair and write to file
-
blackandwhite reacted to a post in a topic: Find string pair and write to file
-
Find string pair and write to file
blackandwhite replied to blackandwhite's topic in AutoIt General Help and Support
yes I got this Thank you very much! -
Find string pair and write to file
blackandwhite replied to blackandwhite's topic in AutoIt General Help and Support
it's so close, but how to write this /site/151919 site1 /site/54769 site2 /site/64889 site3 /site/66595 site4 /site/31461 site5to file? Can't modify your source for my need -
Find string pair and write to file
blackandwhite replied to blackandwhite's topic in AutoIt General Help and Support
tnx for answer, but no solutions without using IE.au3? need to work without IE.au3 -
hello all! have this code example: href="/site/create/time=12">String</a><div class="bp"></div></div></div><div><h3 class="bq">main site </h3><ul class="br"><li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="/site/151919time=12">site1</a></td><td class="o"><span class="bt bu">0</span></td></tr></tbody></table></li><li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="/site/54769time=12">site2</a></td><td class="o"><span class="bt bu">0</span></td></tr></tbody></table></li><li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="/site/64889time=12">site3</a></td><td class="o"><span class="bt bu">0</span></td></tr></tbody></table></li><li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="/site/66595time=12">site4</a></td><td class="o"><span class="bt bu">0</span></td></tr></tbody></table></li><li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="/site/31461time=12">site5</a></td><td class="o"><span class="bt bu">0</span></td></tr></tbody></table></li>need get this: /site/151919 site1 /site/54769 site2 /site/64889 site3 /site/66595 site4 /site/31461 site5 I tried with that code: #Include <Array.au3> #Include <String.au3> #include <File.au3> Local $Text = FileRead("example.txt") Global $left1 = '<li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="' Global $right1 = 'time=12">' Global $left2 = 'time=12">' Global $right2 = '</a></td>' $source1 = _StringBetween($Text, $left1,$right1) $source2 = _StringBetween($Text, $left2,$right2) For $i = 0 To UBound($source1) - 1 $source1[$i] = $source1[$i] & " " & $source2[$i] Next _FileWriteFromArray('output.txt', $source1)But getting: /site/151919 String</a><div class="bp"></div></div></div><div><h3 class="bq">main site </h3><ul class="br"><li class="bj"><table class="n bs"><tbody><tr><td class="u"><a href="/site/151919time=12">site1 /site/54769 site2 /site/64889 site3 /site/66595 site4 /site/31461 site5 also tried to use stringregexp, but it too hard for begiiner with bad english like me any solutions?