Jump to content

Script running script.


Recommended Posts

Is i possible to "read" a text file etc.. then parse it like a au3 script then run it as the script.

I'm thinking of writing a script witch writes itself.

A quick example on what i mean.

While 1
    $scriptlines = _FileCountLines('some.file')
    For $x = 1 To $scriptlines
        EXECUTE LINE HERE
    Next
WEnd

I would explain more if i could but i cant find the right words for it :whistle:

All help appreciated :lmao:

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

well i made somewhat what i needed, not fast when using a script witch run inn under 500ms, will then use about 500ms extra to execute it again script.

use this to test:

c:\somesctipt.txt >> ToolTip("Testing...", 0, 0)

c:\somesctipt.txt >> Sleep(500)

#include <misc.au3>
#include <file.au3>
#include <Process.au3>
Dim $innputfile = "C:\somescript.txt", $outputfile = "tempscript.au3", $outputpath = 'c:\', $line
Opt("RunErrorsFatal", 0)  

While 1
    
    $scriptlines = _FileCountLines($innputfile)
    If FileExists($outputpath&$outputfile) Then FileDelete($outputpath&$outputfile)
    For $x = 0 To $scriptlines
        $line = FileReadLine($innputfile,$x)
        FileWriteLine($outputpath&$outputfile,$line)
    Next    
    
    _FileWriteToLine($outputpath&$outputfile, 1, '#include "Misc.au3"'&@CRLF& _
                                                  'If _Singleton("tempscript\tempscript",1) = 0 Then'&@CRLF& _
                                                  ' Exit'&@CRLF& _
                                                  'EndIf'&@CRLF& _
                                                  '#NoTrayIcon', 0)
    
    _RunDos($outputpath&$outputfile)
    
WEnd

Basically what i want to do is creating a script where the loop is not inn the script itself, then im able to do changes on the fly, even when script is running :whistle: (next loop is more correct)

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

From the help file for EXECUTE:

Remarks

Environment, Files, Dir, Disk, GUI, InputBox, MsgBox, Misc, Network, Obj/COM, Process, Registry, Tray, WinKill functions implying deletion or modification will not be executed. They will set @error to 9999 and return "".

Given the many limitations on what can be done that way, what's the point? Just put your function in a UDF and call it. What do you gain?

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...