Global Const $vk_main_url = "http://vk.com/"
Global Const $api_method_url = "http://api.vk.com/method/"
Global $sFile1 = @ScriptDir & "\1.txt"
Global $sFile2 = @ScriptDir & "\2.txt"
Global $hFile1, $hFile2, $sLine, $sResponse
Global $oSC, $result, $sName, $sDescription, $sCity, $sCityName, $sMembers_count, $sScreen_name, $sIs_closed, $sIs_closedStatus, $sCan_post, $sCan_postStatus
$oSC = ObjCreate("ScriptControl")
If Not IsObj($oSC) Then Exit
$oSC.Language = "JavaScript"
$hFile1 = FileOpen($sFile1, 0)
If @error Or $hFile1 = -1 Then Exit
$hFile2 = FileOpen($sFile2, 2)
If @error Or $hFile2 = -1 Then Exit
While 1
$sLine = FileReadLine($hFile1)
If @error Then ExitLoop
$sLine = StringStripWS($sLine, 8)
If $sLine == "" Then ContinueLoop
$sResponse = BinaryToString(InetRead($api_method_url & "groups.getById?gid=" & $sLine & "&fields=members_count,description,city,can_post"), 4)
ConsoleWrite($sResponse & @CRLF & "----------" & @CRLF)
If StringInStr($sResponse, "error") > 0 Then ContinueLoop
$result = $oSC.Eval("(" & $sResponse & ").response[0]")
If Not IsObj($result) Then ContinueLoop
$sName = $result.name
$sDescription = $result.description
$sDescription = StringReplace($sDescription, "
", @CRLF)
$sCity = $result.city
$sIs_closed = $result.is_closed
If $sIs_closed = 0 Then
$sIs_closedStatus = "открыта для участников"
Else
$sIs_closedStatus = "закрыта для участников"
EndIf
$sCan_post = $result.can_post
If $sCan_post = 0 Then
$sCan_postStatus = "открыта для постов"
Else
$sCan_postStatus = "закрыта для постов"
EndIf
$sScreen_name = $result.screen_name
$sMembers_count = $result.members_count
$sResponse = BinaryToString(InetRead($api_method_url & "places.getCityById?cids=" & $sCity), 4)
ConsoleWrite($sResponse & @CRLF)
$result = $oSC.Eval("(" & $sResponse & ").response[0]")
If Not IsObj($result) Then ContinueLoop
$sCityName = $result.name
$sFullInfo = StringFormat("*Название группы*: %s\r\n *описание*: %s\r\n *город*: %s\r\n *количество подписчиков*: %s\r\n *ссылка на группу*: %s\r\n *статус*: %s / %s", $sName, $sDescription, $sCityName, $sMembers_count, $vk_main_url & $sScreen_name, $sIs_closedStatus, $sCan_postStatus)
ConsoleWrite($sFullInfo & @CRLF & "----------" & @CRLF)
FileWriteLine($hFile2, $sFullInfo & @CRLF & "----------")
Sleep(100)
WEnd
FileClose($hFile1)
FileClose($hFile2)