Jump to content
Sign in to follow this  
Lolita

Filecopy with relative path problem

Recommended Posts

Lolita

Hello i have another problem with autoit that i can't solve myself :)

When i start my script from folder where it is it copies file ok, but when i call it directly - ie. i call d:\$OEM$\ie7\force_ie7_reg.exe from runonceex it don't copy files and filecopy function returns filed.

How can i solve it? Do i need to use @ScriptDir? And why it work this way?

Thanks for your reply

Alse i don't know why, but winwait and winwait activate don't work correctly for me in runonceex (but it worked ok before so i think i have problem with my scripts or something autoit beta related), nevermind.

Edited by Lolita

Share this post


Link to post
Share on other sites
Jos

What are the FileCopy statements you use in your script ?

Wild guess: One thing that probably will solve your issue is add a FileChangeDir(@scriptdir) at the top of your script.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Lolita

Now it is

$sysdrive = EnvGet("SystemDrive")
MsgBox(0, "debug", "scriptdir: " & @ScriptDir)
MsgBox(0, "debug", "sysdrive: " & $sysdrive)
if FileCopy(@ScriptDir & "/../regtweaks/IE7.reg", $sysdrive & "\", 9) == 1 Then
    MsgBox(0, "debug", "copy result: " & "ie7 copy ok")
Else
    MsgBox(0, "debug", "copy result: " & "ie7 copy failed")
EndIf
Before i used
FileCopy("/../regtweaks/IE7.reg", $sysdrive & "\", 9)
... this probably use "work directory" as it's base path ...

Edited by Lolita

Share this post


Link to post
Share on other sites
TPlanet

Now it is

$sysdrive = EnvGet("SystemDrive")
MsgBox(0, "debug", "scriptdir: " & @ScriptDir)
MsgBox(0, "debug", "sysdrive: " & $sysdrive)
if FileCopy(@ScriptDir & "/../regtweaks/IE7.reg", $sysdrive & "\", 9) == 1 Then
    MsgBox(0, "debug", "copy result: " & "ie7 copy ok")
Else
    MsgBox(0, "debug", "copy result: " & "ie7 copy failed")
EndIf
Before i used
FileCopy("/../regtweaks/IE7.reg", $sysdrive & "\", 9)
... this probably use "work directory" as it's base path ...
Hi!

What does MsgBox(0, "debug", "scriptdir: " & @ScriptDir) give you? Is "/../regtweaks/IE7.reg" in this folder? You Know that @ScriptDir is the folder where the au3/.exe is?

Edited by TPlanet

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  

×