Sign in to follow this  
Followers 0
kijer

help on making a script

11 posts in this topic

Hey!

I'm new to Auto it. Ive used some programs from it before. But i don know how to use it.

I want to make a script to rename my music files on media player. I know how to write it using basic for a ti-86 :D but i cant do it using the computer. What I want it to do is prompt me for a number if i press space and if i press enter just use the previos entry.

zzz=0

A=0

B=0

lbl start

while zzz<1

getkey(store as) zzz

end

if zzz==(space)

then

prompt A

goto main

end

if zzz==(enter)

goto main

if zzz==(escape)

goto leave

lbl main

[this is where auto it comes in]

send("f2")

send("home")

while B(doensn't=)A

send("del")

B=B+1

end

send("enter")

send("down arrow")

zzz=0

goto start

lbl leave

stop

yeah so how do i put that into auto it? I have SciTE editor to help me get the basic comands down (send) but besides that i dont know what to do. I dont get a drop down box with my other commands.

Any help would be appreciated

Thank you

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This is so easy, you should read the help file!!

Unless someone is really really bored, noone will do this for you. It's virtually no challenge at all!

Edit: You have a TI-86? Cool ^^

Edited by Manadar

Share this post


Link to post
Share on other sites

Welcome kijer,

it is absolutely important to read the helpfile and search inside this forum.

Read in helpfile 'Language Reference' therewith you know how to use variables and operators.

If you want to know something about file functions look at 'Function Reference - File, Directory and Disk Management' and 'User Defined Function Reference - File Management' and so on. Never forget to search in this forum to find examples and mistakes other did. Try to write your first script maybe with a little part of all that you want. Post your script and ask the forum members.

The forum members will help you (if they can) but nobody will do your job.

So good luck. :D

P.S.1: You can't use 'goto' anymore. You have to use functions. If you want to 'press space' look at 'send'.

P.S.2: What is a TI-86?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

P.S.2: What is a TI-86?

thank you briegal. and a Ti-86 is a graphing calc

ok so what did i do wrong?

HotKeySet ("{Enter}" , "Continue")
HotKeySet ("{Space}" , "Ask")
Func Continue()
    Send("{f2}")
    Send("{Home}")
    While B<A
        Send("{Del}')
        B=B+1
    WEnd
    Send("{Enter}")
    Send("Down")
    EndFunc
Func Ask()
    A = InputBox ("Delete", "How many times?")
    Send("{f2}")
    Send("{Home}")
    While B<A
        Send("{Del}')
        B=B+1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc

I get this error

C:\Documents and Settings\Derrick\Desktop\editor.au3(6,9) : ERROR: syntax error

While B<

~~~~~~~^

C:\Documents and Settings\Derrick\Desktop\editor.au3(8,1) : ERROR: string break without trailing _

Send("{Del}')

B=B+1

WEnd

Send("

^

C:\Documents and Settings\Derrick\Desktop\editor.au3(10,8) : ERROR: syntax error (illegal character)

Send({

~~~~~^

C:\Documents and Settings\Derrick\Desktop\editor.au3(11,1) : ERROR: string break without trailing _ (illegal character)

Send({Enter}")

Send("

^

C:\Documents and Settings\Derrick\Desktop\editor.au3(12,1) : ERROR: string break without trailing _

Send(Down")

EndFunc

Func Ask()

A = InputBox ("

^

C:\Documents and Settings\Derrick\Desktop\editor.au3(15,1) : ERROR: string break without trailing _ (illegal character)

Send(Down")

EDelete", "How many times?")

Send("

^

C:\Documents and Settings\Derrick\Desktop\editor.au3(16,1) : ERROR: string break without trailing _ (illegal character)

Send({f2}")

Send("

^

C:\Documents and Settings\Derrick\Desktop\editor.au3(17,1) : ERROR: string break without trailing _ (illegal character)

Send({Home}")

While B<A

Send("

^

C:\Documents and Settings\Derrick\Desktop\editor.au3(19,4) : ERROR: syntax error (illegal character)

B=

~^

C:\Documents and Settings\Derrick\Desktop\editor.au3(2,29) : ERROR: Ask(): undefined function.

HotKeySet ("{Space}" , "Ask")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Derrick\Desktop\editor.au3 - 10 error(s), 0 warning(s)

Edited by kijer

Share this post


Link to post
Share on other sites

Nice try...

Dim $A, $B

HotKeySet("{Enter}", "Continue")
HotKeySet("{Space}", "Ask")

Func Continue()
    Send("{f2}")
    Send("{Home}")
    While $B < $A
        Send("{Del}")
        $B = $B + 1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc  ;==>Continue
Func Ask()
    $A = InputBox("Delete", "How many times?")
    Send("{f2}")
    Send("{Home}")
    While $B < $A
        Send("{Del}")
        $B = $B + 1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc  ;==>Ask

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

wow I did better than i expected i would :D but it doesn't wait for me to press buttons it just runs thru and quits.

>Running:(3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Derrick\Desktop\editor.au3"  
+>AutoIT3.exe ended.rc:0
>Exit code: 0   Time: 2.570

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@Valuter,

I would build in a 'while - wend' to stop the script finishing. What do you think?

Dim $A, $B

HotKeySet("{Enter}", "Continue")
HotKeySet("{Space}", "Ask")

While 1
    Sleep(100)
WEnd

Func Continue()
    Send("{f2}")
    Send("{Home}")
    While $B < $A
        Send("{Del}")
        $B = $B + 1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc  ;==>Continue
Func Ask()
    $A = InputBox("Delete", "How many times?")
    Send("{f2}")
    Send("{Home}")
    While $B < $A
        Send("{Del}")
        $B = $B + 1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc  ;==>Ask

EDIT: Sorry kijer I'm to slow. :D

Edited by Briegel

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@Valuter,

I would build in a 'while - wend' to stop the script finishing. What do you think?

Dim $A, $B

HotKeySet("{Enter}", "Continue")
HotKeySet("{Space}", "Ask")

While 1
    Sleep(100)
WEnd

Func Continue()
    Send("{f2}")
    Send("{Home}")
    While $B < $A
        Send("{Del}")
        $B = $B + 1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc  ;==>Continue
Func Ask()
    $A = InputBox("Delete", "How many times?")
    Send("{f2}")
    Send("{Home}")
    While $B < $A
        Send("{Del}")
        $B = $B + 1
    WEnd
    Send("{Enter}")
    Send("Down")
EndFunc  ;==>Ask
so what does ths part do

While 1
    Sleep(100)
WEnd

does it make it sleep while nothing is pressed?

ok it likes the code now, but it doesnt seem to be doing things in order. It asks me how many times and i type 7, then it asks me if im sure i want to delete the file. are things going to fast maybe?

Edited by kijer

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

While 1 is a never ending story. So the program don't finish.

Sleep(100) set a break for 100ms to spare the CPU.

Look in taskmanager at the cpu usage and then try 'while - wend' without sleep.

EDIT: Send("{Del}") don't delete a file. Look at 'File Management'.

Edited by Briegel

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

While 1 is a never ending story. So the program don't finish.

Sleep(100) set a break for 100ms to spare the CPU.

Look in taskmanager at the cpu usage and then try 'while - wend' without sleep.

I can imagine what would happen, it will constantly retry it. i know what while 1 does. but ok i aded delays after each send

Dim $A, $B

HotKeySet("{Enter}", "Continue")
HotKeySet("{Space}", "Ask")

While 1
    Sleep(100)
WEnd

Func Continue()
    sleep(200)
    Send("{f2}")
    sleep(200)
    Send("{Home}")
    sleep(200)
    While $B < $A
        Send("{Del}")
        sleep(200)
        $B = $B + 1
    WEnd
    Send("{Enter}")
    sleep(200)
    Send("Down")
    sleep(200)
    EndFunc
Func Ask()
    $A = InputBox ("Delete",  "How many times?")
    Send("{f2}")
    sleep(200)
    Send("{Home}")
    sleep(200)
    While $B < $A
        Send("{Del}")
        sleep(200)
        $B = $B + 1
    WEnd
    Send("{Enter}")
    sleep(200)
    Send("Down")
    sleep(200)
EndFunc

and it works but after the deletes it doesnt press enter down. Why is this? I tried adding a sleep 500 after thew WEnd, but that didnt work. anyother ideas?

I know that del wont delete teh file, but pressing delete on a file will delete it. and it didnt press f2 yet

Edited by kijer

Share this post


Link to post
Share on other sites

yay it works :D and its done. here is the finished product

Dim $A, $B, $C, $D

HotKeySet("{Space}", "Ask")

While 1
    Sleep(100)
WEnd

Func Ask()
    $A = InputBox ("Delete",  "How many times?")
    $C = InputBox("Repeat", "How many times?")
    $D = 0
    While $D < $C
        Send("{f2}")
    sleep(50)
    Send("{Home}")
    sleep(50)
    $B=0
    While $B < $A
        Send("{Del}")
        sleep(50)
        $B = $B + 1
    WEnd
    Send("{Enter}")
    sleep(50)
    Send("{Down}")
    sleep(50)
    $D = $D + 1
    WEnd
EndFunc

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