Computer Hope
Software => Computer programming => Topic started by: Ryder17z on April 13, 2009, 02:05:58 AM
-
I have tried to make an installer, but the main problem is that I need some kind of script that does this:
-> Find Path: Sims Installation Folder, searching in the registery (Example: C:\Maxis\The Sims\ - if this is the path stored in the registery)
-> Copy files and folders from:
"drive:\folder2\Sims Complete\"
into:
"drive:\folder\"
Does anyone know how to do it?
The best way to create it would be writing in VB or C++ because I don't think any other language has registery support
-
reading from registry:
----------------------
batch - use reg.exe
vbscript - regread method
wmi - StdRegProv
vb6 - access win32 API, and call Reg* API
i think a better way is to use wmi query in vbs, "select * from win32_product"
and then wsh.echo .installlocation
-
The best way to create it would be writing in VB or C++ because I don't think any other language has registery support
shouldn't make assumptions like that. modern languages like Perl/Python has support (in terms of libraries) for a lot of things (often better than VB/batch). here's an example of Perl interfacing with the windows registry.
use Win32::Registry;
my $Register = "Software\\MICROSOFT\\windows";
my $hkey;
$HKEY_LOCAL_MACHINE->Open($Register,$hkey)|| die $!;
$hkey->GetKeys(\@key_list);
print "$Register keys\n";
foreach $key (@key_list)
{
print "$key\n";
}
$hkey->Close();
output
C:\test> perl test.pl
Software\MICROSOFT\windows keys
CurrentVersion
ITStorage
-
Allright...
I have tried using the REG.exe thing but I haven't found a way to do what i want:
1. How do I get the data from this key:
"HKEY_Local_Machine\Software\Maxis\The Sims\InstallPath"
2. And tell a batch file to copy the files in folder:
"drive:\folder2\Sims Complete\"
to the path stored in the registry (specified above)
A working code would be appreciated
-
reg query "HKLM\software\maxis\the sims"
reg query "HKLM\software\maxis\the sims" /v "installpath"
post back the screen result
-
Just a question here but why are you trying to make an installer for the Sims? If you have the original disc then it should have the installer on it.
-
I have downloaded several objects to it and i want to make it easy to install
-
I have downloaded several objects to it and i want to make it easy to install
I take it this is not a legitimate copy of the Sims or at least not legitimate objects that you have downloaded. I say this because 99.9% of legitimate items already have easy ways to install.
-
he probably created special objects for the sims and wants an installer, so he doesn't have to copy the add-ons himself.
-
I have bought The Sims Complete Collection, so no illegal with it so far...
I have... ...um, let us say about 250 - 800 objects (IFF files) that comes from various sites for The Sims
And I'm trying to create an installer for them, so I don't have to install them manually
Since there exist a "InstallPath" key after you install The Sims, it would be easy if my installer uses the path which I mentioned in first post
reg query "HKLM\software\maxis\the sims"
reg query "HKLM\software\maxis\the sims" /v "installpath"
post back the screen result
I tried them, with same result: Displaying every entry and it's value in "HKLM\software\maxis\the sims\"
Here is what i get:
! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\software\maxis\the sims
SIMS_MUSIC REG_SZ d:\
SIMS_SOUND REG_SZ C:\Program\Maxis\The Sims\SoundData
SIMS_DATA REG_SZ C:\Program\Maxis\The Sims
InstallPath REG_SZ C:\Program\Maxis\The Sims
Version REG_SZ 1.2
Language REG_DWORD 0x41d
SIMS_SKU REG_DWORD 0x2
SIMS_LANGUAGE REG_SZ Swedish
EPDInstalled REG_SZ 1
EPInstalled REG_SZ 1
Installed REG_SZ 1
EP3Patch REG_SZ 2
SIMS_GAME_EDITION REG_SZ 255
TELEPORT REG_SZ 1
SIMS_CURRENT_NEIGHBORHOOD_NUM REG_SZ 2
SIMS_CURRENT_NEIGHBORHOOD_PATH REG_SZ UserData2
EP2Installed REG_SZ 1
EP3Installed REG_SZ 1
EP4Installed REG_SZ 1
EP5Installed REG_SZ 1
EP6Installed REG_SZ 1
EP7Installed REG_SZ 1
EP8Installed REG_SZ 1
EPDPatch REG_SZ 1
EP5Patch REG_SZ 1
-
@echo off & setlocal & set sim=
set q="HKLM\software\maxis\the sims" /v installpath
for /f "skip=4 tokens=2*" %%a in ('reg query %q%') do set sim=%%b
if defined sim echo copy *.iff "%sim%"
-
Thanks Reno, it works but I don't understand how :-\
It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder
How does it get that path, I mean it's not in the script or the registery ? (nothing says "GameData\UserObjects")
-
It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder
what's the one in bold?? is it actual folder name, or you need to extract the info from filename.iff??
-
It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder
what's the one in bold?? is it actual folder name, or you need to extract the info from filename.iff??
It's a folder name, but I still don't understand how the code actually copy to correct folder
-
if not defined sim goto:eof
copy "c:\pathto\iff_folder\*.iff" "%sim%\GameData\Userobjects\filename\"
it's just normal copy operation, type copy/? for help
-
Yes, but if we look at your code:
@echo off & setlocal & set sim=
set q="HKLM\software\maxis\the sims" /v installpath
for /f "skip=4 tokens=2*" %%a in ('reg query %q%') do set sim=%%b
if defined sim echo copy *.iff "%sim%"
Nothing tells it to use "The Sims\GameData\Userobjects\filename\filename.iff"
When I read your code, something tells me the path "The Sims\filename\filename.iff" would be used, which I don't get why isn't
I mean, Where does it get "GameData\UserObjects\" from?
It's not even in the script, or defined in the win registery
-
Yes, but if we look at your code:Nothing tells it to use "The Sims\GameData\Userobjects\filename\filename.iff"
I mean, Where does it get "GameData\UserObjects\" from?
It's not even in the script, or defined in the win registery
how would i know where it get the value, why dont you tell me. i am not the one who makes the sim. and i even never play the sims.
i only post code based on your description, assuming %installpath%\gamedata\userobjects\filename\ is the default folder for iff files. ( see below )
It copies "filename.iff" to "The Sims\GameData\Userobjects\filename\finename.iff" - which is the correct folder
-
How can I tell you if I don't know the answear? :P
The path in the script is different than the actual path used
/\ /\
| |
| |
"The Sims\filename.iff" |
||
||
"The Sims\GameData\Userobjects\filename\filename.iff"
I feel confused ???
-
change the path in the script to be the actual path used. ::)
-
No need to do since it works already, but it works like magic, nobody knows how, they just know it works ::)
-
set q="HKLM\software\maxis\the sims" /v installpath
this takes it from the registry.