AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IE + ControlSendRaw

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
BoBo
Guest





PostPosted: Wed Nov 29, 2006 12:51 am    Post subject: IE + ControlSendRaw Reply with quote

Sending JavaScript Bookmarklets with ControlSend(Raw) to IE's adress field (Edit1) isn't working, while a plein Send works just fine (but its to slow Mad) Any idea/workarround ? An out of the box Send-/PostMessage (prefered Smile) I'm stuck. Confused
Back to top
ScottEdge



Joined: 14 Aug 2005
Posts: 57
Location: Connecticut,USA

PostPosted: Wed Nov 29, 2006 1:42 am    Post subject: Reply with quote

Code:

ie = Microsoft Internet Explorer
WinActivate %ie%
WinWaitActive, %ie%
StatusBarWait, Done, 60, , %ie%,
ControlSetText Edit1, javascript:with(document.forms[0]){elements[1].value="";elements[2].value="";void(0)}, %ie%
ControlSend Edit1, {Enter}, %ie%


This is how I do it. What is your code?

To make send faster I like to set the clipboard to what I want to paste in then send ^v. much faster then sending actual data.
Quote:

[update] fixed typo in code. sorry about that deleted my value and got the ending quote.


Last edited by ScottEdge on Thu Nov 30, 2006 3:22 am; edited 1 time in total
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Wed Nov 29, 2006 1:48 am    Post subject: Reply with quote

Code:
SetTitleMatchMode, 2
SetControlDelay, 100

WinActivate, Microsoft Internet Explorer
ControlFocus, Edit1, Microsoft Internet Explorer
ControlSendRaw, javascript:document.subscriberAddForm.FirstName.value="BoBo"; void(0);, Microsoft Internet Explorer
ControlSend, {Enter}
If entered manually it's working in 9/10 tries. ExclamationQuestion
Back to top
BoBo
Guest





PostPosted: Wed Nov 29, 2006 1:50 am    Post subject: Reply with quote

Shocked
Quote:
ControlSendRaw, Edit1, ...
Rolling Eyes
Back to top
BoBo
Guest





PostPosted: Wed Nov 29, 2006 2:59 am    Post subject: Reply with quote

I've made it!! 02:55 AM CET Shocked
Fixed, several JavaScript typos (spaces,quotation marks,.. Mad)
Replaced ControlSendRaw with ControlSetText (pushed the performance min. 5 times Very Happy)

Now I'm really really tired. Good night folx Cool *BoBo schnarsching*
Back to top
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Wed Nov 29, 2006 3:34 am    Post subject: Reply with quote

After reading this I thought this was the solution to my problem:
http://www.autohotkey.com/forum/viewtopic.php?t=14512&start=0&postdays=0&postorder=asc
..but after tinkering for a while with syntax, and simplified versions of my js command.... i still don't get it. Mine just doesn't want to work.
Back to top
View user's profile Send private message
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Wed Nov 29, 2006 6:54 am    Post subject: Reply with quote

SCottEdge wrote:
[code]
javascript:with(document.forms[0]){elements[1].value="";elements[2].value=";void(0)}, %ie%

I'm curious: shouldn't there be another quote (") near the end of that line:
javascript:with(document.forms[0]){elements[1].value="";elements[2].value="";void(0)}, %ie% [/quote]
...or am I not understanding something about that syntax?
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Wed Nov 29, 2006 1:09 pm    Post subject: Reply with quote

This is probably a typo.
Do your page has frames? This can wreak havoc.
To be sure, paste this in the address bar: javascript:alert(parent.frames.length);
If different of 0, you have frames to take in account.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Wed Nov 29, 2006 1:34 pm    Post subject: Reply with quote

PhiLho wrote:
This is probably a typo.
Do your page has frames? This can wreak havoc.
To be sure, paste this in the address bar: javascript:alert(parent.frames.length);
If different of 0, you have frames to take in account.


Yes, that code returns '13' ....so I guess i have 13 frames to navigate... gah!

AWESOME...i just figured it out.
You people are excellent...iv'e been pondering this for nearly 2 days, and now i can proceed with my funky script...many thanks.

BTW, the correct answer was:
javascript:top.logframe.document.dailyreportdetailform.elements[39].value="BETLOG";void(0);
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Wed Nov 29, 2006 2:50 pm    Post subject: Reply with quote

Good, you figured out the remainder. For those searching, here is a way to have a list of the frames:
javascript:fr = parent.frames; for (var i = 0, l = ''; i < fr.length; i++) { l += fr[i].name + '\n'; } alert(l);
13 frames... They are crazy! 2 is already too much for my taste...
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Wed Nov 29, 2006 3:04 pm    Post subject: Reply with quote

PhiLho wrote:
Good, you figured out the remainder. For those searching, here is a way to have a list of the frames:
javascript:fr = parent.frames; for (var i = 0, l = ''; i < fr.length; i++) { l += fr[i].name + '\n'; } alert(l);
13 frames... They are crazy! 2 is already too much for my taste...

I always at least TRY to figure it out before asking again.. because I know that people who don;t try to think things out for themselves don't get much help from the experts.
You guys get paid to do this stuff.... so the laest i can do is try a few things and do a bit of googling before saying i don't get it.
This .js is coming back to me... but frames are something iv'e never had to deal with before...and I am sure that this application TRIES to make things confusing - proprietry software and all that kind of thing.

Thanks for the script, that is excellent... i was going to ask for that before i just saved the page and realised that the folders that get created correspond to the individual frames.
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Wed Nov 29, 2006 3:06 pm    Post subject: Reply with quote

More on referencing frames:

parent = the frameset page
parent.frameName = the particular frame

or

top = the frameset page
top.frameName = the particular frame

If you are dealing with nested frames (frames inside frames), you'd need to reference something like this:

parent.parent.frameName

NB: This might not give the same result as top.parent.frameName. Nested frames are a bitch.

If you are referencing back to a frame that opened a new window, use this to reference the frame that opened the window from the new window:

opener.parent.FrameName

Hope this helps
Back to top
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Wed Nov 29, 2006 3:10 pm    Post subject: Reply with quote

n-l-i-d wrote:
More on referencing frames:
....
If you are dealing with nested frames (frames inside frames), you'd need to reference something like this:
....
Hope this helps

Yeah, they are nested :[

Thanks for the help, it's saved me spending another day googling huge quantities of knowledge just so i can pick out the tiny bits i need to do this one thing.
I have a script already, and it works fine... i just want to make it so the window does not require focus... and i'm getting stumped on the frames and .js syntax i was never very good with... and i'm sooo tired now :)
BUT I WILL GET IT!!!
I WILL...
I MUST WORK ON!
}:]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group