boomingranny Posted August 4, 2007 Posted August 4, 2007 (edited) expandcollapse popup;**************************************************** ; Func FileBeamPut (local filename, byref statustext) ; Uploads the file to be hosted Filebeam.com ; Returns - download link (or 1 if error) ; by BoominGranny ; djbarnes@orcon.net.nz ; requires IE.au3 ;**************************************************** func FileBeamPut($FileName, byref $StatusText) local $i ;vertify file type $status = "Vertifying File Type..." for $i = stringlen($FileName) to 1 step -1 if stringmid($FileName,$i,1) = "." then;found file extention text start local $FileEXT = StringTrimLeft($FileName,$i) ExitLoop endif next switch $fileEXT case "exe", "zip", "rar", "gz", "tar", "tgz", "xls", "txt", "pdf", "doc", "ppt", "wmv","avi","mp3","mpg","mpeg","mov","7z","png","gif","jpg","jpeg" case Else return 1 EndSwitch $status = "IE: Browsing to www.filebeam.com..." local $IEo = _IECreate("http://www.filebeam.com",0,0,1,0) $status = "Identifying Upload File Input Box" local $FileInput = _IEGetObjByName($IEo,"upfile") if @error > 0 then _IEQuit ($IEo) return 1 endif $status = "Identifying Upload Button" local $Upload = _IEGetObjByName($IEo,"upload") if @error > 0 then _IEQuit ($IEo) return 1 endif $status = "Selecting File to Upload..." ;Select the file to upload! _IEAction($FileInput, "focus") if @error > 0 then _IEQuit ($IEo) return 1 endif $status = "Sending Text to IE Window" local $hIE = _IEPropertyGet($IEo, "hwnd") ControlSend($hIE, "", "Internet Explorer_Server1", $FileName) ;ControlSend("", "", $FileInput, "C:\myfile.txt") ;_IEFormElementSetValue ;_IEFormElementSetValue ( $FileInput, $FileName) $status = "Clicking Upload Button" ;Click on upload button _IEAction ($Upload, "click") $status = "Waiting For Upload..." ;wait for file to upload ;added - timeout is now 24 hours :) _IELoadWait($IEo,0,1000*60*60*24) $status = "Processing returned HTML..." ;read in the result local $sHTML = _IEBodyReadHTML ($IEo) local $locatepassedtext = StringInStr($sHTML,"To DOWNLOAD this file go here:") if $locatepassedtext = 0 then $locatepassedtext = StringInStr($sHTML,"To view this image go here:") if $locatepassedtext > 0 Then $sHTML = StringTrimLeft ($sHTML,$locatepassedtext) $locatepassedtext = StringInStr ($sHTML,"<a href="&chr(34)) if $locatepassedtext > 0 Then $sHTML = StringTrimLeft ($sHTML,$locatepassedtext + 8) $locatepassedtext = StringInStr ($sHTML,chr(34)&">") $sHTML = stringleft ($sHTML,$locatepassedtext-1) _IEQuit ($IEo) return $sHTML Else _IEQuit ($IEo) return 1 endif Else _IEQuit ($IEo) return 1 endif EndFunc example of usage: #include <IE.au3> ;upload If not FileExists ($cmdline[$cmdline[0]]) then;if there wasn't a file specified in the command line... $select = FileOpenDialog("Select a file to upload to Filebeam",@MyDocumentsDir,"All Files (*.*)",1) if @error then exit Else $select = $cmdline[$cmdline[0]] endif global $status = "" AdlibEnable("UpdateStatus",1000) $url = filebeamPut($select, $status) AdlibDisable() ToolTip("") if $url = 1 then;if it errored then msgbox (64,"Error","Error Uploading "&$url) Else InputBox ("Filebeam Link:", "Uploaded: "&$select& "Copy the Link to Clipboard?", $url,"", 400,140) if @ERROR then exit ClipPut ($url) endif exit func UpdateStatus () ToolTip ($status) EndFunc Enjoy edit - edited example of usage to include command line params edit2 - modified the timeout for upload from the autoit default (5min) to 24 hours - for those bigger files! edit3 - modified so it includes an update for a status text variable - so you can see what its doing edit4 - fixed so it will work when u upload pictures! Edited August 5, 2007 by boomingranny
microsoft Posted August 5, 2007 Posted August 5, 2007 Thanks >> Please Script code Uploader on www.mediafire.com
BananaFredSoft Posted August 5, 2007 Posted August 5, 2007 Thanks >> Please Script code Uploader on www.mediafire.com Yes! That is exactly what I need! That would be great if you made a Mediafire uploaded, @boomingranny. -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat
boomingranny Posted August 5, 2007 Author Posted August 5, 2007 i will if i have time - but don't hold your breath. Im quite busy with my other projects... Just thought i would share the above with anyone else who needs it
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