Jump to content

I want the script to count for me :)


Scripty
 Share

Recommended Posts

So i want the script to count for me evry time it says $count(or something like that) then it +the last number with one :) possible?

Func test ()

while 1

ControlSend("[CLASS:Notepad]", "", "Edit1", "Finished round $Count")

ControlSend("[CLASS:Notepad]", "", "Edit1", "{ENTER}")

WEnd

endfunc

Link to comment
Share on other sites

Can you please describe what this is for?

Where do you define/set $Count?

Can you post the whole script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

$count += 1

$count = $count + 1

either way will add 1 to whatever $count was

Func test ()
$count = 0
while 1
$count += 1
ControlSend("[CLASS:Notepad]", "", "Edit1", "Finished round $Count")
ControlSend("[CLASS:Notepad]", "", "Edit1", "{ENTER}")
WEnd
endfunc

will indefinitely send 1, 2, 3... etc

but depending on whatever it is you are trying to do.. I'm 99% sure there's a better way. Describe your goal if you can.

Edited by caleb41610
Link to comment
Share on other sites

I would do it the other way round. First write your script and then see how you could do the counting.

The function you have shown only fills Notepad with numbers very fast.

Use something like this:

Func test ()
$count = 0
while 1
     $count += 1
     ControlSend("[CLASS:Notepad]", "", "Edit1", "Finished round " & $Count & @CRLF)
     Sleep(1000)
WEnd
endfunc

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

$count += 1

$count = $count + 1

either way will add 1 to whatever $count was

Func test ()
$count = 0
while 1
$count += 1
ControlSend("[CLASS:Notepad]", "", "Edit1", "Finished round $Count")
ControlSend("[CLASS:Notepad]", "", "Edit1", "{ENTER}")
WEnd
endfunc

will indefinitely send 1, 2, 3... etc

but depending on whatever it is you are trying to do.. I'm 99% sure there's a better way. Describe your goal if you can.

its not saying any numbers only $count :)
Link to comment
Share on other sites

its not saying any numbers only $count :)

"Finished round $Count"
:ermm:

I would do it the other way round. First write your script and then see how you could do the counting.

The function you have shown only fills Notepad with numbers very fast.

Use something like this:

Func test ()
$count = 0
while 1
     $count += 1
     ControlSend("[CLASS:Notepad]", "", "Edit1", "Finished round " & $Count & @CRLF)
     Sleep(1000)
WEnd
endfunc

Hate to go off topic, but I can never get the indentation to work when I paste code. Any idea why? Edited by caleb41610
Link to comment
Share on other sites

I would do it the other way round. First write your script and then see how you could do the counting.

The function you have shown only fills Notepad with numbers very fast.

Use something like this:

Func test ()
$count = 0
while 1
     $count += 1
     ControlSend("[CLASS:Notepad]", "", "Edit1", "Finished round " & $Count & @CRLF)
     Sleep(1000)
WEnd
endfunc

can i put the $count b4 the

func test () ?

Link to comment
Share on other sites

can i put the $count b4 the

func test () ?

$count += 1 has to be inside the loop

declaring $count = 0 could be anywhere you want, as long as it's declared before the loop starts. At the beginning of the function works.. I always add declares to the top of my script after #include stuff.

If you have no use for $count outside the function, it's better to declare it inside the function as a Local variable. Otherwise declare it at the top of the script as Global

Edited by caleb41610
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...