Sign in to follow this  
Followers 0
Bliz0r

Detecting titles problem..

6 posts in this topic

Hello, I started with Autoit v3 yesterday, and decided to make a "bot" for a browser 3dchat (a friend requested, and I took it as a challenge)

Anyway, heres my code so far:

$Forside1 = "Mozilla Firefox forside";forsidens title, variable der kan ændres.
$Account = ""
$Password = ""

send("#r");Dette er Windowsknap + R.
WinwaitActive("Kør");Den aktivere "kør" vinduet.
Send("Firefox.exe{ENTER}");Her skriver den command til at køre Firefox.Exe.
WinWaitactive($Forside1);Her er $foreside1, det er en variable, der kan ændres.
MouseClick("Primary", 528, 70, 1, 10);Klik til adressesbaren.
Send("http://www.netstationen.dk{ENTER}");Her skriver den addressen ind.
sleep(5000)
Mouseclick("Primary", 343, 610, 1, 10);Klik til at gå ind på selve netstationen.
Sleep(5000)

;Så er den inde på selve netstationen, nu skal der logges ind.

WinSetState("http://www.n.dk - NetStationen - Mozilla Firefox", "Online:", @SW_MINIMIZE);For at minimere Netstationen
Sleep(5000)
WinWaitActive("Netstationen:Chatunivers for unge");Går ind i den gamle firefox side for at lukke den ned.
WinClose("Netstationen:Chatunivers for unge");Her lukker den, den ned.
Sleep(5000)
WinSetState("http://www.n.dk - NetStationen - Mozilla Firefox", "Online:", @SW_MAXIMIZE);Maksimere det igen.
WinwaitActive("http://www.n.dk - NetStationen - Mozilla Firefox")

Don't mind the comments, for me to remember what the exact line of code does :lmao:

In the last bit, with the minimizing & maximizing, after it clicks the link at "Mouseclick("Primary", 343, 610, 1, 10)", and opens up the "http://www.n.dk - NetStationen - Mozilla Firefox" it doesnt minimize it, why is that? I thought it was a problem with the titles, but I tried to change them, add text ect, what's the problem? It also wont close down the "Netstationen:Chatunivers for unge" even though I tried both WinClose & WinKill

Is there a solution to this, eventually by changing the title of the window it open? or? :whistle:

Share this post


Link to post
Share on other sites



Hm, I just found out, that it can close the window it just opened, but it can't close the previous one, why?

I made it click on a link, which opens the chat in a "pop-up", and then I want the firefox which I opened up @ run command, to close. And Winkill / Close doesnt work, why?

Share this post


Link to post
Share on other sites

Hm, I just found out, that it can close the window it just opened, but it can't close the previous one, why?

I made it click on a link, which opens the chat in a "pop-up", and then I want the firefox which I opened up @ run command, to close. And Winkill / Close doesnt work, why?

In your code example

WinWaitActive("Netstationen:Chatunivers for unge");Går ind i den gamle firefox side for at lukke den ned.
 WinClose("Netstationen:Chatunivers for unge");Her lukker den, den ned.

The help file examples show empty quotes for the window text but I tested it without even the empty quotes and it still closed the notepad window.

Have you tried displaying an error code after the WinClose command and see what shows up? Also try adding the extra WinActive check below...could be the window isn't being activated. Move the $error and msgbox lines to different places to see if any other errors are occurring.

If Not WinActive(("Netstationen:Chatunivers for unge") Then WinActivate ("Netstationen:Chatunivers for unge")
 WinWaitActive("Netstationen:Chatunivers for unge");Går ind i den gamle firefox side for at lukke den ned.
 WinClose("Netstationen:Chatunivers for unge");Her lukker den, den ned.

 $error=@error
 msgbox(0,"Error Code", "Error = " & $error)

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$error=@error
msgbox(0,"Error Code", "Error = " & $error)
WinSetState($Netstation2, @SW_MINIMIZE)

That gave me a Error 0, Something is wrong with the minimizing?

EDIT:

$error=@error
msgbox(0,"Error Code", "Error = " & $error)
WinWait($Netstation1)
WinWaitActive($Netstation1) 
WinClose($Netstation1) 
WinActive($Netstation1)
Sleep(5000)

That also gave me a Error, I suspect this one.

I changed a bit in the code. Now it looks like this:

$Forside1 = "Mozilla Firefox forside" 
$Account = "dkzdarwich"
$Password = "CENSORED"
$Netstation1 = "Netstationen:Chatunivers for unge"
$Netstation2 = "http://www.n.dk - Netstationen - Mozilla Firefox"

send("#r") 
WinwaitActive("Kør") 
Send("Firefox.exe{ENTER}") 
WinWaitactive($Forside1) 
MouseClick("Primary", 528, 70, 1, 10) 
Send("http://www.netstationen.dk{ENTER}")
sleep(5000)
Mouseclick("Primary", 343, 610, 1, 10) 
Sleep(5000)

WinSetState($Netstation2, @SW_HIDE) 
Sleep(5000)
$error=@error
msgbox(0,"Error Code", "Error = " & $error)
WinWaitActive($Netstation1) 
WinActive($Netstation1)
WinClose($Netstation1) 

Sleep(5000)
WinSetState($Netstation2, @SW_SHOW)
MouseClickDrag("Primary", 122, 197, 30, 5)
MouseClick("Primary", 205, 42, 1, 10)
Send($Account)
MouseClick("Primary", 312, 40, 1, 10)
Send($Password)
MouseClick("Primary", 390, 41, 1, 10)
Edited by Bliz0r

Share this post


Link to post
Share on other sites

Anybody know a solution to my problem? :whistle:

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

$error=@error
msgbox(0,"Error Code", "Error = " & $error)
WinSetState($Netstation2, @SW_MINIMIZE)

That gave me a Error 0, Something is wrong with the minimizing?

EDIT:

$error=@error
msgbox(0,"Error Code", "Error = " & $error)
WinWait($Netstation1)
WinWaitActive($Netstation1) 
WinClose($Netstation1) 
WinActive($Netstation1)
Sleep(5000)

That also gave me a Error, I suspect this one.

@error = 0 means there was no error... :whistle:

I changed a bit in the code. Now it looks like this:

WinSetState($Netstation2, @SW_HIDE) 
Sleep(5000)
$error=@error
msgbox(0,"Error Code", "Error = " & $error)
WinWaitActive($Netstation1) 
WinActive($Netstation1)
WinClose($Netstation1)
WinSetState() doesn't set @error (per the help file), just 1 or 0. And you have a parameter for window text before the state. To get a message only when there is an error, try it this way:

If Not WinSetState($Netstation2, "", @SW_HIDE) Then MsgBox(16, "Error", "Error occured hiding window.")
Sleep(5000)
WinWaitActive($Netstation1) 
WinActive($Netstation1)
WinClose($Netstation1)

:lmao:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  
Followers 0