Jump to content

ControlSend issues, need help :(


Recommended Posts

hey guys i'd realy like to know why does the Control send command here:

Func MacroPageRun()
If $BotRunning = 0 Then Return
SCountSet(10)
$MacroRunCount = $MacroRunCount + 1
$i = $MacroRunCount
    If $i <= 10 then
    If $i = 10 Then $MacroRunCount = 0
        $MacroCmd = GUICtrlRead($MacroInputL[$i])
        If $MacroCmd = "" Then Return
        $CmdSendDelay = GUICtrlRead($MacroTDL[$i])
        $CmdStrokeDelay = GUICtrlRead($MacroSDL[$i])
        Opt("SendKeyDelay", $CmdStrokeDelay)
            If StringInStr($MacroCmd,"{ESC}")<>0 Then
                $IgnoreExit = 1
            EndIf
        If $HideNavigate=1 Then
            ;MsgBox(0,"Debug","HideNavigating Present!")        
            If $i = 1 Then
                ;MsgBox(0,"Debug","first inputbox - opening ie hidden")
                If $HideNavigateTest = 1 Then
                    $oIE = _IECreate($MacroCmd,0,1,0)
                    Sleep($CmdSendDelay)
                Else
                    $oIE = _IECreate($MacroCmd,0,0,0)
                    Sleep($CmdSendDelay)
                EndIf
                Opt("WinTitleMatchMode", 4)
                $oIEhwnd = _IEPropertyGet($oIE, "hwnd")
                If $oIEhwnd = 0 Then Return MsgBox(4144,Chr(153)&" Spam And Macro Bot "&$Version," Program Error:"&@CRLF&"coudn't find the IE process!")
                ;MsgBox(0,"Debug","Operation Done!")
            Else
                ;MsgBox(0,"Debug","Sending Keys: "&$Sendmode)
                If StringLeft($MacroCmd,3)="^<^" Then 
                    $MacroCmd = StringTrimLeft($MacroCmd,3)
                    Send($MacroCmd,$Sendmode)
                    sleep($CmdSendDelay)
                Else
                    $ret = ControlSend($oIEhwnd, "", "Internet Explorer_Server1", $MacroCmd,$Sendmode)
                    If $ret = 0 Then Return MsgBox(4144,Chr(153)&" Spam And Macro Bot "&$Version," Program Error:"&@CRLF&"coudn't send keys to the control!")
                    sleep($CmdSendDelay)
                EndIf
                ;MsgBox(0,"Debug","Done!")
            EndIf
        Else
            ;MsgBox(0,"Debug","sending normal")
            Send($MacroCmd,$Sendmode)
        EndIf
        sleep($CmdSendDelay)
    Else
        _IEQuit($oIE)
        StopOperation(2)
    EndIf
EndFunc

fails to send the command in case i'm using the pc! or sends the command somewhere else...

- doesn't the control send command send direct keys to a certain control regardless to what is done with the computer ?!

- if not, is there any way to achieve that ?!

- is the Control Send function totally independent ?

>if you strike some keys in the middle of the sending process the contorl send isn't working properly !!!

-maybe the control gets focused after a controlsend and we should remove the focus?!

THANKS IN ADVANCE !

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

  • Moderators

;MsgBox(0,"Debug","HideNavigating Present!")

MsgBox(4144,Chr(153)&" Spam And Macro Bot "&$Version," Program Error:"&@CRLF&"coudn't send keys to the control!")

You're brilliant aren't you.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@SmOke_N

so nice of you program writing expert to find the lil funny mistakes in one's code... :)

- BUT WHERE IS THE ANSWER ?!!?!? :P

p.s - the first one was for me, the second one was for the users... i like it that way... :) :)

(and yeahhh i am brilliant !) :D

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

  • Moderators

@SmOke_N

so nice of you program writing expert to find the lil funny mistakes in one's code... :P

- BUT WHERE IS THE ANSWER ?!!?!? :lol:

p.s - the first one was for me, the second one was for the users... i like it that way... :D:)

(and yeahhh i am brilliant !) :D

The answer lies between ones ears... The real question is, why would I even attempt to provide a viable solution to your issue, if you're not smart enough to:

1. Provide a recreation script that is "workable" for others to actually test :)

2. Too stupid to remove the "spam"/"hide" options in the little bit of code you did provide :)

?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The answer lies between ones ears... The real question is, why would I even attempt to provide a viable solution to your issue, if you're not smart enough to:

1. Provide a recreation script that is "workable" for others to actually test :)

