Sign in to follow this  
Followers 0
shornw

V3 newbie

9 posts in this topic

Help, I need to copy a file from a server to the temp dir on users workstation, no problem so far...file copies OK.

when I try and run it I get a 'Cannot find file' error. This is the script line it fails on:

$temp = EnvGet("temp")

FileCopy ("\\server\download$\filename.exe", $temp)

RunWait ("filename.exe.",$temp) :)

I'm totally new to V3 so please be gentle.

Thanks for any help anyone can give


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites



Welcome shornw,

Specify a path to the file as $temp would not be your working directory.

$temp = EnvGet("temp")
FileCopy ("\\server\download$\filename.exe", $temp)
RunWait ($temp & "\filename.exe.",$temp)

Share this post


Link to post
Share on other sites

Try removing the $ from

FileCopy ("\\server\download$\filename.exe", $temp)

I know downlaod is a shared folder but you do not need to access it this way. You can leave out the $ and it should work.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Thanks for super -fast replies guys....

MHz...I will try this as soon as possible and keep you posted...even better would be to get it to run from the remote location (ie download$) but I cant seem to get that to happen...?????

I dont know if its related but if I try and run the file from a folder other than Windows (ie C:\Temp) I get an error message that says 'The parameter is incorrect'. Unfortunately there is only 1 partition. I have admin rights and the folder permissions are wide open. I have tried running it from mapped drive but to no avail. If I copy it to C:\windows it runs fine so perhaps the %path% is the problem. I cannot use the window folder as users dont have rights to save a file there. Its just about starting to do my head in now!!!

Don N...Thanks for that...I should have clarified that the remote location is a hidden server share so has to be pathed with $, nothing to do with AutoIt variables.


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

Not sure if this is possible but this could work for running it on the remote directory without putting the script in that remote directory.

Can you jsut FileChangeDir( REMOTE DIRECTORY )

Then RunAsSet ( ["user", "domain", "password" [, options]] )

This should run the file on the remote directory because you changed the working dir to the remote dir.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks for super -fast replies guys....

MHz...I will try this as soon as possible and keep you posted...even better would be to get it to run from the remote location (ie download$) but I cant seem to get that to happen...?????

I dont know if its related but if I try and run the file from a folder other than Windows (ie C:\Temp) I get an error message that says 'The parameter is incorrect'. Unfortunately there is only 1 partition. I have admin rights and the folder permissions are wide open. I have tried running it from mapped drive but to no avail. If I copy it to C:\windows it runs fine so perhaps the %path% is the problem. I cannot use the window folder as users dont have rights to save a file there. Its just about starting to do my head in now!!!

Don N...Thanks for that...I should have clarified that the remote location is a hidden server share so has to be pathed with $, nothing to do with AutoIt variables.

%Path% won't work.

Try

FileCopy ("\\server\download$\filename.exe", @TempDir)
RunWait (@TempDir & "\filename.exe.",@TempDir)
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

MHz...I will try this as soon as possible and keep you posted...even better would be to get it to run from the remote location (ie download$) but I cant seem to get that to happen...?????

This requires the latest AutoIt Beta for restarting the compiled exe using "/AutoIt3ExecuteScript". This may work for you. Fill in the RunAsSet details to try it.

RunWait("\\server\download$\filename.exe", "\\server\download$")

Func OnAutoItStart()
    If $CMDLINE[0] And $CMDLINE[1] <> '/admin' Then
        RunAsSet('user', 'domain', 'password')
        Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /admin')
        RunAsSet()
        Exit
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

Thanks everybody, really appreciate your help...

as it happens I sorted it a different way, I'm not a programmer and never will be lol

looking at the Run command solved my 'wont run remotely' issue....simply enter the full working path in the filename part of the command ie

RunWait( "\\servershare\filename")

I was following the RunWait help ie

RunWait("filename", "\\servershare")

I said I'll never be a programmer, serves me right for following instruction blindly and not thinking about it ....for a while :)

Havent really found resolution as to why the .exe wont run from a folder on the root of C: though, it's not a problem in this instance any more but puzzles the heck out of me. I'm sure its gonna rear its ugly head again.

Thanks again to all of you who took time to respond


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

Havent really found resolution as to why the .exe wont run from a folder on the root of C: though, it's not a problem in this instance any more but puzzles the heck out of me. I'm sure its gonna rear its ugly head again.

Thanks again to all of you who took time to respond

It's the same problem you had before. Set the path,

RunWait("C:\myfile.exe")

otherwise it will try to run it from the current folder which is most likely your desktop.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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