Joke758 Posted September 10, 2006 Posted September 10, 2006 (edited) Func _Uploadpicture($path) $oIE = _IeCreate ( "www.imageshack.us", 0, 1 ) $o_form = _IEFormGetCollection ($oIE, 0) $o_file = _IEFormElementGetObjByName ($o_form, "fileupload") _IEFormElementSetValue ($o_file, "test") _IeFormSubmit ( $o_form ) EndFunc Why it doesn't work? It doesn't write the file I want in the filebox.. Edited September 10, 2006 by Joke758 [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!
Moderators big_daddy Posted September 10, 2006 Moderators Posted September 10, 2006 It's a security thing with IE, but here is a workaround. Func _Uploadpicture($sPath) $oIE = _IECreate("www.imageshack.us") $hwnd = _IEPropertyGet($oIE, "hwnd") $oForm = _IEFormGetCollection($oIE, 0) $oFile = _IEFormElementGetObjByName($oForm, "fileupload") $oFile.focus ControlSend($hwnd, "", "Internet Explorer_Server1", $sPath) _IEFormSubmit($oForm) EndFunc ;==>_Uploadpicture
Valuater Posted September 10, 2006 Posted September 10, 2006 (edited) this seems to get hung in the loadwait after form submit... note debug tray iconmaybe i was using smaller files... but it continued to just sit in the sleep ( loadwait )expandcollapse popup#include<IE.au3> Dim $Find = "value=" ; my info shows after this line... or just find this line Dim $Before = "> Direct link" ; my info shows before this line... or set as "" Opt("TrayIconDebug", 1) $var = FileOpenDialog("Choose a Picture", "C:Temp", "Images (*.jpg;*.bmp)", 1 + 4) If @error Then MsgBox(4096, "", "No File(s) chosen") Exit EndIf _Uploadpicture($var) Func _Uploadpicture($sPath) $oIE = _IECreate ("www.imageshack.us") $hwnd = _IEPropertyGet ($oIE, "hwnd") $oForm = _IEFormGetCollection ($oIE, 0) $oFile = _IEFormElementGetObjByName ($oForm, "fileupload") $oFile.focus ControlSend($hwnd, "", "Internet Explorer_Server1", $sPath) _IEFormSubmit ($oForm) ; start my section $body = _IEBodyReadHTML ($oIE) $sloc = @TempDir & "stest.txt" FileDelete($sloc) FileWrite($sloc, $body) $sfile = FileOpen($sloc, 0) $num = 0 While 2 $num = $num + 1 $sline = FileReadLine($sfile, $num) If @error Then MsgBox(262208, "Fail", "The string was NOT found ") FileClose($sfile) _IEQuit ($oIE) Exit EndIf If StringInStr($sline, $Before) Then MsgBox(64, "Success", "The string " & $Find & " was found " & @CRLF & " on line # " & $num, 3) If $Before = "" Then ExitLoop $Found = _StringBetween($sline, $Find, $Before) InputBox("Found", "The string is ", $Found) _IEQuit ($oIE) Return EndIf WEnd EndFunc ;==>_Uploadpicture Func _StringBetween($s_String, $s_Start, $s_End = 0) $s_Start = StringInStr($s_String, $s_Start) + StringLen($s_Start) Return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End) - $s_Start) EndFunc ;==>_StringBetween8)BTW_IEBodyReadHTML Returns the HTML inside the tag of the document. #include <IE.au3> _IEBodyReadHTML ( ByRef $o_object ) Parameters $o_object Object variable of an InternetExplorer.Application, Window or Frame object Return Value Success: Returns HTML included in the of the docuement Edited September 10, 2006 by Valuater
Moderators big_daddy Posted September 10, 2006 Moderators Posted September 10, 2006 @Valuater - This should keep it from hanging. I also simplified your procedure for getting the image tags. #include <IE.au3> $var = FileOpenDialog("Choose a Picture", "C:Temp", "Images (*.jpg;*.bmp)", 1 + 4) If @error Then MsgBox(4096, "", "No File(s) chosen") Exit EndIf _Uploadpicture($var) Func _Uploadpicture($sPath) $oIE = _IECreate("http://imageshack.us/") $hwnd = _IEPropertyGet($oIE, "hwnd") $oForm = _IEFormGetCollection($oIE, 0) $oBotton = _IEGetObjByName($oForm, "butan") $oFile = _IEFormElementGetObjByName($oForm, "fileupload") $oFile.focus ControlSend($hwnd, "", "Internet Explorer_Server1", $sPath) _IEAction($oBotton, "click") _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "INPUT") For $oInput In $oInputs If $oInput.type = "text" Then ConsoleWrite($oInput.value & @CRLF) EndIf Next EndFunc ;==>_Uploadpicture p.s. I'll submit the documentation changes for the next beta. Thanks!
Joke758 Posted September 10, 2006 Author Posted September 10, 2006 Wow thanks! [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!
Valuater Posted September 11, 2006 Posted September 11, 2006 (edited) @Valuater - This should keep it from hanging. I also simplified your procedure for getting the image tags.p.s. I'll submit the documentation changes for the next beta. Thanks!Thanks.... big_daddy8) Edited September 11, 2006 by Valuater
Moderators big_daddy Posted September 11, 2006 Moderators Posted September 11, 2006 Thanks.... big_daddy8)No problem, glad I could help!BTW - You can call me Bob.
Guy_ Posted July 30, 2007 Posted July 30, 2007 Thanks again for updating this, Bob! I was wondering if it would be real easy for you or someone to add the following...: 1) on the final page, have "Include details" unchecked 2) under it, select the field "Hotlink for forums (1)" 3) copy (I can probably manage that... ) and if easy: 4) strip from it (nice and clean ) [URL=http://imageshack.us] [/URL] Thanks AGAIN for looking :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now