Tratsch rund um Autoit / Autoit Talk | kleinere Fragen

04/03/2013 16:45 omer36#1036
versuchs mal so:

$oForm = _IEFormGetCollection($IE,0)
_IEFormElementRadioSelect ($oForm, "Male", "newgender", 1, "byValue")
04/03/2013 16:49 Kiinasu#1037
geht leider nicht. kommt zwar kein fehler, aber er selected nicht
04/03/2013 16:51 omer36#1038
schick mal den link zu der seite, ich schau mal ob ichs hinbekomme
04/03/2013 17:03 Kiinasu#1039
Hast ne pn

/edit: ok, hab einen workaround....
04/04/2013 19:47 Achat#1040
Quote:
Originally Posted by Achat View Post
Für alle, die die WinHttp.au3 benutzen:

Code:
[noparse]
Func _HtmlUnicodeDecodeAll($sString)
	Local Static $sHTML = BinaryToString(InetRead('http://de.selfhtml.org/html/referenz/zeichen.htm'))
	Local $aRegExp = StringRegExp($sHTML, '<td class="doctop"><span class="unicode">&.+;</span></td>\r\n' & _
			'<td class="tabxpl">.+</td>\r\n' & _
			'<td class="code"><code>&(\w+);</code></td>\r\n' & _
			'<td class="code"><code>&#(\d+);</code></td>', 3)
	If UBound($aRegExp) < 2 Or Mod(UBound($aRegExp), 2) <> 0 Then Return SetError(1, 0, 0)
	For $i = 0 To UBound($aRegExp) - 2 Step 2
		$sString = StringReplace($sString, '&' & $aRegExp[$i] & ';', ChrW($aRegExp[$i + 1]), 0, 1)
		$sString = StringReplace($sString, '&#' & $aRegExp[$i + 1] & ';', ChrW($aRegExp[$i + 1]), 0, 1)
	Next
	Return $sString
EndFunc   ;==>_HtmlUnicodeDecodeAll
[/noparse]
Ersetzt alle Sonderzeichen-Tags wie z.B. ÄÖaéèÈ durch das eigentliche Zeichen

Mehr dazu hier: [Only registered and activated users can see links. Click Here To Register...]

Download: [Only registered and activated users can see links. Click Here To Register...]

MfG
Es gibt leider auch so Seiten, bei denen die Kodierung (PHP, UTF-8) nicht stimmt, dazu einfach noch

Code:
	Local $aFix[2][7] = [['ä', 'ö', 'ü', 'Ä', 'Ã-', 'Ü', 'ß'],['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß']]
	For $i = 0 To UBound($aFix, 2) - 1
		$sString = StringReplace($sString, $aFix[0][$i], $aFix[1][$i], 0, 1)
	Next
verwenden.

MfG
04/04/2013 20:08 YatoDev#1041
hier mein code :
Code:
Func _click()
	$link = GUICtrlRead($input1)
	$anzahl = GUICtrlRead($Input2)
	Do
		$line = FileReadLine($file)
		RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "00000001")
		RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $line)
		Sleep(1000)
		$IE = _IECREATEEMBEDDED()
        $Bot = GUICreate("Form1", 800, 800);Erstellt eine neue GUI
        GUICtrlCreateObj($IE, 0, 0, 800, 800);Erstellt ein neues Objekt
        GUISetState(@SW_HIDE);Macht das fenster unsichtbar
		$Navi = _ienavigate($IE, $link)
		Sleep(7500)
		$HTML = _IEDocReadHTML($IE)
		FileWrite("quell.txt",$HTML)
		Sleep(1000)
		$i = $i + 1
		GUICtrlSetData($Label1,"Done : " &$i& "/" & $anzahl)
		$string = _StringBetween($HTML,'<font color="green">','</font>')
		MsgBox(1,"",$string[0])
	Until $i = $anzahl
EndFunc
so nun timeoutet der browser oft wegen defekten proxies und die func geht nicht weiter , was kann ich da machen bzw sieht jemand noch einen anderen fehler ?
04/04/2013 20:14 Achat#1042
Quote:
Originally Posted by »FlutterShy™ View Post
so nun timeoutet der browser oft wegen defekten proxies und die func geht nicht weiter , was kann ich da machen bzw sieht jemand noch einen anderen fehler ?
Vorher prüfen, ob der Proxy geht:
Code:
Func _ProxyIsUp($sProxyIP)
	Local $aIP = StringRegExp($sProxyIP, '(\d+\.\d+\.\d+\.\d+)', 3)
	If Not IsArray($aIP) Then Return SetError(1,0,False)
	Switch Ping($aIP[0], 520)
		Case 0
			Return False
		Case Else
			Return True
	EndSwitch
