Jump to content

Help with a simple script


para
 Share

Recommended Posts

I need a script written if any of you have the time.

I need it to do the following...

When I hit F1...

It types (INSERT)

Presses TAB

It types (INSERT)

Presses TAB

Presses TAB

It types (INSERT)

Presses TAB

It types (INSERT)

Stops and prepares for the next time I press F1

In that order.

I would greatly appriciate anyone who could help me with this, of course i will replace (INSERT) with my on text.

Please do not confuse (INSERT) with the actual insert key, it is merely there for me to recognize were to type in my own text.

Thank you very much to whom ever helps me with this!

(delay of 1/2 second between each task)

Thanks alot!

Link to comment
Share on other sites

  • Developers

Thank you very much to whom ever helps me with this!

(delay of 1/2 second between each task)

Thanks alot!

<{POST_SNAPBACK}>

So what do you have done yourself already ??? :)

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

I looked at a template and got this...

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

While ( 1 )

WEnd

Func Activate ()

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{DOWN}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{DOWN}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Return

EndFunc

Works exactly how I wanted... is there anyway to make it so that the first command to send (INSERT) adds a number in numerical order? so lets say i make it

(INSERT) = para

for the first one

can it make it so every time i press f1 after loading the script it adds a number? so that it will be

para

para1

para2

para3

para4

and so on...

thanks

Link to comment
Share on other sites

  • Developers

just add a variable which you add 1 to everytime you press F1.

Also add a sleep(10) in the While..Wend to avoid your cpu running at 100%

HotKeySet("{F1}", "Activate")
Dim $Count = 0
While (1)
   Sleep(10)
Wend
Func Activate()
   $count = $count + 1
   Send("(INSERT)" & $count)
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("(INSERT)")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("(INSERT)")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("(INSERT)")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("{DOWN}")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("{DOWN}")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Send("(INSERT)")
   Sleep(350)
   Send("{TAB}")
   Sleep(350)
   Return
EndFunc  ;==>Activate
Edited by JdeB

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

I looked at a template and got this...

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

While ( 1 )

WEnd

Func Activate ()

  Send ( "(INSERT)" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "(INSERT)" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "(INSERT)" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "(INSERT)" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "{DOWN}" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "{DOWN}" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Send ( "(INSERT)" )

  Sleep ( 350 )

  Send ( "{TAB}" )

  Sleep ( 350 )

  Return

EndFunc

Works exactly how I wanted... is there anyway to make it so that the first command to send (INSERT) adds a number in numerical order? so lets say i make it

(INSERT) = para

for the first one

can it make it so every time i press f1 after loading the script it adds a number? so that it will be

para

para1

para2

para3

para4

and so on...

thanks

<{POST_SNAPBACK}>

Try...

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

While ( 1 )

WEnd

Func Activate ()

$x = 1

Send ( "(INSERT)" & $x )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

$x = $x + 1

Send ( "(INSERT)" & $x)

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{DOWN}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "{DOWN}" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Send ( "(INSERT)" )

Sleep ( 350 )

Send ( "{TAB}" )

Sleep ( 350 )

Return

EndFunc

And so on...

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Maybe something like this.

HotKeySet("{F1}", "Activate")
Dim $Count = 0
$insert="Para"
While (1)
 Sleep(10)
Wend
Func Activate()
 $count = $count + 1
 Send($insert & $count)
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 $count = $count + 1
 Send($insert & $count)
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 $count = $count + 1
 Send($insert & $count)
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 $count = $count + 1
 Send($insert & $count)
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Send("{DOWN}")
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Send("{DOWN}")
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 $count = $count + 1
 Send($insert & $count)
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Return
EndFunc;==>Activate

somehow I think you meant this though:

HotKeySet("{F1}", "Activate")
Dim $Count = 0
$insert="Para"
While (1)
 Sleep(10)
Wend
Func Activate()
 $count = $count + 1
 Send($insert & $count)
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Send("{TAB}")
 Sleep(350)
 Return
EndFunc;==>Activate
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

One way to shorten your code:

Opt("SendKeyDelay", 350);milliseconds

HotKeySet("{F1}","Activate")
While 1
  sleep(10);pause prevents maxing out the CPU
WEnd

Func Activate ()
   _FastSend("(INSERT)")
   Send("{TAB}")
   _FastSend("(INSERT)")
   Send("{TAB 2}")
   _FastSend("(INSERT)")
   Send("{TAB}")
   _FastSend("(INSERT)") 
   Send("{TAB 2}{DOWN}{TAB}{DOWN}{TAB}")
   _FastSend("(INSERT)")
   Send("{TAB}")
EndFunc 

Func _FastSend($text)
   Opt("SendKeyDelay", 1);one millisec
   Send($text)
   Opt("SendKeyDelay", 350)
EndFunc
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...