Choose File To Upload Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jbearnolimits
Posts: 58
Joined: 09 Jul 2017, 23:44

Choose File To Upload

13 Aug 2017, 20:57

So, I've been playing around with COM a bit. Right now I have a webpage that has an upload now button. I can get autohotkey to click the button and then the window "Choose what file to upload" pops up.

My problem is that I am having a hard time figuring out how to switch to that pop up to enter information into the "file" form. I have the path to the files I want to upload, but when I use the send command to type it in nothing is being typed. I have it visible so if I just start typing it seems to already be in the file field and I can type it out, press enter, and then it uploads. But I can't seem to get past the pop up with autohotkey.

What do I need to do to enter info into the pop up?
jbearnolimits
Posts: 58
Joined: 09 Jul 2017, 23:44

Re: Choose File To Upload  Topic is solved

14 Aug 2017, 00:28

Ok, I actually solved the problem myself. In case anyone else has the same issue let me break it down. The script would just hang when the popup dialog box opened. Then it would run again after closing the box manually. So, I made a second script and told my first one to run the script just before clicking the button to bring up the box.

The second script would wait to run until "winactive, Choose file to upload" popped up. Then it would take over and work on that box. After hitting {enter} to finish my work in the box I added an exitapp to the second script so it would close. From that point the first script would take back over.
okl

Re: Choose File To Upload

19 Aug 2017, 11:35

yep, i followed your cue and after much tinkering, read this forum thread and got the idea.

https://autohotkey.com/board/topic/8566 ... es-active/


again, for the benefit of anyone who is reading- jbearnolimits is right... the "Choose File to Upload" window essentially stops the existing AHK script until the user manually inputs the file to upload either via actual keyboard strokes or mouse movements. I read somewhere that there might be some security built into it, but i cant rediscover the thread anymore as i closed the thread without noting it... so i dont know what's the workaround for that security.

anyway, the workaround is to have a 2nd AHK script running that activates as the "Choose File to Upload" window pops up; essentially, you combine the 2 following commands in AHK;
i) #persistent and settimer
ii) ifwinactive

#persistent essentially keeps running a prescribed script [in this case, if winactive] every X number of seconds.

in my own case, since i can only upload files one by one onto a server- my 2nd script as follows;

Code: Select all

#Persistent

SetTimer, test, 500
return

test:

IfWinExist, Choose File to Upload
{
    WinActivate  ; Automatically uses the window found above.
    WinMaximize  ; same
    Send, ^v .{Enter}
    return
}

cheers

do give a thumbs up if this thread was useful, cos it sure was for me =)
johnb123
Posts: 6
Joined: 19 Aug 2016, 09:07

Re: Choose File To Upload

13 Dec 2017, 17:36

This did not work for me. Does anyone have any other ideas on how to get this to work?
AndreiPv

Re: Choose File To Upload

26 Aug 2018, 10:41

Hi!

I'm triying to upload a file in "IE.visible= false" mode. This two scripts will pop up a Choose file window every time?

Sorry for my english... :crazy:

Thx and best regards

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, mikeyww, Spawnova and 366 guests