Purity8 Posted April 16, 2020 Posted April 16, 2020 I've looked at many of the coding of AutoIt, but I wasn't able to find out if its able to grab an image. I would like to automate an advanced (mouse) clicker that not only automate clicks & keystrokes, but be able to drag-n-drop images into folder locations.
Moderators JLogan3o13 Posted April 16, 2020 Moderators Posted April 16, 2020 @Purity8 how about a more detailed explanation of what you are trying to accomplish? There is doubtlessly a better way to move files around that with an image search. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Purity8 Posted April 16, 2020 Author Posted April 16, 2020 I'm trying to automate a way of saving images with drag-n-drop method. Majority of the programs (like all those auto-mouse clickers) I've seen/used are mouse & keyboard based: Go to x, y co-ordinates > right-click image > (left click) save image as > keystroke {enter}. I mean, there's got be a better way. Even with add-ons/extensions, the basics are still the same.
Danp2 Posted April 16, 2020 Posted April 16, 2020 Still clear as mud. 😕 What application is the source of the images you want to save? Latest Webdriver UDF Release Webdriver Wiki FAQs
Purity8 Posted April 16, 2020 Author Posted April 16, 2020 (edited) No application. These images are from websites. It doesn't need to be a specific domain. Be warned, the website I'm about to link can be considered nsfw (now with all the people staying at home to work, hopefully there's no children around you) <snip> We are going to follow the forum rules and keep things clean. Edited April 16, 2020 by JLogan3o13
Danp2 Posted April 16, 2020 Posted April 16, 2020 A web browser is an application, right? 😁 Which browser are you wanting to automate? How do you decide which images to save? Do you want the script to grab a single image (beneath the mouse cursor, for example) or all images on the page? Latest Webdriver UDF Release Webdriver Wiki FAQs
Purity8 Posted April 16, 2020 Author Posted April 16, 2020 (edited) Well yes, I guess so Firefox is the application. From what I know, majority of these are jpg files. Hmm..I guess the main single image so, yeah, beneath the mouse would be good. All images isn't a good idea as the main feature image is maximize size while the rest are smaller versions of other galleries. Edited April 16, 2020 by Purity8
Purity8 Posted April 16, 2020 Author Posted April 16, 2020 (edited) Sorry, double posted. Wasn't able to find the edit button before. I'm used to seeing edit around top of posts... Edited April 16, 2020 by Purity8 Double posted, sorry
Danp2 Posted April 16, 2020 Posted April 16, 2020 You still haven't told us which browser. If you are using IE, then take a look at the built-in IE functions in the help file. Otherwise, you may want to take a look at FAQ 31 Latest Webdriver UDF Release Webdriver Wiki FAQs
Purity8 Posted April 16, 2020 Author Posted April 16, 2020 (edited) Sorry, I've re-edit my post to add it in. I'm using FireFox. Yeah, I've read that site. Maybe the previous ff.au3 was outdated. A few days ago, that link went to a dead site. Thank you 😊 Edited April 16, 2020 by Purity8
Danp2 Posted April 16, 2020 Posted April 16, 2020 Yeah... ff.au3 is dead AFAIK. You would have to use either IUIAutomation or the Webdriver UDF. Latest Webdriver UDF Release Webdriver Wiki FAQs
Purity8 Posted April 17, 2020 Author Posted April 17, 2020 Hm, many of the functions in WinHttp.au3 seem to be familiar to me. Are these c/c++ related?
Danp2 Posted April 17, 2020 Posted April 17, 2020 They are Windows API related. Latest Webdriver UDF Release Webdriver Wiki FAQs
Bert Posted April 17, 2020 Posted April 17, 2020 You could just save the entire web page then just delete everything you don't want. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Purity8 Posted April 17, 2020 Author Posted April 17, 2020 That's okay, I'm used to being old fashion & doing things manually. Do I really need everything there besides WebGriver (gecko)? Like the json? Like I mentioned, WinHttp functions reminds me much of coding c/c++ in visual studio.
Danp2 Posted April 17, 2020 Posted April 17, 2020 @Purity8 Here's a simple example function -- Func DownloadImageBelowMouse() Local $sElement, $sURL, $sNodeName $sElement = _WD_GetMouseElement($sSession) If $sElement = "" Then Return EndIf $sNodeName = _WD_ElementAction($sSession, $sElement, 'property', 'nodeName') If $sNodeName <> 'IMG' Then Return EndIf ; Get the website's URL $sURL = _WD_Action($sSession, 'url') $sSource = _WD_ElementAction($sSession, $sElement, "Attribute", "src") ; Combine the URL and element link $sURL = _WinAPI_UrlCombine($sURL, $sSource) ; Download the file _WD_DownloadFile($sURL, @ScriptDir & "\testimage.png") EndFunc You'll need to code the rest of the script where you launch the webdriver, setup the hotkey, etc. Latest Webdriver UDF Release Webdriver Wiki FAQs
Purity8 Posted April 17, 2020 Author Posted April 17, 2020 (edited) Okay, thank you. @Bert On 4/17/2020 at 9:12 AM, Bert said: You could just save the entire web page then just delete everything you don't want. On 4/16/2020 at 2:04 PM, Purity8 said: All images isn't a good idea as the main feature image is maximize size while the rest are smaller versions of other galleries edit: Is there a limit of how many different #include <*.au3> files I can reference? I remember using <studio.h> for programming C/C++. Edited April 18, 2020 by Purity8 Merged Posts
Purity8 Posted April 17, 2020 Author Posted April 17, 2020 (edited) This is what I'm come up with so far. It's probably incorrect but... Func _WD_Navigate($sSession, $sURL) If ProcessExists("Firefox.exe") Then MsgBox($MB_OK, "Info:", "You've already opened FireFox!" & @CRLF & "Proceed to url.") Else Return MsgBox($MB_SYSTEMMODAL, "Info:", "Please Open FireFox.") EndFunc Func DownloadImageBelowMouse() Local $sElement, $sURL, $sNodeName $sElement = _WD_GetMouseElement($sSession) If $sElement = "IMG" Then Return MsgBox($MB_OK, "Info:", "Yay, you've found an image!") EndIf $sNodeName = _WD_ElementAction($sSession, $sElement, "GET", "JPG") If $sNodeName <> 'IMG' Then Return MsgBox($MB_SYSTEMMODAL, "Info:" , "Is this an image type?") EndIf ; Get the website's URL $sURL = _WD_Action($sSession, 'http://m.54mn.cc/m/8964/1.html') $sSource = _WD_ElementAction($sSession, $sElement, "GET", "1.jpg") ; Combine the URL and element link $sURL = _WinAPI_UrlCombine($sURL, $sSource) ; Download the file _WD_DownloadFile($sURL, @ScriptDir & "\1.jpg") EndFunc Edited April 18, 2020 by Purity8 New Info
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