Jump to content

Counting from 001?


Recommended Posts

Greeting everyone, Novice DIY guy here

I have a quick question about AutoIt in regards to Local $ storage and while loops for counting.

I hobbled together a script to help me take alot of screenshots and name them in consecutive order from 001 to 565. the way I had to do this because local storage Sends them not as 001 but 1. so I made three local $ one for each decimal then send them in the right order. which is working so far. 

the issue I have is there are times when I would like to reference the local $ but it is stored in three separate $, cant add them together as it would be nonsense.

I was gonna use an inputBox then send the three $ and get a new $Count but as soon as the box comes up it stops the script until the box closes.:sweating:

The main reason i need to know what count im on is i need to skip 9 numbers in the 565 set or the count gets off.

I'm out of ideas here any help would be much appreciated 

script is attached!

Spoiler

; Press Esc to terminate script, Pause/Break to "pause"
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
Global $Paused, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")

$VAR1 = 1
$VAR2 = 0
$VAR3 = 0


While 1
    Sleep(100)
WEnd
Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
        Sleep(400)
   WinActivate("PPSSPP")
         Sleep (500)
   Send ("{PRINTSCREEN}")
   Sleep (1000)
   MouseClickDrag($MOUSE_CLICK_LEFT, 808, 114, 938, 284)
   Sleep (500)
   MouseMove (895, 304)
   Sleep (200)
   MouseClick ("left")
   Sleep (200)
   Send($VAR3)
   Sleep (200)
   Send($VAR2)
   Sleep (200)
   Send($VAR1)
   Sleep (200)
   Send ("{ENTER}")
   Sleep (200)
       ProcessClose("Lightshot.exe")
    Sleep(1000)
   WinActivate("PPSSPP")
   Sleep (600)
   MouseMove(1170,155)
   Sleep (200)
   MouseDown("LEFT")
   Sleep (200)
   MouseUp("LEFT")
   Sleep(200)
   Send("^!2")
   Sleep(2000)

   $VAR1+=1
   If $VAR1=10 Then
           $VAR1=0
        $VAR2+=1
   EndIf

   If $VAR2=10 Then
        $VAR2=0
        $VAR3+=1
   EndIf
       Local $Count = InputBox("Question", "What Card are you on?", "", "", _
             - 1, -1, 0, 0)
   Sleep (1000)
   Send($VAR3)
   Sleep (200)
   Send($VAR2)
   Sleep (200)
   Send($VAR1)
   Sleep(200)
   Send("{ENTER}")
   If $Count=36 then
       $VAR1+=1
   EndIf
   If $Count=53 then
       $VAR1+=1
   EndIf
   If $Count=101 then
       $VAR1+=1
   EndIf
   If $Count=133 then
       $VAR1+=1
   EndIf
   If $Count=145 then
       $VAR1+=1
   EndIf
   If $Count=172 then
       $VAR1+=1
   EndIf
   If $Count=182 then
       $VAR1+=1
   EndIf
   If $Count=199 then
       $VAR1+=1
   EndIf
   If $Count=265 then
       $VAR1+=1
   EndIf
   If $Count>=565 then
       $VAR1+=1
   EndIf

    WEnd
EndFunc   


 

 

 

MGA2.au3

Link to comment
Share on other sites

As Grunty has demonstrated, AutoIT is not typed, when a type conversion appears requested, it does its best to sort it out for you. Here is my similar example:

Opt('MustDeclareVars', 1)

Global $var1 = "1"
Global $var2 = "4"
Global $var3 = "5"

Global $var4 = $var1 & $var2 & $var3

MsgBox(1, "Concatenate", $var4)
MsgBox(1, "Concatenate+1", $var4 + 1)

 

Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Link to comment
Share on other sites

ReformedOceot,

Correct the way you generate names for these files like this...

For $1 = 1 To 10
    FileWrite(@ScriptDir & '\snapshot.' & StringFormat('%04i', $1), '')
Next

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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