Jump to content

Filecopy A File From The Root Doesn't Work Always


Recommended Posts

Hello all, i did a search but couldn't find the answer within 2 hours of looking so here goes:

This is a part of my installscript on the office.

First its run the setup.exe etc etc .. and this part comes:

SplashImageOn("Softros LAN Messenger","MS Antispyware Melding.jpg","277","356","-1","-1")

Sleep(7000)

SplashOff()

BlockInput(0)

MsgBox(0, "Softros LAN Messenger 3.6.3", "Muis & Toetsenbord zijn weer Geactiveerd" & @CRLF & "Druk op Allow als MS Antispyware daar om vraagt", 5)

DirCreate(@UserProfileDir & "\Application Data\Softros Messenger\")

RunWait('cscript.exe "General.vbs"')

sleep(3000)

Filecopy("Admin.ini","c:\Program Files\Softros Systems\Softros Messenger\",1)

FileCopy("Sounds\*.lic","c:\Program Files\Softros Systems\Softros Messenger\",1)

When the executable is started using a URL (\\server\share\softwarename\install.exe) on the intranet it doesn't copy admin.ini etc etc..

When people go to the directory theirselves and press the executable all files are found and being copied.

How can i change this?

Second question is related to this..

When people log in i want to push a logo.scr to their C:\windows\system32 directory.

In stead of overwriting it every time i would like to use a command like this : IF FileNotExists ("@WindowsDir\System32\logo.scr") Then Filecopy ("logo.scr","@WindowsDir\System32\*",1) EndIf

Any help is greatly appreciated

Link to comment
Share on other sites

Hello all, i did a search but couldn't find the answer within 2 hours of looking so here goes:

This is a part of my installscript on the office.

First its run the setup.exe etc etc .. and this part comes:

When the executable is started using a URL (\\server\share\softwarename\install.exe) on the intranet it doesn't copy admin.ini etc etc..

When people go to the directory theirselves and press the executable all files are found and being copied.

How can i change this?

Second question is related to this..

When people log in i want to push a logo.scr to their C:\windows\system32 directory.

In stead of overwriting it every time i would like to use a command like this : IF FileNotExists ("@WindowsDir\System32\logo.scr") Then Filecopy ("logo.scr","@WindowsDir\System32\*",1) EndIf

Any help is greatly appreciated

if you're running that script from \\server\share\softwarename\install.exe and the subsequent files (ini and what not) are not in that folder, the script will not copy them. you have to specify where those files are

$inipath = "\\Server\share\dir"; input the path of where the files to be copied reside.
SplashImageOn("Softros LAN Messenger","MS Antispyware Melding.jpg","277","356","-1","-1")
Sleep(7000)
SplashOff()

BlockInput(0)
MsgBox(0, "Softros LAN Messenger 3.6.3", "Muis & Toetsenbord zijn weer Geactiveerd" & @CRLF & "Druk op Allow als MS Antispyware daar om vraagt", 5)

DirCreate(@UserProfileDir & "\Application Data\Softros Messenger\")
RunWait('cscript.exe "General.vbs"')
sleep(3000)
Filecopy($inipath & "\Admin.ini","c:\Program Files\Softros Systems\Softros Messenger\",1)
FileCopy($inipath &  "\Sounds\*.lic","c:\Program Files\Softros Systems\Softros Messenger\",1)

For your second question, please explain what you mean by them "logging in". are they logging into windows? into the app? please be more specific. Do you want this if statement to be run outside of the install script or within it?

let me know.

hope that helps.

-blademonkey

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

When the executable is started using a URL (\\server\share\softwarename\install.exe) on the intranet it doesn't copy admin.ini etc etc..

When people go to the directory theirselves and press the executable all files are found and being copied.

How can i change this?

Add this to the top of the script will fix the startup working directory

If @WorkingDir <> @ScriptDir Then FileChangeDir(@ScriptDir)

or make the script more dependant with @ScriptDir paths.

SplashImageOn("Softros LAN Messenger","MS Antispyware Melding.jpg","277","356","-1","-1")
Sleep(7000)
SplashOff()

BlockInput(0)
MsgBox(0, "Softros LAN Messenger 3.6.3", "Muis & Toetsenbord zijn weer Geactiveerd" & @CRLF & "Druk op Allow als MS Antispyware daar om vraagt", 5)

DirCreate(@AppDataDir & "\Softros Messenger\")
RunWait('cscript.exe "General.vbs"')
sleep(3000)
Filecopy(@ScriptDir & "\Admin.ini", @ProgramFilesDir & "\Softros Systems\Softros Messenger\", 1)
FileCopy(@ScriptDir & "\Sounds\*.lic", @ProgramFilesDir & "\Softros Systems\Softros Messenger\", 1)

Second question is related to this..

When people log in i want to push a logo.scr to their C:\windows\system32 directory.

In stead of overwriting it every time i would like to use a command like this : IF FileNotExists ("@WindowsDir\System32\logo.scr") Then Filecopy ("logo.scr","@WindowsDir\System32\*",1) EndIf

Any help is greatly appreciated

If statement will conditionally copy the file over.

If Not FileExists(@SystemDir & "\logo.scr") Then
    FileCopy(@ScriptDir & "\logo.scr", @SystemDir & "\logo.scr")
EndIf

:)

Link to comment
Share on other sites

Add this to the top of the script will fix the startup working directory

If @WorkingDir <> @ScriptDir Then FileChangeDir(@ScriptDir)

or make the script more dependant with @ScriptDir paths.

DirCreate(@AppDataDir & "\Softros Messenger\")
Filecopy(@ScriptDir & "\Admin.ini", @ProgramFilesDir & "\Softros Systems\Softros Messenger\", 1)

If statement will conditionally copy the file over.

If Not FileExists(@SystemDir & "\logo.scr") Then
    FileCopy(@ScriptDir & "\logo.scr", @SystemDir & "\logo.scr")
EndIf
The executable and files are located in the same directory.. i've tried both solutions and they worked perfectly, thanks guys.

To BladeMonkey: I meant our domain login-script from the company.

But it appears that If Not FileExists actually exists and works ...dOhh, i wrote my own solution :">

I've copied the code from Mhz and this is what i was looking for.

This was my first post and the help is quick and accurate, thanks all.

Untill my next post :)

Edited by Ruigerock
Link to comment
Share on other sites

  • 2 weeks later...

I'm back

I've come across the same problem only this time it's not accessed by url but by another autoit.exe

On my work i created a script that runs multiple exe (made by autoit) one after another.

Multiple.exe

$PID = Run('Microsoft Antispyware Beta\_Microsoft Antispyware.exe')
ProcessWaitClose($PID)
$PID = Run('Softros LAN Messenger 3.6.3\Instant Messenger.exe')
ProcessWaitClose($PID) etc etc..

The past solution was to put this code into the Instant Messenger.exe : If @WorkingDir <> @ScriptDir Then FileChangeDir(@ScriptDir).

It worked great but the trick doesn't work anymore because the @scriptdir is the direcory that runs the multiple.exe instead of instant messenger.exe (i think)

Does anyone know a solution, or could explain what is going wrong with the script?

Link to comment
Share on other sites

I would normally code this something like...

$PID = Run('".\Microsoft Antispyware Beta\_Microsoft Antispyware.exe"')
ProcessWaitClose($PID)
$PID = Run('".\Softros LAN Messenger 3.6.3\Instant Messenger.exe"')
ProcessWaitClose($PID)

so try that...

I've tried your solution but it did not work. Certain files in the Softros LAN Messenger 3.6.3 directory are not copied during the installation of Instant Messenger.exe. Example:

If @WorkingDir <> @ScriptDir Then FileChangeDir(@ScriptDir)
Run setup  etc etc .. 
FileCopy("Admin.ini","c:\Program Files\Softros Systems\Softros Messenger\",1)
FileCopy("Sounds\*.lic","c:\Program Files\Softros Systems\Softros Messenger\",1)

I think it's because of the different scriptdir .. during the multiple.exe 2 autoit icons are in the systray.

You mentioned a different run method, Run('".\ instead of Run(' .. what is the difference?

Link to comment
Share on other sites

  • 1 month later...

@Larry

I rewrote all my scripts with the knowledge i gained the past few weeks and the scripts are running perfectly!

As you saw in the other topic about MS Office i used your solution to help out the multiple installation.

Thanks

The topic can be closed

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