2. Too stupid to remove the "spam"/"hide" options in the little bit of code you did provide :)

?

Good game.

tolle indicium

Link to comment
Share on other sites

@SmOke_N & backstabbed

just watch-out not to help people on this forum too much, we might actually be considered useful...

- Anyone ELSE maybe ?!

(that has any solution beside criticizing the COMMENTS in my script ?!)

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

@SmOke_N & backstabbed

just watch-out not to help people on this forum too much, we might actually consider you useful...

- Anyone ELSE maybe ?!

(that has any solution beside criticizing the COMMENTS in my script ?!)

unlike the programs you're making...

tolle indicium

Link to comment
Share on other sites

guys, I KNOW YoU know more then me ! that's why i ask you guys questions !!!

- but yet i don't expect to be put to mockery! and if i am, at least have the descent to give me the correct answer after (:

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

guys, I KNOW YoU know more then me ! that's why i ask you guys questions !!!

- but yet i don't expect to be put to mockery! and if i am, at least have the descent to give me the correct answer after (:

Armand,

I think what they're trying to say to you is:

It's obvious from the comments in your code that you are building, or trying to build, a "Spam & Macro" bot.

While you may have a sincere interest in learning AutoIt and getting advice from the more experienced members of the forum, we do not encourage malicious scripts like "Spam & Macro" bots.

So our desire/incentive to help you is at level zero right now (and we don't see it climbing any higher in the near future).

There are enough script kiddies in the world without us helping to breed more.

Learn to script and script for good. We will not help you do bad.

Edited by ResNullius
Link to comment
Share on other sites

@ResNullius

hey mate, in case that's the case, i think you should have a look at that page:

http://www.autoitscript.com/forum/index.php?showtopic=43639

____

as you can see it is not quite a spam bot, it's just a macro recoreder! i just named it so as it spawned from an old spam-bot i made for diablo II back in the days!!!

- it is mainly used to reconnect router's automatically without user attendance !!!

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

theres also that post:

http://www.autoitscript.com/forum/index.php?showtopic=46052

it send the keys properly to active and inactive windows if the 3rd parameter is given ! eg:

ControlSend($oIEhwnd, "", "Internet Explorer_Server1", $MacroCmd,$Sendmode)

however, it is not totally independent ! if you strike some keys in the middle of the sending process the contorl send isn't working properly !!!

-maybe the control gets focused after a controlsend and we should remove the focus?!

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

@ResNullius

hey mate, in case that's the case, i think you should have a look at that page:

http://www.autoitscript.com/forum/index.php?showtopic=43639

____

as you can see it is not quite a spam bot, it's just a macro recoreder! i just named it so as it spawned from an old spam-bot i made for diablo II back in the days!!!

- it is mainly used to reconnect router's automatically without user attendance !!!

OK, so if that's the case, then as Smoke_N said in his 2nd reply to you "1. Provide a recreation script that is "workable" for others to actually test "

We can't diagnose what we can't see: specifically

If $HideNavigateTest = 1 Then
                    $oIE = _IECreate($MacroCmd,0,1,0)
                    Sleep($CmdSendDelay)
                Else
                    $oIE = _IECreate($MacroCmd,0,0,0)
                    Sleep($CmdSendDelay)
                EndIf
What is the content of "$macroCmd" that is being read in "GUICtrlRead($MacroInputL[$i]" ???

PS: You can't expect us to search the forums for (all) your other posts to see what you're really up to. And you can't expect us to read your mind (or the parts of your script you haven't posted).

Link to comment
Share on other sites

just attached all the latest scripts regarding this program i made, however i don't think it'll work because the icon package is missing so i'll also include the complied download:

http://rapidshare.com/files/34831066/Recon..._Suite_V1.6.exe

-> when trying to use the macro send to web-page in hidden mode (ROUTER RECONNECTION!) the program is interrupted by user key presses, as i've mentioned before, my best guess is that it's because the control is being FOCUSED and thus the user keys are sent there automatically, however i donow that for sure and looking for your confirmation!

Posted Image

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

OK, I think I've found the problem. Ive reduced the script to this for testing:

#include <IE.au3>
$Version = "v0.5B"
$MacroCmd = "www.autoitscript.com"
$CmdSendDelay= 100
$Sendmode = 1
$oIE = _IECreate($MacroCmd,0,1,0)

Sleep($CmdSendDelay)

Opt("WinTitleMatchMode", 4)

$oIEhwnd = _IEPropertyGet($oIE, "hwnd")
If $oIEhwnd = 0 Then MsgBox(4144,Chr(153)&" Spam And Macro Bot "&$Version," Program Error:"&@CRLF&"coudn't find the IE process!")

