Jump to content

Why does my 2nd while statement not work


Dxnny
 Share

Recommended Posts

 

WinActivate("#unbelievaboat - Discord")

HotKeySet("{F1}","stopScript")

While(1)
   Sleep (30000)
   Send(">work")
   Send("{ENTER}")
WEnd

While(2)
   Sleep (31000)
   Send(">dep all")
   Send("{ENTER}")
WEnd

Func stopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

 

Edited by Jos
added the code instead of link
Link to comment
Share on other sites

I'm looking to send messages to a Discord channel, I originally wanted to do to this in the background whilst I play games, etc, but wasn't sure if that was possible. I've got the first while statement working, but the second one does not work for me.

Link to comment
Share on other sites

  • Developers

Please add the code as shown in stead of providing links.
So why are you assuming the second loop should ever be reached as you never end the first loop?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hello, Welcome, 

 

@Jos said what is your problem. I ll help a bit more. 

 

WinActivate("#unbelievaboat - Discord")

HotKeySet("{F1}","StopScript")
HotKeySet("{F2}","One")
HotKeySet("{F3}","Two")

While (1) ; 1 Mean Yes and not 1 time
    Sleep(10)
WEnd

Func One ()
   Sleep (30000)
   Send(">work")
   Send("{ENTER}")
EndFunc

Func Two ()
   Sleep (31000)
   Send(">dep all")
   Send("{ENTER}")
EndFunc

Func StopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

Or 

HotKeySet("{F1}","StopScript")

$Window = WinActivate("#unbelievaboat - Discord")

If WinActive ($Window) Then
   Sleep (30000)
   Send(">work")
   Send("{ENTER}")
   Sleep (31000)
   Send(">dep all")
   Send("{ENTER}")
EndIF

While (1) ; 1 Mean Yes and not 1 time
    Sleep(10)
WEnd

Func StopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

The main thing to do is to code your script and learn how the function are working by pressing F1 on each function ;) (While in SCITE)

 

Also you can take a look at

ExitLoop

in help file.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

7 minutes ago, caramen said:

Hello, Welcome, 

 

@Jos said what is your problem. I ll help a bit more. 

 

WinActivate("#unbelievaboat - Discord")

HotKeySet("{F1}","StopScript")
HotKeySet("{F2}","One")
HotKeySet("{F3}","Two")

While (1) ; 1 Mean Yes and not 1 time
    Sleep(10)
WEnd

Func One ()
   Sleep (30000)
   Send(">work")
   Send("{ENTER}")
EndFunc

Func Two ()
   Sleep (31000)
   Send(">dep all")
   Send("{ENTER}")
EndFunc

Func StopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

Or 

HotKeySet("{F1}","StopScript")

$Window = WinActivate("#unbelievaboat - Discord")

If WinActive ($Window) Then
   Sleep (30000)
   Send(">work")
   Send("{ENTER}")
   Sleep (31000)
   Send(">dep all")
   Send("{ENTER}")
EndIF

While (1) ; 1 Mean Yes and not 1 time
    Sleep(10)
WEnd

Func StopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

The main thing to do is to code your script and learn how the function are working by pressing F1 on each function ;) (While in SCITE)

I want the messages to be sent nonstop after each delay, so every 30 seconds >work will be sent and entered in the Discord channel and every 5 minutes >dep all will be sent and entered in the discord channel

Link to comment
Share on other sites

Enjoy doing it mate :) 

We wont do it for you. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Yes but more complicated then you have to learn the

ControlClick

function. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
Just now, Dxnny said:

I tried ControlClick and ControlSend, but it didn't seem to work :/

Show the code that doesn't work as the initial code won't do it. 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Two solution :

-You dont got the correct syntaxt 

Or 

-You cannot automate Discord. with ControlClick (In this case you have to learn this : 

 

Show us what you've tryed so far then we can help you on that. 

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

WinActivate("#unbelievaboat - Discord")

HotKeySet("{F1}","stopScript")

While(1)
   Sleep (30000)
   Send(">work")
   Send("{ENTER}")
WEnd

While(2)
   Sleep (350000)
   Send(">dep all")
   Send("{ENTER}")
WEnd

Func stopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

I'll just do it this way then, so how do I make it loop both messages? I want them sent separately at different intervals like shown, but I'm not too sure on how to make them both loop at the same time.

Link to comment
Share on other sites

Watch 

ExitLoop

And please read precedent reply... We already provide you enouth information to let you be able to do what you want to do.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers

I do not see any Controlxxxx function there and we have been clear your initial posted script is WRONG so please think before simply posting stuff again.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

HotKeySet("{F1}","stopScript")

While(1)
   Sleep (30000)
   ControlSend("#unbelievaboat - Discord", "", "Chrome_RenderWidgetHostHWND1", ">work")
   ControlSend("#unbelievaboat - Discord", "", "Chrome_RenderWidgetHostHWND1", "{ENTER}")
WEnd

Func stopScript ()
   msgbox (0, "Stopping script", "Script has been stopped.")
   Exit
EndFunc

This is what I've tried and it does not work.

Link to comment
Share on other sites

Hehe incorrect syntaxt :)

We will now help you about this. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

To help you to solve that issue i would need your autoIT info tool screenshot on the discord control please.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

>>>> Window <<<<
Title:    #unbelievaboat - Discord
Class:    Chrome_WidgetWin_1
Position:    -1928, -8
Size:    1936, 1056
Style:    0x15C70000
ExStyle:    0x00000100
Handle:    0x00040352

>>>> Control <<<<
Class:    Chrome_RenderWidgetHostHWND
Instance:    1
ClassnameNN:    Chrome_RenderWidgetHostHWND1
Name:    
Advanced (Class):    [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]
ID:    174471080
Text:    Chrome Legacy Window
Position:    0, 0
Size:    1922, 1040
ControlClick Coords:    954, 989
Style:    0x56300000
ExStyle:    0x00000020
Handle:    0x0003038A

>>>> Mouse <<<<
Position:    -967, 988
Cursor ID:    0
Color:    0x2F3136

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Chrome Legacy Window


>>>> Hidden Text <<<<
 

Link to comment
Share on other sites

Try that :)

If it work i explain you.

 

 

ControlSetText ("#unbelievaboat - Discord", "", "[CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]", ">work") 

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

To help you to understand winmove is not same but pretty similar as this

Winmove ("the tittle of my windows", 0,0)

Winmove ("[class:the class of my window]", 0,0)

Same for handle etc.... 

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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...