Jump to content
Sign in to follow this  
BryanMc

Close then reopen fuction?

Recommended Posts

BryanMc

well i was wondering if anyone knows how to make a function that will close the script then reopen it... refresh u can say but in a function way.... for example: I'll have a hot key for a function... lets say the hot key is f1, when i hit f1 the script that I'm using will close then reopen itself... if that's not possible then is there a way we can make it like refresh the script? as in turn EVERY thing off that its doing (talking about the script)

any help would be great.... thanks... just need the faction part... i can set a hotkey my self

Edited by BryanMc

Share this post


Link to post
Share on other sites
BryanMc

i'm still new to scripting but can u explain this code to me?

Code below:

Func _restart()

If @Compiled = 1 Then

Run( FileGetShortName(@ScriptFullPath))

Else

Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))

EndIf

Exit

EndFunc

I have highlishted some text to red to show my point.... do i replace that in red with my script name? lets say my script is test.au3 --- how would i go about putting that into make it restart my script?

Edited by BryanMc

Share this post


Link to post
Share on other sites
somdcomputerguy

The simplicity of this snippet had me confused for awhile too. :idea: Basically, it just starts another copy of the calling script, and exits the first copy.

Nothing needs to be replaced. FileGetShortName is an AutoIt function. See Macro Reference for definitions of the three macros used.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
BryanMc

The simplicity of this snippet had me confused for awhile too. :idea: Basically, it just starts another copy of the calling script, and exits the first copy.

Nothing needs to be replaced. FileGetShortName is an AutoIt function. See Macro Reference for definitions of the three macros used.

omg thanks so much this is exatly what i was trying to do thanks

Share this post


Link to post
Share on other sites
somdcomputerguy

You bet. You know, the thread where I got that snippet from has a bunch of other useful code snippets.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  

×