$aAuth = _VK_SignIn($iApp_ID,"audio,notify,status")
Func _VK_SignIn($iAppID, $sScope, $sRedirect_uri = "http://oauth.vk.com/blank.html", $sDisplay = "wap", $sResponse_type = "token")
Local $sOAuth_url = "https://oauth.vk.com/authorize?client_id=" & $iAppID & "&scope=" & $sScope & "&redirect_uri=" & $sRedirect_uri & "&display=" & $sDisplay & "&response_type=" & $sResponse_type
Return __guiAccessToken($sOAuth_url, $iAppID & " - " & $sScope, $sRedirect_uri)
EndFunc
Global $sSs=1+2+4+8+32+256+512+64+1024+4096+8192+2048+16+131072+65536+262144+524288+1048576+32768
$aA = _VK_SignIn($iID, $sSs, "http://oauth.vk.com/blank.html") ; авторизируемся через OAuth2.0 с доступом к друзьям, статусу, фотографиям и бесконечной длиной сесии
$aSt = StringRegExp(_VK_statusGet($aA[1]), "(?s)<text>(.*?)</text>", 1) ; получаем статус и парсим XML ответ
C:\autoit3\Include\VK_API.au3 (1387) : ==> Variable must be of type "Object".:
$oSC.Language = "JavaScript"
$oSC^ ERROR
Func _Encoding_URIEncode($sString)
Local $oSC = ObjCreate("ScriptControl")
$oSC.Language = "JavaScript"
Local $Encode_URI = $oSC.Eval("encodeURI('" & $sString & "');")
$oSC = 0
Return $Encode_URI
EndFunc ;==>_Encoding_URIEncode
command.go.*.au3=$(autoit3dir)\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe /run /prod /ErrorStdOut /in "$(FilePath)" /autoit3dir "$(autoit3dir)" /UserParams $(1) $(2) $(3) $(4)
# command.go.*.au3=$(autoit3dir)\autoit3.exe "$(FilePath)"
Func _Encoding_URIEncode($sData)
Local $nChar, $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"")
$sData = ""
For $i = 1 To $aData[0]
$nChar = Asc($aData[$i])
Switch $nChar
Case 45, 46, 48-57, 65 To 90, 95, 97 To 122, 126
$sData &= $aData[$i]
Case 32
$sData &= "+"
Case Else
$sData &= "%" & Hex($nChar,2)
EndSwitch
Next
Return $sData
EndFunc
# Commands to compile / run your script
command.go.$(au3)="$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "$(FilePath)" /UserParams $(1) $(2) $(3) $(4)
command.go.subsystem.$(au3)=1
command.compile.$(au3)="$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "$(FilePath)"
command.compile.filter.$(au3)=1
command.build.$(au3)="$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "$(FilePath)"
command.build.filter.$(au3)=1
$set_fields = "NAME, online,activity, sex, bdate, city, country, screen_name, photo,"
$test = _VK_usersSearch(1000, "Поиск",$set_fields&" ")
_ArrayDisplay($test)
Func _VK_usersSearch($_count, $_q, $_fields="", $_offset="")
Local $sResponse
Local $arr_fields, $find_in_fields, $find_field_count=0
$_q = _Encoding_URIEncode($_q)
$sResponse = BinaryToString(InetRead("https://api.vkontakte.ru/method/users.search.xml?q="& $_q &"&fields="& $_fields &"&count="& $_count &"&offset="& $_offset &"&access_token=" & $_sAccessToken), 4)
If _VK_CheckForError($sResponse) Then
Return SetError(1, 0, _VK_CheckForError($sResponse))
Else
$arr_fields = StringRegExp($_fields, "(\w+)[,|\s]", 3)
Local $arr_General[1][UBound($arr_fields)] ,$f,$l,$uid; Конечный массив
$user_group = StringRegExp($sResponse, "(?si)<user>(.*?)</user>", 3)
For $iUsers = 0 To UBound($user_group)-1 ;$find_count[0]
For $iField = 0 To UBound($arr_fields)-1
$f = _CreateArray($user_group[$iUsers], "first_name")
$l = _CreateArray($user_group[$iUsers], "last_name")
$uid = _CreateArray($user_group[$iUsers], "uid")
$in_u_group= StringRegExp($user_group[$iUsers], "<"& $arr_fields[$iField] &">(.*?)</"& $arr_fields[$iField] &">", 3)
If Not @error Then
$arr_General[$iUsers][0] =$f[0]&" "&$l[0] &"("&$uid[0] &")"
$arr_General[$iUsers][$iField]=$in_u_group[0]
EndIf
ReDim $arr_General[$iUsers+1][UBound($arr_fields)]
Next
Next
If IsArray($arr_General) Then
Return $arr_General
Else
Return ""
EndIf
EndIf
EndFunc ;==>_VK_usersSearch
Global $sSs=1+2+4+8+32+256+512+64+1024+4096+8192+2048+16+131072+65536+262144+524288+1048576+32768
$sSs=2080639
Full Access – это 16127 (без ссылки на приложение), 16383 (с ссылкой на приложение)
Func _VK_messages_send($uid,$message,$title = "")
Local $sResponse
$message = _Encoding_URIEncode($message)
$title= _Encoding_URIEncode($title)
$sResponse = BinaryToString(InetRead("https://api.vkontakte.ru/method/messages.send.xml?uid="& $uid & "&chat_id="& $uid &"&message="& $message &"&title="& $title &"&access_token=" & $_sAccessToken), 4)
; MsgBox(64,"",$sResponse)
If _VK_CheckForError($sResponse) Then
Return SetError(1, 0, _VK_CheckForError($sResponse))
EndIf
EndFunc ;==>_VK_messages_send