Guy_ Posted February 18, 2007 Share Posted February 18, 2007 (edited) XP SP2, AutoIT 3.2.2.0 (problem occured in a previous version as well)If I run this script with F5 from the SciTE editor and no c:\upload to img host\curves.gif exists, it's showing the alert box, as it should.If I compile it, executing it (and no .gif present) will crash it. Runs fine if .gif exists.The script is:expandcollapse popup; script for uploading to img host with IE ; - uploads a picture to ImageShack ; - in this case, intention is to call the compiled version of this script from an action in Photoshop ; and have your current document automatically saved to c:\upload to img host\curves.gif and uploaded ; ; Heart of script by "big_daddy" in www.autoitscript.com/forum ; http://quadryders.com/phpcc/snippet.php?sid=79 #include <IE.au3> ; define path to image to upload $var = "c:\upload to img host\curves.gif" ; check if c:\upload to img host\curves.gif exists. If not, alert and exit. If Not FileExists ("c:\upload to img host\curves.gif") Then MsgBox ( 0, "Oops...", "It seems there is no curves.gif to upload." & @CRLF & "" & @CRLF & "Check if your PS action is saving one to" & @CRLF & "c:\upload to img host\", 20 ) Exit EndIf ; call upload function _Uploadpicture($var) TrayTip ( "Uploading?", "If something is going wrong or I don't close myself shortly after finishing the upload, right-click exit me first.", 12, 1 ) ; copy/rename file just sent and delete original, so your Photoshop action won't ask for "Replace file?" next time FileCopy("c:\upload to img host\curves.gif", "c:\upload to img host\previously uploaded curves.gif", 1) FileDelete("c:\upload to img host\curves.gif") ; FUNCTIONS - - - - - - - - - - Func _Uploadpicture($sPath) $oIE = _IECreate("http://imageshack.us/") $hwnd = _IEPropertyGet($oIE, "hwnd") $oForm = _IEFormGetCollection($oIE, 0) $oBotton = _IEGetObjByName($oForm, "butan") $oFile = _IEFormElementGetObjByName($oForm, "fileupload") ; check 'upload: file' radio button $oFile.focus ControlSend($hwnd, "", "Internet Explorer_Server1", $sPath) ; type path to image _IEAction($oBotton, "click") ; click 'host it' button _IELoadWait($oIE, 500) EndFunc Edited February 18, 2007 by Guy_ Link to comment Share on other sites More sharing options...
Shevilie Posted February 18, 2007 Share Posted February 18, 2007 Well I made some changes and dont get your error expandcollapse popup; script for uploading to img host with IE ; - uploads a picture to ImageShack ; - in this case, intention is to call the compiled version of this script from an action in Photoshop ; and have your current document automatically saved to c:\upload to img host\curves.gif and uploaded ; ; Heart of script by "big_daddy" in www.autoitscript.com/forum ; http://quadryders.com/phpcc/snippet.php?sid=79 #include <IE.au3> ; define path to image to upload $path = "c:\test\" $pathdone = "c:\test\done\" $filename = "curves.gif" ; check if c:\upload to img host\curves.gif exists. If not, alert and exit. If Not FileExists ($path & $filename) Then MsgBox ( 0, "Oops...", "It seems there is no curves.gif to upload." & @CRLF & "" & @CRLF & "Check if your PS action is saving one to" & @CRLF & $path, 20 ) Exit EndIf ; call upload function _Uploadpicture($path & $filename) ; copy/rename file just sent and delete original, so your Photoshop action won't ask for "Replace file?" next time FileCopy($path & $filename, $pathdone & $filename, 1) FileDelete($path & $filename) ; FUNCTIONS - - - - - - - - - - Func _Uploadpicture($sPath) TrayTip ( "Uploading?", "If something is going wrong or I don't close myself shortly after finishing the upload, right-click exit me first.", 12, 1 ) $oIE = _IECreate("http://imageshack.us/") $hwnd = _IEPropertyGet($oIE, "hwnd") $oForm = _IEFormGetCollection($oIE, 0) $oBotton = _IEGetObjByName($oForm, "butan") $oFile = _IEFormElementGetObjByName($oForm, "fileupload") ; check 'upload: file' radio button $oFile.focus ControlSend($hwnd, "", "Internet Explorer_Server1", $sPath) ; type path to image _IEAction($oBotton, "click") ; click 'host it' button _IELoadWait($oIE, 500) EndFunc Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Guy_ Posted February 19, 2007 Author Share Posted February 19, 2007 Thank you for the effort! However, it's not working for me, but I found a solution... Originally, the exe was sitting in a folder in my Photoshop Scripts folder, which doesn't seem to work 100%. When I move the exe into the c:\upload to img host\ ( or your c:\test\ ), it does work. I should have mentioned that maybe, but I had no idea I was violating some rule or dealing with a quirk(?) Here's a Carlsberg anyway. Cheers Link to comment Share on other sites More sharing options...
Shevilie Posted February 19, 2007 Share Posted February 19, 2007 Sounds weird... Jeg ville nu heller ha en Tuborg Squash Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
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