Ich habe vor ein paar Tagen ein Backup gefunden, das ch im Zuge meiner Box.net API (leider verschollen) angelegt hatte. Vielleicht bringt dir das ein üpaar Ansätze.
Beiträge von i2c
-
-
Wenn in der Textdatei nichts anderes steht, als die Namen...
[autoit]$sPath = '"Hans" "Martin" "Fritz"'
[/autoit]
$aResult = StringRegExp($sPath, '"(.*?)"', 3, 1)
For $element In $aResult
ConsoleWrite($element & @LF)
Next -
- Ein markierter Abschnitt oder die gesammte Datei wird per POST an apaste.square7.ch verschickt und der Link geholt.
- Die aktuellen Einstellungen zu Syntax und Ablaufdatum werden in einer .ini abgelegt und beim nächsten Skriptaufruf wieder geladen.
- Starten per Tool-Menü oder Ctrl+Shift+Alt+A.
[Blockierte Grafik: http://www.abload.de/img/unbenanntyfucz.png]
"in \AutoIt3\SciTE\aPaste\apaste.au3 speichern"
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#region include
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <String.au3>
#endregion includeOpt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]
Opt("GUIResizeMode", 544)
#region
Global $oReceived, $sLink
Global $settings = @ScriptDir & "\settings.ini"
Global $aSyntax[158][2] = [["autoit", "AutoIt"], _
["bash", "BASH"], _
["c", "C"], _
["cpp", "C++"], _
["css", "CSS"], _
["html4strict", "HTML 4.01 strict"], _
["java", "Java"], _
["javascript", "JavaScript"], _
["mirc", "mIRC"], _
["perl", "Perl"], _
["php", "PHP"], _
["text", "Plain text"], _
["python", "Python"], _
["rails", "Ruby on Rails"], _
["ruby", "Ruby"], _
["sql", "SQL"], _
["tcl", "TCL"], _
["whois", "WHOIS (RPSL format)"], _
["xml", "XML"], _
["xorg_conf", "xorg.conf"], _
["text", "Plain Text"], _
["abap", "ABAP"], _
["actionscript", "ActionScript"], _
["actionscript3", "ActionScript 3"], _
["ada", "Ada"], _
["apache", "Apache"], _
["applescript", "AppleScript"], _
["apt_sources", "Apt sources.list"], _
["asm", "ASM"], _
["asp", "ASP"], _
["autoit", "AutoIt"], _
["avisynth", "AviSynth"], _
["bash", "BASH"], _
["basic4gl", "Basic4GL"], _
["bf", "Brainfuck"], _
["bibtex", "BibTeX"], _
["blitzbasic", "BlitzBasic"], _
["bnf", "BNF"], _
["boo", "Boo"], _
["c", "C"], _
["c_mac", "C for Macs"], _
["caddcl", "CADDCL"], _
["cadlisp", "CADLisp"], _
["cfdg", "CFDG"], _
["cfm", "ColdFusion"], _
["cil", "CIL"], _
["cmake", "CMake"], _
["cobol", "COBOL"], _
["cpp-qt", "C++ (with QT extensions)"], _
["cpp", "C++"], _
["csharp", "C#"], _
["css", "CSS"], _
["d", "D"], _
["dcs", "DCS"], _
["delphi", "Delphi"], _
["diff", "Diff-output"], _
["div", "DIV"], _
["dos", "DOS"], _
["dot", "dot"], _
["eiffel", "Eiffel"], _
["email", "E-mail (mbox\eml\RFC format)"], _
["erlang", "Erlang"], _
["fo", "FO"], _
["fortran", "Fortran"], _
["freebasic", "FreeBasic"], _
["genero", "Genero"], _
["gettext", "GNU Gettext .po/.pot"], _
["glsl", "glSlang"], _
["gml", "GML"], _
["gnuplot", "GNUPlot"], _
["groovy", "Groovy"], _
["haskell", "Haskell"], _
["hq9plus", "HQ9+"], _
["html4strict", "HTML 4.01 strict"], _
["idl", "Unoidl"], _
["ini", "INI"], _
["inno", "Inno Script"], _
["intercal", "INTERCAL"], _
["io", "IO"], _
["java", "Java"], _
["java5", "Java 5"], _
["javascript", "JavaScript"], _
["kixtart", "KiXtart"], _
["klonec", "KLone with C"], _
["klonecpp", "KLone with C++"], _
["latex", "LaTeX"], _
["lisp", "Generic Lisp"], _
["locobasic", "Locomotive Basic"], _
["lolcode", "LOLcode"], _
["lotusformulas", "@Formula/@Command"], _
["lotusscript", "LotusScript"], _
["lscript", "Lightwave Script"], _
["lsl2", "Linden Script"], _
["lua", "LUA"], _
["m68k", "Motorola 68000 Assembler"], _
["make", "GNU make"], _
["matlab", "Matlab"], _
["mirc", "mIRC"], _
["modula3", "Modula-3"], _
["mpasm", "Microchip Assembler"], _
["mxml", "MXML"], _
["mysql", "MySQL"], _
["nsis", "NSIS"], _
["oberon2", "Oberon-2"], _
["objc", "Objective-C"], _
["ocaml-brief", "Objective Caml"], _
["oobas", "OOo Basic"], _
["oracle11", "Oracle 11i"], _
["oracle8", "Oracle 8"], _
["pascal", "Pascal"], _
["per", "Per (forms)"], _
["perl", "Perl"], _
["php-brief", "PHP (Brief version)"], _
["php", "PHP"], _
["pic16", "PIC16 Assembler"], _
["pixelbender", "Pixel Bender"], _
["text", "Plain text"], _
["plsql", "Oracle 9.2 PL/SQL"], _
["povray", "Povray"], _
["powershell", "PowerShell"], _
["progress", "Progress"], _
["prolog", "Prolog"], _
["properties", "Property"], _
["providex", "ProvideX"], _
["python", "Python"], _
["qbasic", "QuickBASIC"], _
["rails", "Ruby on Rails"], _
["rebol", "Rebol"], _
["reg", "Microsoft REGEDIT"], _
["robots", "Robots.txt"], _
["ruby", "Ruby"], _
["sas", "SAS"], _
["scala", "Scala"], _
["scheme", "Scheme"], _
["scilab", "SciLab"], _
["sdlbasic", "sdlBasic"], _
["smalltalk", "Smalltalk"], _
["smarty", "Smarty"], _
["sql", "SQL"], _
["tcl", "TCL"], _
["teraterm", "Tera Term Macro"], _
["thinbasic", "thinBasic"], _
["tsql", "T-SQL"], _
["typoscript", "TypoScript"], _
["vb", "Visual Basic"], _
["vbnet", "Visual Basic .NET"], _
["verilog", "Verilog"], _
["vhdl", "VHDL"], _
["vim", "Vim"], _
["visualfoxpro", "Visual FoxPro"], _
["visualprolog", "Visual Prolog"], _
["whitespace", "Whitespace"], _
["whois", "WHOIS (RPSL format)"], _
["winbatch", "WinBatch"], _
["xml", "XML"], _
["xorg_conf", "xorg.conf"], _
["xpp", "Axapta/Dynamics Ax X++"], _
["z80", "ZiLOG Z80 Assembler"]]Global $aExpiration[3][2] = [["d", "1 Tag"], _
[/autoit] [autoit][/autoit] [autoit]
["m", "1 Monat"], _
["f", "Nie"]]
#endregion#region write/read .ini
[/autoit] [autoit][/autoit] [autoit]
If Not FileExists($settings) Then
IniWrite($settings, "main", "syntax", "autoit")
IniWrite($settings, "main", "expiration", "f")
EndIf
$syntax = _FindInArray($aSyntax, IniRead($settings, "main", "syntax", "autoit"), 1)
$expiration = _FindInArray($aExpiration, IniRead($settings, "main", "expiration", "f"), 1)
#endregion write/read .ini#region gui
[/autoit] [autoit][/autoit] [autoit]
$gui = GUICreate("Send To aPaste", 445, 145, -1, -1)GUICtrlCreateGroup("Send", 8, 8, 161, 130)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$rFile = GUICtrlCreateRadio("complete file", 24, 32, 113, 17)
$rSelected = GUICtrlCreateRadio("selected code", 24, 56, 113, 17)
$bSend = GUICtrlCreateButton("send", 50, 92, 75, 25, $WS_GROUP)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)GUICtrlCreateGroup("Settings", 176, 8, 262, 130)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Syntax highlighting:", 184, 36, 95, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$cSyntax = GUICtrlCreateCombo($syntax, 288, 32, 145, 25)
GUICtrlCreateLabel("Post expiration:", 184, 60, 76, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$cExpiration = GUICtrlCreateCombo($expiration, 288, 56, 145, 25)
GUICtrlCreateLabel("Name / Title: ", 184, 110, 83, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$iName = GUICtrlCreateInput("", 288, 104, 145, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#endregion gui#region events
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
GUICtrlSetOnEvent($bSend, "_send")
#endregion events
GUISetState()
#region set data
If $cmdline[0] < 1 Then
MsgBox(64, "Error", "missing parameter")
Exit
EndIf
If $cmdline[2] <> "" Then
GUICtrlSetState($rSelected, $Gui_CHECKED)
Else
GUICtrlSetState($rFile, $Gui_CHECKED)
GUICtrlSetState($rSelected, $GUI_DISABLE)
EndIf
For $i = 0 To UBound($aSyntax) - 1
GUICtrlSetData($cSyntax, $aSyntax[$i][1], $syntax)
Next
For $i = 0 To UBound($aExpiration) - 1
GUICtrlSetData($cExpiration, $aExpiration[$i][1], $expiration)
Next
#endregion set dataWhile 1
[/autoit] [autoit][/autoit] [autoit]
Sleep(100)
WEndFunc _FindInArray($array, $value, $switch)
[/autoit] [autoit][/autoit] [autoit]
$index = _ArraySearch($array, $value)
If $index = -1 Then Return -1If $switch = 0 Then
[/autoit] [autoit][/autoit] [autoit]
$result = $array[$index][0]
ElseIf $switch = 1 Then
$result = $array[$index][1]
Else
SetError(1, 0, False)
EndIf
Return $result
EndFunc ;==>_FindInArrayFunc _URIEncode($sData)
[/autoit] [autoit][/autoit] [autoit]
; Prog@ndy
Local $aData = StringSplit(BinaryToString(StringToBinary($sData, 4), 1), "")
Local $nChar
$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 ;==>_URIEncodeFunc _send()
[/autoit] [autoit][/autoit] [autoit]
Local $bPostAsGuest, $LoginKey
Local Static $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
GUISetState(@SW_DISABLE, $gui)
If BitAND(GUICtrlRead($rFile), $Gui_CHECKED) = $Gui_CHECKED Then
$open = FileOpen($cmdline[1], 0)
$paste_code = _URIEncode(FileRead($open))
FileClose($open)
ElseIf BitAND(GUICtrlRead($rSelected), $Gui_CHECKED) = $Gui_CHECKED Then
$paste_code = _URIEncode($cmdline[2])
EndIf
$paste_name = GUICtrlRead($iName)
$paste_expire_date = _FindInArray($aExpiration, GUICtrlRead($cExpiration), 0)
$paste_format = _FindInArray($aSyntax, GUICtrlRead($cSyntax), 0)
$paste_devkey = "52b07d8a33022af5c03f899c734818c8";Login
[/autoit] [autoit][/autoit] [autoit]
$oHTTP.Open("POST", "http://apaste.square7.ch/index.php", False)
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)")
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")$oHTTP.Send("?form=editor&paste=Submit&poster=" & $paste_name & "&format=" & $paste_format & "&expiry=" & $paste_expire_date & "&code2=" & $paste_code)
[/autoit] [autoit][/autoit] [autoit]$oReceived = $oHTTP.ResponseText
[/autoit] [autoit][/autoit] [autoit]
If $oReceived <> "" Then
$aResult = StringRegExp($oReceived, '<div id="topInfo"><h1>.*?<br/><a href="(.*?)" title="Download this paste">', 1, 1)
$sLink = StringReplace($aResult[0], "?dl=", "")
$gui2 = GUICreate("url", 258, 76, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
$Input = GUICtrlCreateInput($sLink, 8, 8, 241, 21)
$Button1 = GUICtrlCreateButton("copy to clipboard", 24, 40, 115, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_clipput")
$Button2 = GUICtrlCreateButton("open url", 152, 40, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_execute")
GUISetState(@SW_SHOW)
Else
MsgBox(64, "Error", "no response")
EndIf
EndFunc ;==>_sendFunc _execute()
[/autoit] [autoit][/autoit] [autoit]
ShellExecute($sLink)
EndFunc ;==>_executeFunc _clipput()
[/autoit] [autoit][/autoit] [autoit]
If ClipPut($sLink) Then
_exit()
Else
MsgBox(64, "Error", "unable to copy url to clipboard")
EndIf
EndFunc ;==>_clipputFunc _exit()
[/autoit] [autoit][/autoit] [autoit][/autoit]
If $cmdline[0] < 1 Then Return
IniWrite($settings, "main", "syntax", _FindInArray($aSyntax, GUICtrlRead($cSyntax), 0))
IniWrite($settings, "main", "expiration", _FindInArray($aExpiration, GUICtrlRead($cExpiration), 0))
Exit
EndFunc ;==>_exit -
GUIs lassen sich resizen

Allerdings wirst du das Problem mit der hochskalierten Schriftgrösse kaum in den Griff bekommen. Das ist aber kein AUtoIt spezifisches Problem. Ab einer bestimmten Skalierung wird nahezu jedes Programm unbenutzbar. -
Spoiler anzeigen
[autoit]$sPath = "sdsds dxe_a1 dfdfd dfdf dxe_w3434 dfdfdf dxe_sads3456"
[/autoit] [autoit][/autoit] [autoit]$aResult = StringRegExp($sPath, "(dxe_.*?\b)", 3, 1)
[/autoit]
For $element In $aResult
ConsoleWrite($element & @LF)
Next -
Keine AUffälligkeiten bei mir.
@error wird in jedem Fall korrekt ausgegeben. -
0.. steht doch da

Zeigst du uns mal ein Skript? Was pingst du an?
-
Ich hab's lieber schlicht auf dem Androiden
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. -
Sowas?
[autoit]
[/autoit][autoit][/autoit][autoit]
_message(1)
_message(2)
_message(3)Func _message($var)
[/autoit][autoit][/autoit][autoit]
Switch $var
Case 1
MsgBox(64, "", "blabla")
Case 2MsgBox(0, "", "tralala")
[/autoit]
Case 3
MsgBox(64, "", "usw.")
EndSwitch
EndFunc ;==>_message -
Norman Bates: ebay stellt eine APIzur Verfügung - http://pages.ebay.de/help/devprogra…m-benefits.html
-
Das Buch von Johannes - http://web.slzm.de/blog/latex/buch-iv/
Dann gibt's in unserem Tutorialforum einiges zu lesen.
Und den Rest lernt man dann by doing und durch fragen. Dafür gibt's ja dieses Forum

edit: Ein Blick in die Signaturen diverser PUs und Moderatoren schadet auch nicht. (z.B. in die von BugFIx)
-
Du siehst, das der Quellcode jetzt doch etwas anders aussieht?
[autoit]
Das hier müsste klappen:
[/autoit][autoit][/autoit][autoit]
$sSource = BinaryToString(InetRead("http://center.vodafone.de/vfcenter/verbrauch.html", 1), 4)$aResult = StringRegExp($sSource, "Abrechnungszeitraum\:\s(.*?GB)<br\/>", 1, 1)
[/autoit]
If IsArray($aResult) Then
MsgBox(0, "", $aResult[0])
Else
MsgBox(0, "", "Nichts gefunden!")
EndIf -
Ja, das ist der gesammte Quellcode. Wenn da keine persönlichen Daten auf der Seite stehen, könntest du uns den mal zeigen?
Und ja, wenn du diese Zeile auskommentierst
entferenn) dann findet er natürlich was. Denn dann sucht er nicht mehr im Quellcode der Seite sondern in dem String, der dann in $source steht ;). Das ist kein reales Ergebnis. Nur zum testen des pattern. -
Ok. Dann führ bitte mal das hier aus und poste uns die Rückgabe.
[autoit]
[/autoit]
$source =BinaryToString(InetRead("http://center.vodafone.de/vfcenter/verbrauch.html", 1), 4)
ConsoleWrite($source & @LF)
ClipPut($source)
Das, was dir das Skrpt in die Konsole schreibt, wird auch automatisch in deine Zwischenablage gelegt. -
Wie schon in der Shoutbox gesagt; anahnd deines Quellcodeausschnittes müsste dieses pattern funktionieren: "\:\s(.*?GB)<BR>"
Da wir ja keinen Zugriff auf die Seite haben - bitte mal ausführen und die Rückgabe posten.Spoiler anzeigen
[autoit]#include <inet.au3>
[/autoit]
$source = _INetGetSource("http://center.vodafone.de/vfcenter/verbrauch.html")
If StringLen($source) = 0 Then
MsgBox(0, "", "Kein Quellcode!!")
Else
;$source = "<DIV class=teaserHandsetContent><!-- National -->Nutzung im aktuellen Abrechnungszeitraum: 9,2 GB<BR>Highspeedvolumen : 30,0 GB<BR>Aktueller Abrechnungszeitraum 03.02. - 02.03.2013<BR></DIV></DIV></DIV><BR class=floatNone><BR class=floatNone></DIV></DIV>"
$VFhtml = StringRegExp($source, "\:\s(.*?GB)<BR>", 1, 1)
If IsArray($VFhtml) Then
MsgBox(0, "", $VFhtml[0])
Else
MsgBox(0, "", "Nichts gefunden!")
EndIf
EndIf -
Jetzt hast du es uns doch erzählt

-
Weil zuviel Wissen nie schadet

-
-
Nö. Du warst mal Bundeskanzler.
-
Immer wieder gern!
-
-
Das tut jedes Tablet, auf dem ein Windows läuft (nicht WIndows RT ;))