EndFunc   ;==>_ProxyIsUp
Wenn du den Systemproxy in der Registry änderst, benutzen andere Browser evtl. auch diesen Proxy!

€: Brauchst du Proxys? PM me ;)

MfG
04/04/2013 21:15 butter123#1043
moin,

ich will den facebook like button ansprechen
<input id="u_0_10" type="submit" data-profileid="157697300924538" value="Gefällt mir"></input>

nur type und value sind immer bei dem button gleich. id ändert sich. wie mach ich das dann?
04/04/2013 21:34 TheAldi#1044
Gibts eine umschließende <form> </form> ?
Wenn ja dann schick ein submit and die Form ;)
04/04/2013 21:45 Achat#1045
Quote:
Originally Posted by butter123 View Post
moin,

ich will den facebook like button ansprechen
<input id="u_0_10" type="submit" data-profileid="157697300924538" value="Gefällt mir"></input>

nur type und value sind immer bei dem button gleich. id ändert sich. wie mach ich das dann?
Code:
$aRegExp=StringRegExp($sHTML,'<input id="(.+?)" type="submit" data-profileid="\d+" value="Gefällt mir">',3)

Msgbox(0,0,$aRegExp[0]) ; ID

; MfG
04/07/2013 03:33 Achat#1046
Code:
For $i = 1 To 13
	$hTimer = TimerInit()
	ConsoleWrite(_EpvpImgTitle() & @TAB & Round(TimerDiff($hTimer)) & @CRLF)
Next

Func _EpvpImgTitle()
	TCPStartup()
	Local $iMainsocket = TCPConnect(TCPNameToIP('epvpimg.com'), 80)
	TCPSend($iMainsocket, 'GET / HTTP/1.1' & @CRLF & _
			'Host: epvpimg.com' & @CRLF & _
			'Connection: keep-alive' & @CRLF & @CRLF)
	Local $sRecv = ''
	Do
		$sRecv = TCPRecv($iMainsocket, 1)
	Until $sRecv <> ''
	Do
		$sRecv &= TCPRecv($iMainsocket, 1024)
	Until @error Or StringInStr($sRecv, '</title>')
	TCPCloseSocket($iMainsocket)
	TCPShutdown()
	Return StringReplace(StringRegExpReplace($sRecv, '(?s)(?:.*<title>epvpImg: (.+?)</title>.*)', '\1'),'<','<')
EndFunc   ;==>_EpvpImgTitle
Ist es egal ob ich TCPRecv($iMainsocket, 1024) oder z.B. TCPRecv($iMainsocket, 1) oder TCPRecv($iMainsocket, 1024000000) schreibe? Hat das Auswirkungen auf die Ladezeit? (mehrere Durchläufe der Schleife).

MfG
Ich möchte den Traffic so gering wie möglich halten.
04/07/2013 18:33 Croco™#1047
Ich denke nicht da es ja nicht wartet bis die anzahl durch ist sondern abricht falls dir empfangenen Daten mehr sind als angebene.
04/08/2013 15:12 YatoDev#1048
Code:
#RequireAdmin

Global $i = 0
Global $file = "proxies.txt"
Global $timeoutset = 0
Global $error = FileRead("quell.txt")
Global $false = FileRead("false.txt")
Global $read = 0
Global $stop = False
Global $true = True
Global $set = "set"

HotKeySet("{ESC}","_end")
HotKeySet("{F10}","_stopper")