$MacroCmd = "{F5}"
$ret = ControlSend($oIEhwnd, "", "Internet Explorer_Server1", $MacroCmd,$Sendmode)

If $ret = 0 Then MsgBox(4144,Chr(153)&" Spam And Macro Bot "&$Version," Program Error:"&@CRLF&"coudn't send keys to the control!")
MsgBox(0,"",$ret)
oÝ÷ Ù8Z·l²í¡ü!jÔ¦:G槵¼ªê-­ç+y«b¢{®*m¶­Ê®¢Ü(®Fꮢ×è®az»-¡§-¹©eÊ׬¶«¨¶Æ¯zˬ«âhÁ§^¶èºr¢êÜ¡×ÛkÊÚ.׫²Ö§wZ·*.ßÚÞv§ò¢êîØb³*.².ضØ^±©zºè®g¬±¨ªê-r¥v}ý¶Ç§vG²²Ú¢{k¢Z®¢Ü¨»k{Mú­ëoj[mè§ChÁÈZ­â
·µébëhjëh×6 

_IECreate($MacroCmd,0,1,1)
Note the 4th parameter being changed to 1 from 0 which according to the function's documentation: "(Default) Wait for page load to complete before returning". Of course you could eliminate it all together , as it is the default.

I have changed this in your script as well and it seems to work also. The problem was that if "$CmdSendDelay" was set too low (I had to set it to 1000 to get your original script to work, sometimes), your _IECreate() wouldn't finish loading by the time your "Sleep($CmdSendDelay)" expired and the next ControlSend() tried to be executed.

Try the change o see if it works for you.

Link to comment
Share on other sites

@ResNullius

hey mate thanks alot !!!!!!!!!!!!!!!!!!!!!!!!!!!

though you're help is really appreciated it is yet not quite catching my issue...

- Though that's not the issue in concern the _IECreate() func is set to not wait for the page to load for a reason, and as written in the help file of the program, people have to write the time they think it'll take the page to load them-selfs !

(that's couse the program is made for people to automate a login to their own router's page and run a restart operation on it and some of the router's have such a page that "POPs" the IE login form thus preventing the page to report as FINISHED LOADING, and the timeout on that function is too damn long, though i can set a different timeout, i rather just let the users deccide themselfs !)

- The issue is: why when the _IECreate() is set to load in hidden mode in particular, and even in normal mode for that matter, when the ControlSend sequence has started, the keys are not always sent to the specified contorl OR some other keys (user pressed) are sent to the control which are not should be!

(i haven't deccided what's the case yet but's i'm kinda sure it's either of the two !)

THANKS ALOT FOR MINDING MY POST!!!

- I WILL REMEMBER THAT: "recreation script that is "workable" for others to actually test" TIP FOR NEXT TIMES !!!!

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

@ResNullius

hey mate thanks alot !!!!!!!!!!!!!!!!!!!!!!!!!!!

though you're help is really appreciated it is yet not quite catching my issue...

Can you provide an example of ControlSend sequence(s) you would be sending?

Again, kinda shooting in the dark here trying to replicate your problem and figure out how to solve it.

Link to comment
Share on other sites

Also, when I try it with my router, a Linksys WRT54G, using the WaitForLoad on _IECreate() works even with the "POP" up login window.

But I'm not sure how you can take into account the new "POP" up windows for all the different scenarios: for instance mine is titled "Connect to 192.168.10.1" , and of course has a different hwnd then the Internet Explorer window that spawns it.

And other routers have different titles for their login dialogs.

So, it looks to me like you need to have/add some facility for allowing the user to customize the title of their logon window so you can then ControlSend directly to it.

Once that's out of the way, then you can go back to ControlSending the rest of your keystrokes/macros to the IE window.

Link to comment
Share on other sites

@ResNullius

Ahoiii!

-Try using the IE HIDDEN MODE and see what am i talking about...

-i've made a work'around for that annoying POPing screen, just send the keys with SEND() instead of the ControlSend using the '^<^{COMMAND HERE}' mathode to send to the POPing window, as i was saying in IE MODE the window isn't considered loaded untill the POPing window goes away!!! thus i removed the wait time so that people could make it more accurate!

MY Q is:

-can one send keys to a hidden control MISTAKENLY after the control got focused by the ControlSend func ?!

-can the ControlSend func FAIL due to the computer usage?! (clicking on mouse\keyboard in the middle...)?!

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
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
 Share

  • Recently Browsing   0 members

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