Sign in to follow this  
Followers 0
Jango

Autoit from USB Key

3 posts in this topic

Hi,

I have made a script that starts from an USB Key and it works fine but when i start another app from this USB Key (not autoit but a third party software) i noticed it slow down entire computer.

I already have made these changes to my script:

ProcessSetPriority(@AutoItPID, 0)

also in my loop i added a 2 secs sleep:

TraySetState()
While 1
    Sleep(2000)
.
.
.
Wend

Like that it's a little bit better but always too slow ... i tried they to start my two process (my script and third party software) from the C: drive (just to test) and all is running at normal speed and the computer is not encountering any slow down but when i starts these two process from the USB key it's slow.

Anyone here can help me, give me a tips to avoid slow down ?

More, is there a way to "detach" a process (here my script) from his working directory ?

Share this post


Link to post
Share on other sites



Hi,

I have made a script that starts from an USB Key and it works fine but when i start another app from this USB Key (not autoit but a third party software) i noticed it slow down entire computer.

I already have made these changes to my script:

ProcessSetPriority(@AutoItPID, 0)

also in my loop i added a 2 secs sleep:

TraySetState()
While 1
    Sleep(2000)
.
.
.
Wend

Like that it's a little bit better but always too slow ... i tried they to start my two process (my script and third party software) from the C: drive (just to test) and all is running at normal speed and the computer is not encountering any slow down but when i starts these two process from the USB key it's slow.

Anyone here can help me, give me a tips to avoid slow down ?

More, is there a way to "detach" a process (here my script) from his working directory ?

As it seems my post have no sucess ... I have a new idea but don't know how to do it in a simple but also efficent way.

I would like to do my script that copy itself on the @TempDir (for example) then exit and restart from the @Tempdir ...

I need to know the initial drive letter of the first start of my script .. can i use environment variable ?

The most difficult is to do my script exit then restart from the C: drive ... ideas are welcome.

note that i need to keep all code in one script

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

As it seems my post have no sucess ... I have a new idea but don't know how to do it in a simple but also efficent way.

I would like to do my script that copy itself on the @TempDir (for example) then exit and restart from the @Tempdir ...

I need to know the initial drive letter of the first start of my script .. can i use environment variable ?

The most difficult is to do my script exit then restart from the C: drive ... ideas are welcome.

note that i need to keep all code in one script

Ok nevermind i found the way to do that i post the code here in case someone need it:

MsgBox(0, "Debug", EnvGet("@ScriptDir") & @CRLF & @ScriptDir & " " & @ScriptName, 10)

If StringLeft(@ScriptDir, 2) <> StringLeft(@TempDir, 2) Then
    EnvSet("@ScriptDir", @ScriptDir)
    EnvUpdate()
    FileCopy(@ScriptFullPath, @TempDir, 1)
    Run(@TempDir & "\" & @ScriptName, @TempDir)
    Exit
EndIf

Edit: code improved

but i'm not sure about the Environment variable ... anyway it works but when i look at env var in the system i cannot see it ???

Edited by Jango

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