Jump to content

Filecopy with relative path problem


Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
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...