Sign in to follow this  
Followers 0
Clay

Start script from a specific line

9 posts in this topic

Is it possible to start a script from a specific line in a script? I am creating the ability for my script to run, reboot the system and then continue ... but I was it to continue from a resume point. Is it possible to start script ..say at line 100 in my script file?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use functions, write a text file next to the script, if the file exists it will start of another part of the script

If FileExists("file.txt") Then
   _Func1()
Else
   _Func2()
EndIf

Func _Func1()

EndFunc

Func _Func2()

EndFunc
Edited by Vossen

Share this post


Link to post
Share on other sites

Is it possible to start a script from a specific line in a script? I am creating the ability for my script to run, reboot the system and then continue ... but I was it to continue from a resume point. Is it possible to start script ..say at line 100 in my script file?

Maybe with an ini work-around? Run first 100 lines only, if ini value "rebooted" = 0, just prior to reboot set value to 1 and after the post-reboot process is finished reset to 0...


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

Yes ... but how do you tell the script to start at line 101 ?

Share this post


Link to post
Share on other sites

Yes ... but how do you tell the script to start at line 101 ?

you dont

you tell it to start from 101 func :P


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thats kinda messy man... not sure if I want to do that. Is there any other way to do this any of you may know of? Otherwise I will just write all vitial information for a log or ini file and then upon restart kick off another script that reads this infromation and continues with the rest of the work.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

$flag_rebooted = IniRead(@ScriptDir & "\yourininame.ini", "Settings", "rebooted", 0)
if $flag_rebooted = 0 Then
    ;first 100 lines of code...
    ;at the end, just prior to reboot...
    IniWrite(@ScriptDir & "\yourininame.ini", "Settings", "rebooted", 1)
ElseIf $flag_rebooted = 1 Then
    ;rest of code to be executed after reboot
    IniWrite(@ScriptDir & "\yourininame.ini", "Settings", "rebooted", 0)
EndIf

Edited by Polyphem

This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

ahhh i see, I didn't completely understand what you were saying the first run around... I will also consider that

thanks for the input Polyphem .. and everyone else....

ps. - still share ideas if you have any

Edited by Clay

Share this post


Link to post
Share on other sites

what will happen when that another script is restarted :/ itl make one more script ( third script ) to start from on next startup :/

well this is not the perfect way to do that (well there isnt any perfect way at all if you dont use Func)

you can try something like this

$sciptstopatline = 1
If Not StringIsAlNum (ClipGet()) Then
    ClipPut("1")
Else    
    $sciptstopatline = ClipGet()
EndIf
While 1
    Select
        Case $sciptstopatline = "1"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "2"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "3"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "4"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "5"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "6"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "7"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "8"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "9"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "10"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "11"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "12"
            ClipPut($sciptstopatline)
            Sleep(1000)
        Case $sciptstopatline = "13"
            ClipPut($sciptstopatline)
            Sleep(1000)
            $sciptstopatline = "0"
    EndSelect
    $sciptstopatline = $sciptstopatline + 1
    ToolTip("Im On The "&$sciptstopatline&" ScriptLine",0,0)
WEnd

i used clpiput and clipget for testing to put data in it

if anyone there know better way now its time to tell :P


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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