Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Аватара для Mike909

Новый участник


Сообщения: 38
Благодарности: 14

Профиль | Отправить PM | Цитировать


Вот попробуй такой вариант.
до 100 пробовал, норм.
Скрытый текст

PHP код: Выделить весь код

#include <IE.au3>


_IEErrorNotify(False)

Local $oExcel ObjGet("""Excel.Application")

If 
not IsObj($oExcelThen
      $oExcel 
ObjCreate('Excel.Application')
EndIf
Sleep(2000)

If 
IsObj($oExcelThen

$oExcel
.Visible True
$oExcel
.WorkBooks.Open(@ScriptDir '\links.xlsx')

Sleep(2000)
    
    For 
$i 1 to 15 Step 1
        
    
        
If not IsObj($oExcelThen
              ConsoleWrite 
('Excel not found')
              
ExitLoop
        
EndIf
        
        
ConsoleWrite $i ' ' $oExcel.Activesheet.Cells($i1).Value & @LF)
        
Local $boolIsRealPage False
        $link 
$oExcel.Activesheet.Cells($i1).Value        
        $sUrl
=$link        
        $oIE
=_IECreate($sUrl,1,0,1,0)
        ;
Sleep(200)        
        
$oLinks=_IETagNameGetCollection($oIE'a')    
            
        if 
IsObj($oLinksThen
            
;ConsoleWrite ('links=' $oLinks.Length & @LF)
            ;
Sleep(200)
            For 
$oTextArea In $oLinks
                    
                
If StringInStr(_IEPropertyGet($oTextArea'outerhtml'), 'Показать номер'Then
                  
                     _IEAction
($oTextArea'click')
                    
                     
Sleep(500)
                    
                     
$Var=$oTextArea.href
                     $oExcel
.Activesheet.Cells($i,2).Value=$Var
                     $boolIsRealPage 
True
                     ExitLoop
            
                
EndIf
            
            
Next
        
Else
           
ConsoleWrite ('links no obj' & @LF)            
        EndIf
    
        if 
$boolIsRealPage Then
            $tags 
$oIE.document.GetElementsByTagName("div")        
            if  
IsObj($tagsThen
                
;ConsoleWrite ('tags=' $tags.Length & @LF)
                ;
Sleep(200)
                For 
$tag in $tags
                   
                    $class_value 
$tag.className
            
                    
If $class_value "person-name" Then
                
                        $oExcel
.Activesheet.Cells($i,3).Value=_IEPropertyGet($tag'innertext')        
                        
ExitLoop
            
                    
EndIf
                
                
Next
            
Else
               
ConsoleWrite ('tags no obj' & @LF)
            EndIf
        Else
            
ConsoleWrite ('Bad page - no tel.' & @LF)
        EndIf
        
_IEQuit($oIE)
        
    
Next
    
Else

 
ConsoleWrite ("Excel is running." & @LF)
 
EndIf

ConsoleWrite ("Exit au3." & @LF


Отправлено: 22:44, 04-11-2015 | #9