Jump to content

Recommended Posts

Posted

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
Posted

@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!

Posted

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.

Posted (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 by JLogan3o13
Posted (edited)

Well yes, I guess so :P 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 by Purity8
Posted (edited)

Sorry, double posted. Wasn't able to find the edit button before. I'm used to seeing edit around top of posts...

Edited by Purity8
Double posted, sorry
Posted (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 by Purity8
Posted

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.

Posted

@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.

Posted (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 by Purity8
Merged Posts
Posted (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 by Purity8
New Info

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...