View Full Version : Next Problem with copy File
NewsArchive
02-18-2012, 02:36 AM
I setup a variable called %LOCALPATH% which does have a value as you can see
in sb6.jpg
The file is installed to y:\tgpfiles and it DOES install there. It never
gets copied to f:\tgpfiles
I tried the destination as %LOCALPATH% and %LOCALPATH%\fixkits.exe
Never gets there...
What am I doing wrong?
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:37 AM
Returns Errorcode 1
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:37 AM
>
> Returns Errorcode 1
>
If it is 1 then it copied fine. Otherwise, it would be 0.
CopyFile only returns 1 if it succeeded.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363851(v=vs.85).aspx
Make sure you do not have another function after your Copy File action that
removes your copied file.
Friedrich
NewsArchive
02-18-2012, 02:38 AM
I am getting a 1, but the %LOCALPATH% has no value at the end of install
after the copy...
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:38 AM
> I am getting a 1, but the %LOCALPATH% has no value at the end of
> install after the copy...
Yes, correct. And that means the copy action succeeded. That's why it
returns 1. But in this case (path has no value) Windows copied it to the
current folder. For example, the root of C:\ or whatever the current folder
was. That is the expected behavior in Windows.
So just find the bug in your script where your %LOCALPATH% gets resetted and
you are done :)
Friedrich
NewsArchive
02-18-2012, 02:38 AM
Dan,
> I setup a variable called %LOCALPATH% which does have a value as you can
> see in sb6.jpg
> The file is installed to y:\tgpfiles and it DOES install there. It never
> gets copied to f:\tgpfiles
> I tried the destination as %LOCALPATH% and %LOCALPATH%\fixkits.exe
>
> Never gets there...
>
> What am I doing wrong?
Unfortunately, I can't tell you what you are doing wrong.
If the file never gets there then the CopyFile Windows API fails. It only
fails if 1) the source file does not exist or is not accessible -or- 2) the
target destination does not exist or is not writable.
So it's either 1) or 2) or both <g> Check the %_SB_ERRORCODE% value (e.g.
using "Display Message Box"). It should return "1".
BTW, do not test this in installer TEST mode because the copy action is not
executed in TEST mode.
Friedrich
NewsArchive
02-18-2012, 02:39 AM
Installing in Run Mode
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:39 AM
Friedrich
%LOCALPATH% = f:\tgpfiles displays in a message box at beginning of install,
but shows nothing when I display it
in a message box after trying to copy the file.. Therein is the problem.
Somehow %LOCALPATH% is being blanked
along the way...
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:39 AM
Dan,
> %LOCALPATH% = f:\tgpfiles displays in a message box at beginning of
> install, but shows nothing when I display it
> in a message box after trying to copy the file.. Therein is the problem.
> Somehow %LOCALPATH% is being blanked
> along the way...
If %LOCALPATH% displays the correct value at the beginning but is blank
before or after trying to copy the file then you "reset" the value in the
script between the first message box and the last one.
I think you mentioned that you read %LOCALPATH% from the registry. This
function might fail. Just search for %LOCALPATH% in your script and find
all instances where you set the value for it. There you will find your bug.
And make sure that you do not read (set) the value for %LOCALPATH% (e.g.
using a Get Registry action) and later, reset it because you try to
"re-initialize" %LOCALPATH%.
Friedrich
NewsArchive
02-18-2012, 02:40 AM
I don't see anywhere that I reset it to ''''
Can I send you the script and have your trained I's look at it?
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:40 AM
Dan,
> I don't see anywhere that I reset it to ''''
> Can I send you the script and have your trained I's look at it?
Yes, please send it to me (but within the next two minutes please) because I
am on my way home <g>. Otherwise, I'll check it tomorrow. I think you
reset it with a Get Registry action.
Friedrich
NewsArchive
02-18-2012, 02:40 AM
Sent to
Support
at
lindersoft
dotycom
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:41 AM
Hi Dan,
Okay, here we go. You set the value for %LOCALPATH% in the following lines:
In Line 36:
Set Variable %LOCALPATH% to ""
In Line 47:
Set Variable %LOCALPATH% to FUNCTION:Get Registry Key Value("LocalPath")
from "HKEY_LOCAL_MACHINE\SOFTWARE\GaragePartner"
In Line 147:
Set Variable %LOCALPATH% to ""
In Line 407:
Copy File(s) from "%_SB_INSTALLDIR%\fixkits.exe" to
"%LOCALPATH%\fixkits.exe"
As you can see, your problem is Line 147 because you reste the value ;-)
I don't know why you did this, but you have moved all your wizard stuff
before the [ Initialize Setup ] section. You even moved the Final Dialog
stuff before the [ Initialize Setup ], then recreated it later at the end of
the install.
I tried to copy some items back for you.
Friedrich
NewsArchive
02-18-2012, 02:41 AM
How about because I don't know what the hell I am doing <g>
--
Dan Scott
C55 - C6.3 Legacy
Garage Partner Pro / Invoice Partner
www.garagepartner.com
Plan A is always more effective when the device you are working on
understands that Plan B involves a larger hammer
NewsArchive
02-18-2012, 02:41 AM
Hi Dan,
One thing is absolutely certain, you're always good for a laugh!
Ben E. Brady
NewsArchive
02-18-2012, 02:42 AM
Join the club!
Jeff Slarve
www.jssoftware.com
www.twitter.com/jslarve
This post may self-destruct at any moment
NewsArchive
02-23-2012, 05:33 AM
Ditto.
J André Labuschagné
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.