Jump to content

Hi please answer my noob question :D


Canasian
 Share

Recommended Posts

$TempPath = EnvGet("temp")

MsgBox(0, "My First Attempt", "This is my first try at making a script from my own idea =D Tell me if you find anything wrong with it ^^.")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send(":Start")
Send("{Enter}")
Send("echo off")
Send("{Enter}")
Send("color 2")
Send("{Enter}")
Send("echo ")
For $i = 1 To 113
    Send("%random% ")
Next
Send("{Enter}")
Send("goto start")
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "The text in the Untitled file has changed")
Send("!Y")
Send($TempPath & "\Matrix.bat")
Send("!s")
Sleep(1000)
Run($TempPath & "\Matrix.bat")
Send("!{Enter}")
Sleep(10000)
Send("^c")
Sleep(500)
Send("Y")
Send("{Enter}")
Sleep(10000)
FileDelete($TempPath & "\Matrix.bat")
Edit: What did you want to slow down?

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I get this from SciTE when I run your code:and now I have Matrix.bat in my "My Docs" folder

and the script attempted to run it from Matrix.bat from my c:\temp folder.

Blehhhhh It does the same thing on my comp at home... like the matrix.bat doesn't exist? But it worked fine at school.. and the thing i wanted to slow down was the typing of the text.. the :start echo off color 2 echo %random% etc..

Link to comment
Share on other sites

try this:

Opt("SendKeyDelay", 40)
$TempPath = EnvGet("temp")

MsgBox(0, "My First Attempt", "This is my first try at making a script from my own idea =D Tell me if you find anything wrong with it ^^.")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send(":Start")
Send("{Enter}")
Send("echo off")
Send("{Enter}")
Send("color 2")
Send("{Enter}")
Send("echo ")
For $i = 1 To 113
    Send("%random% ")
Next
Send("{Enter}")
Send("goto start")
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "The text in the Untitled file has changed")
Send("!Y")
Send($TempPath & "\Matrix.bat")
Send("!s")
Sleep(1000)
Run($TempPath & "\Matrix.bat")
Send("!{Enter}")
Sleep(10000)
Send("^c")
Sleep(500)
Send("Y")
Send("{Enter}")
Sleep(10000)
FileDelete($TempPath & "\Matrix.bat")

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Dim $Line[10]

$file= FileOpen(@ScriptDir&"\Matrix.bat",2)
$Line[1] = ":Start"
$Line[2] = "echo off"
$Line[3] = "color 2"
$Line[4] = "echo %Random%"
For $i = 1 to 112
    $Line[4] = $line[4]&" %Random%"
Next
$Line[6]="Goto start"
For $int = 1 to 6
    FileWriteLine($File, $Line[$Int])
Next
FileClose($File)
Run(@ScriptDir&"\Matrix.bat")

Unfamiliar with batch, dunno how to do it full screen, but this got rid of the notepad thing

Link to comment
Share on other sites

...But that doesn't show how the bat file was made :) that's kinda how I got the idea of making it.. a few people wanted to know how i did the simple matrix.bat thing and I thought it'd be neat to make it open up notepad then close it all on it's own then open it and make the matrix.bat fullscreen :P...

OP wants notepad.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

try this:

Opt("SendKeyDelay", 40)
$TempPath = EnvGet("temp")

MsgBox(0, "My First Attempt", "This is my first try at making a script from my own idea =D Tell me if you find anything wrong with it ^^.")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send(":Start")
Send("{Enter}")
Send("echo off")
Send("{Enter}")
Send("color 2")
Send("{Enter}")
Send("echo ")
For $i = 1 To 113
    Send("%random% ")
Next
Send("{Enter}")
Send("goto start")
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "The text in the Untitled file has changed")
Send("!Y")
Send($TempPath & "\Matrix.bat")
Send("!s")
Sleep(1000)
Run($TempPath & "\Matrix.bat")
Send("!{Enter}")
Sleep(10000)
Send("^c")
Sleep(500)
Send("Y")
Send("{Enter}")
Sleep(10000)
FileDelete($TempPath & "\Matrix.bat")

Woooo!!! that's awsome... works perfectly :) except.. watching it type %random% 143 times got alittle boring lmao.. but i'm sure with what you gave me i could figure out how to speed that part up then make it go back to the speed you made it go... or maybe just make it delay before exiting so they could look at it for a few seconds.. haha anyways tyvvvm you've helped me alot ^^ now i gotta go read about $TempPath cuz i had no idea where it went when it saved the .bat ^^ lol ty tho very much :P

Link to comment
Share on other sites

or maybe just make it delay before exiting so they could look at it for a few seconds.. haha anyways tyvvvm you've helped me alot ^^ now i gotta go read about $TempPath cuz i had no idea where it went when it saved the .bat ^^ lol ty tho very much :)

yeh you could just add:

Send("goto start")
Sleep(10000) ;time in milliseconds to sleep for (10 secs in this case)
WinClose("Untitled - Notepad")

somewhere around there should do the trick.

$TempPath = EnvGet("temp") returns an environment variable (in this case the path to the logged in users temp folder).

You could see what path yours returns (as well as other environment variables) by opening a command prompt window and typing SET and then look for the TEMP entry

Edited by fu2m8
Link to comment
Share on other sites

oops missed that :"> :">

me too the first time I read the thread.

I liked your array. It might be a bit much for those new to AutoIt to grasp, but it sure works well in a loop.

Your use of @ScriptDir is probably better than my use of the user temp directory.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

...figure out how to speed that part up then make it go back to the speed you made it go...

try this version:
Opt("SendKeyDelay", 50)
$TempPath = EnvGet("temp")
FileDelete($TempPath & "\Matrix.bat")
MsgBox(0, "My First Attempt", "This is my first try at making a script from my own idea =D Tell me if you find anything wrong with it ^^.")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send(":Start")
Send("{Enter}")
Send("echo off")
Send("{Enter}")
Send("color 2")
Send("{Enter}")
Send("echo ")
$var = ""
For $i = 1 To 113
    $var = $var & "%random% "
Next
ClipPut($var)
Sleep(100)
Send("^v")
Send("{Enter}")
Send("goto start")
For $i = 10 To 1 Step - 1
    TrayTip("", @CR & @CR & "   " & $i & "   " & @CR & @CR, 1)
    Sleep(1000)
Next
TrayTip("", "", 1)
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "The text in the Untitled file has changed")
Send("!Y")
Send($TempPath & "\Matrix.bat")
Send("!s")
Sleep(1000)
Run($TempPath & "\Matrix.bat")
Send("!{Enter}")
Sleep(10000)
Send("^c")
Sleep(500)
Send("Y")
Send("{Enter}")
Sleep(10000)
FileDelete($TempPath & "\Matrix.bat")
I counted "random" 113 times in your code in this post http://www.autoitscript.com/forum/index.ph...st&p=242734 (Okay, MS Word counted for me.) You might want to change that down around 80 or play with 20 and see how the pattern changes for you.

Change this line For $i = 1 To 113 to For $i = 1 To 80

enjoy

[size="1"][font="Arial"].[u].[/u][/font][/size]

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