|
#1
|
||||
|
||||
|
File.Copy
Where is the error?
Can you tell me why the first five lines using File.Copy don't work? I have also attached a screen capture as well. File.Copy("Setup\\ClassicIT\\1024boats.bmp", _WindowsFolder, true, true, false, true, nil); File.Copy("Setup\\ClassicIT\\1024avon.bmp", _WindowsFolder, true, true, false, true, nil); File.Copy("Setup\\ClassicIT\\classic.exe", _WindowsFolder, true, true, false, true, nil); File.Copy("Setup\\ClassicIT\\OEM*.*", _WindowsFolder .. "\\System32\\", true, true, false, true, nil); File.Copy("Setup\\ClassicIT\\OEM*.*", _WindowsFolder .. "\\System\\", true, true, false, true, nil); File.Run("Setup\\screensav\\ClassicSCR.EXE", "", "", SW_SHOWNORMAL, true); Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run "); File.Open("Setup\\ClassicIT\\citslogo.reg", "", SW_SHOWNORMAL); File.Open("Setup\\ClassicIT\\CitsURL.reg", "", SW_SHOWNORMAL); Thanks for your help. Regards, John |
|
#2
|
||||
|
||||
|
Hi John. Setup\\ClassicIT\\1024boats.bmp isn't a valid file path because it lacks a drive assigment... I think this is the issue. I believe if you edit that to be a full file path it will work. Let me know.
![]() Corey Milner Creative Director, Indigo Rose Software |
|
#3
|
||||
|
||||
|
File.Copy
Hi Corey,
I've placed the Setup folder alongside the AutoPlay folder, rather than being in a subfolder. Thus the source path is created from the browse option within APMS5 Note that the others in that list, eg: File.Run("Setup\\screensav\\ClassicSCR.EXE", "", "", SW_SHOWNORMAL, true); works fine as a relative path. I know that this is not File.Copy but File.Run - but I can't see why the difference? The drive letter assignment for the installer has to remain relative; whether on CD or USB HDD, the default drive letter is automatically assigned by Windows. I'm sure this is a bug? Thanks for your help. John |
|
#4
|
||||
|
||||
|
HI John. OK humor me for a sec, try it with _SourceFolder instead and let me know, i.e.:
File.Copy(_SourceFolder.."Setup\\ClassicIT\\1024bo ats.bmp", _WindowsFolder, true, true, false, true, nil); I think that will work. As for the File.Run this is because that program runs on your system without full path from the start menu > run field. For example if I type "calc.exe" into my run field it runs windows calculator, I don't have to type the full path. Know what I mean? Strictly speaking you should use a full path here too BTW. As you see for both actions in the help file it says the first argument required by each function is a string containing, "The path to [...]".It's worth noting the subtle difference between File.Run (Same as typing something into Windows start menu > run field) and File.Open (Same as double clicking on the file in Windows Explorer). As for making links relative, no problem use the built in variables (listed in the help file) such as _SourceFolder or create your own custom path variables at startup... Hope that helps. ![]() Corey Milner Creative Director, Indigo Rose Software |
|
#5
|
||||
|
||||
|
Are you logged in with write access to the windows and system folders?
|
|
#6
|
||||
|
||||
|
File.Copy
Corey, no the _SourceFolder option doesn't work either.
(And yes, logged in as Administrator with write access to all files and folders. I had no problem with this in APMS4). Thanks again. John PS I've attached a screen capture of the directory structure, with the Setup folder outside of the AutoPlay folder, both of which are in the CD_ROOT folder. PPS I'm looking forward to finding out what's causing this... |
|
#7
|
||||
|
||||
|
File.Copy
Hi Corey,
What I've discovered is that the following works: File.Copy("AutoPlay\\ClassicIT\\1024boats.bmp", _WindowsFolder, true, true, false, true, nil); However, there are two things that are apparent here. The "wizard" in APMS5 automatically copies the image into "AutoPlay\\Images\\1024boats.bmp" Now for technical reasons, I don't want the image stored in APMS5's default folder, so I manually re-type in \\ClassicIT\\ again as the original folder. This works fine (incidentally without the need for _SourceFolder to be specified). However, when copying from "Setup\\ClassicIT\\1024boats.bmp", a folder also in the root directory, the File.Copy fails. I think we've found a bug in an otherwise excellent program. Cheers, John |
|
#8
|
||||
|
||||
|
Hmmm, OK, shouldn't have doubted you.
You have been extremely helpful in searching out and squashing stuff, our gratitude as always John, you're a Klass act. ![]() Corey Milner Creative Director, Indigo Rose Software |
|
#9
|
||||
|
||||
|
File.Copy behaviour
Corey/Lorne,
I've been testing the File.Copy in a variety of scenarios. The following instance works, when not accompanied by any File.Copy instances: File.Copy("Setup\\ClassicIT\\avon1024.jpg", "F:\\Temp\\aaawww\\", true, true, false, true, nil); However, this doesn't work: File.Copy("Setup\\ClassicIT\\1024*.bmp", _WindowsFolder, true, true, false, true, nil); Neither work in the case where I have multiple File.Copy instances, such as: File.Copy("Setup\\ClassicIT\\1024*.bmp", _WindowsFolder, true, true, false, true, nil); File.Copy("Setup\\ClassicIT\\1024*.bmp", "F:\\Temp\\aaawww", true, true, false, true, nil); I'm beginning to think that the issue isn't with locating the source file/folder. The difficulty is locating the _WindowsFolder and because of that when there are multiple File.Copy requests, nothing gets copied. Hope this information is helpful. Regards, John |
|
#10
|
||||
|
||||
|
John,
Thanks for all of the research and reports. I will look into this today, find the bug and terminate it. |
|
#11
|
||||
|
||||
|
John,
I fixed that bug in the code today. For now, you will need to use: File.Copy(_SourceFolder.."\\Setup\\ClassicIT\\1024 boats.bmp", _WindowsFolder, true, true, false, true, nil); Note that this differs from Corey's code by the \\ in front of Setup\\ClassicIT\\1024boats.bmp. This should work for sure. Next release you will be able to do the relative path thing with no troubles. |
|
#12
|
||||
|
||||
|
File.Copy
Thanks Brett.
Yes, this now works! Sure appreciate your looking into this. Kind regards, John |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
All times are GMT -6. The time now is 07:16 PM.









Linear Mode
