Jump to content
DOSHI

Not able to select all images from a folder - (Moved)

Recommended Posts

Hello,

 

I am new to auto it. I am trying to select all the images from a folder. Below is my script however it is not working.

 

ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\Users\HP\Desktop\photos\")
Send("{ENTER}")
ControlGetHandle("Open","","DirectUIHWND")
Send("^a")
ControlClick("Open","","Button1")

 

Thanks and Regards,

Rupesh

Share this post


Link to post
Share on other sites

Moved to the appropriate forum.

Moderation Team


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
3 hours ago, DOSHI said:

I am trying to select all the images from a folder.

Could you describe in more detail what you want to achieve? There are probably better ways.

Here's a snippet to mark all the files in a directory - maybe it already helps you a bit.

Global $sPath = @DesktopDir & "\"  ; <== replace with "C:\Users\HP\Desktop\photos\"
Global $PID = ShellExecute(@WindowsDir & "\explorer.exe", "/n," & '"' & $sPath & '"')
If Not @error Then
    Sleep(1000)
    Send("^a")
EndIf
Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Share this post


Link to post
Share on other sites

Hello Musashi,

 

Many thanks for your feedback. It helped me a lot. Need some more help to achieve my task.

 

I am working on selenium with python 3.4.3. Actually I have some .jpg images in my folder kept at desktop. I want to transfer all file images to gmail photos album.

So I was thinking that post naming the album I will select all the images from my desktop folder and then click ok.

I am able to select one image at a time however was trying to select all the images and creating album at one go.

 

I hope you understand what I am trying to do. Let me know if you need more information.

 

Thanks and Regards,

Rupesh

 

Share this post


Link to post
Share on other sites

Try this :

Global $sPath = @DesktopDir & "\Photos"
Run(@WindowsDir & "\explorer.exe /n," & '"' & $sPath & '"')
If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error loading Explorer")
Sleep (1500)
Global $hWnd = WinGetHandle ("[CLASS:CabinetWClass]", $sPath)
If Not $hWnd Then Exit MsgBox ($MB_SYSTEMMODAL,"","Unable to find Explorer")
ControlClick ($hWnd, "", "[CLASSNN:DirectUIHWND1]")
ControlSend ($hWnd, "", "[CLASSNN:DirectUIHWND1]", "*.jpg")
Sleep (1500)
ControlClick ($hWnd, "", "[CLASSNN:DirectUIHWND3]")
Send ("^a")

 

Share this post


Link to post
Share on other sites

Hello Nine,

 

Many thanks for your feedback. It's very useful. Further I am stuck in below points

 

image.png.ac920da50b86c628c192ca146bf03d61.png

 

 

I want to click on the the class DirectUIHWN instance 2 as shown below to select 4 .jpg files as shown in above dialog box and then click open.

image.png.de52cb473fb55f7a6e3c8850e2315222.png

 

For this below script is not working

 

Global $sPath = @DesktopDir & "\Photos"
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\Users\HP\Desktop\photos\")
Global $hWnd = WinGetHandle ("[CLASS:CabinetWClass]", $sPath)
ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]")
ControlSend ($hWnd, "", "[CLASS:DirectUIHWND2]", "*.jpg")
Sleep (1500)
ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]")
send("^a")
ControlClick("Open","","Button1")


 

Please could you let me know where is the issue?

 

Thanks and Regards,

Rupesh

image.png

image.png

image.png

image.png

image.png

image.png

image.png

Share this post


Link to post
Share on other sites

Hello Nine,

 

Many thanks for your feedback. It's very useful. Further I am stuck in below points

 

image.png.ac920da50b86c628c192ca146bf03d61.png

 

 

I want to click on the the class DirectUIHWN instance 2 as shown below to select 4 .jpg files as shown in above dialog box and then click open.

image.png.de52cb473fb55f7a6e3c8850e2315222.png

 

For this below script is not working

 

Global $sPath = @DesktopDir & "\Photos"
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\Users\HP\Desktop\photos\")
Global $hWnd = WinGetHandle ("[CLASS:CabinetWClass]", $sPath)
ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]")
ControlSend ($hWnd, "", "[CLASS:DirectUIHWND2]", "*.jpg")
Sleep (1500)
ControlClick ($hWnd, "", "[CLASS:DirectUIHWND2]")
send("^a")
ControlClick("Open","","Button1")


 

Please could you let me know where is the issue?

 

Thanks and Regards,

Rupesh

Share this post


Link to post
Share on other sites

Hello,

 

The script is now working fine.  Thanks for looking into this so for..

 

Regards,

Rupesh

Share this post


Link to post
Share on other sites

Hello,

 

The script is now working fine.  Thanks for looking into this so for..

 

Regards,

Rupesh

Share this post


Link to post
Share on other sites

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

×
×
  • Create New...