#include <string.au3>
#include <ie.au3>
#include <file.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("lala", 339, 119, 192, 124)
$Input1 = GUICtrlCreateInput("www.myip.is/", 24, 24, 177, 21)
$Input2 = GUICtrlCreateInput("drück count proxies", 24, 48, 177, 21)
$Group1 = GUICtrlCreateGroup("Settings", 8, 8, 201, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Start !", 216, 16, 115, 25)
$Button2 = GUICtrlCreateButton("Count Proxies", 216, 48, 115, 25)
$Label1 = GUICtrlCreateLabel("Done : 0/0", 16, 88, 188, 17)
$Label2 = GUICtrlCreateLabel("Proxies :", 216, 88, 116, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			_end()
		Case $Button1
			_start()
		Case $Button2
			_count()

	EndSwitch
WEnd

Func _start()
	$anzahl = GUICtrlRead($Input2)
	Global $IE = _IECreateEmbedded()
	Global $BOT = GUICreate("Form1", 800, 800)
	While 1
	_setproxy()
	;_openie()
	;_delproxy()
	If $i = $anzahl Then
		ExitLoop
	EndIf
	WEnd
EndFunc

Func _setproxy()
	$read = $read + 1
	Global $line = FileReadLine($file,$read)
	If _ProxyIsUp($line) Then
	RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "00000001")
	RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $line)
	ConsoleWrite("proxy online " & $line)
	Sleep(100)
	_openie()
	Else
	ConsoleWrite("proxy offline " & $line)
	EndIf
EndFunc

Func _openie()
	$link = GUICtrlRead($Input1)
	$anzahl = GUICtrlRead($Input2)
	$session = GUICtrlCreateObj($IE, 0, 0, 800, 800)
	GUISetState(@SW_SHOW)
	$Navi = _IENavigate($IE, $link,0)
	$wait = _IELoadWait($IE,0,30000)
	Sleep(8000)
	$i = $i + 1
	GUICtrlSetData($Label1,"Done : " &$i& "/" & $anzahl)
	ConsoleWrite("True "&$line&@CRLF)
	;_delproxy()
	If $i = $anzahl Then
		_sleeper()
	EndIf
	ConsoleWrite("IE Quit " & $line)
	_IEQuit($session)
EndFunc

Func _delproxy()
	RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "00000000")
	RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "")
EndFunc

Func _count()
	$lines = _FileCountLines($file)
	GUICtrlSetData($Label2,"Proxies : "&$Lines)
	GUICtrlSetData($Input2,$lines)
EndFunc

Func _end()
	;RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "00000000")
	;RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "")
	FileClose($file)
	Exit
EndFunc

Func _ProxyIsUp($sProxyIP)
	Local $aIP = StringRegExp($sProxyIP, '(\d+\.\d+\.\d+\.\d+)', 3)
	If Not IsArray($aIP) Then Return SetError(1,0,False)
	Switch Ping($aIP[0], 520)
		Case 0
			Return False
		Case Else
			Return True
	EndSwitch
EndFunc   ;==>_ProxyIsUp

Func _stopper()
	Global $stop = True
EndFunc

Func _sleeper()
	While 1
		sleep(100)
		If $stop = True Then
			ExitLoop
		EndIf
	WEnd
EndFunc
so nachdem mein ie bot jetzt funktioniert ist mir aufgefallen das die proxy funktion nicht geht . mir fällt grade nicht auf was falsch ist . könnt ihr vielleicht mal drüberschauen ?
Und wenn ich die func :
Code:
Func _start()
	$anzahl = GUICtrlRead($Input2)
	Global $IE = _IECreateEmbedded()
	Global $BOT = GUICreate("Form1", 800, 800)
	While 1
	_setproxy()
	_openie()
	_delproxy()
	If $i = $anzahl Then
		ExitLoop
	EndIf
	WEnd
EndFunc
so abrufe wird meisten :o kein proxy gesetz und bei der variante oben timeouts
04/08/2013 15:24 Cyddra#1049
Huhu!
Ich möchte eine Schleife schreiben, in der drei Ziele (feste Position) die nacheinander auftauchen, angeklickt werden.
Ist da dieses Pixelsearch am besten geeignet?

Grüße
Cyddra
04/08/2013 15:27 Achat#1050
Quote:
Originally Posted by Cyddra View Post
Huhu!
Ich möchte eine Schleife schreiben, in der drei Ziele (feste Position) die nacheinander auftauchen, angeklickt werden.
Ist da dieses Pixelsearch am besten geeignet?

Grüße
Cyddra
Hi, schön das du den Sticky Thread benutzt hast!

PixelSearch brauchst du bei festen Positionen nicht.

[Only registered and activated users can see links. Click Here To Register...]

Wie sehen deine Ziele denn aus? Bzw in welchem Kontext stehen die? Spiel? Browser? GUI etc?

€: Die Koordinaten bekommst du damit: [Only registered and activated users can see links. Click Here To Register...], im Register "Mouse" .

MfG