jadtunrau Posted June 9, 2010 Author Posted June 9, 2010 Yes, need both the true and false at end.Did you copy and paste it in to the Config Wizard or your config.js?What does the install log file say?Are you on a 32bit system or 64bit? Set it accordingly.Yes, I copied it into the Config Wizard. The install log says it failed. I'm using a 32bit system. I don't understand why it's not working...
DJPro Posted June 11, 2010 Posted June 11, 2010 (edited) @ jadtunrauI had the same issue and made a workaround.If you have to copy a file (for example 'password.bin') after installing a program you can make a batch file like this and call it for instance 'copy.cmd'CMDOW @ /HIDIF EXIST "%programfiles(x86)%" GOTO :X64xcopy ".\Password\*.*" "%programfiles%\Foldername" /Y /iGOTO :END:X64xcopy ".\Password\*.*" "%programfiles(x86)%\Foldername" /Y /i:ENDEXITIn the directory from where the program runs make a folder "Password" where you put 'password.bin' (or even more files)If you run the script the file 'password.bin' will be copied in the right Program Files folder - 32 or 64 bit and you don't need to make 2 entries.The only issue I had was that a .cmd file was not executed in WPI ,Example: cmds[pn]=['%root%\\install\\progs\\SOMEPROGRAMFOLDER\\copy.cmd'];So I decided to make an exe from the cmd file (with winrar for example) and then everything went good.So with the command : cmds[pn]=['%root%\\install\\progs\\SOMEPROGRAMFOLDER\\copy.exe']; everything went fine.I use '%root%\\install\\etc but it can also be '%wpipath%\\install\\etc (depends where you program exe files are stored)I hope this can help you a bit and is an answer to your question.And maybe Kel can tell me why my batch files don't run but exe files will.Kind Regards , DJPro Edited June 11, 2010 by DJPro
mritter Posted June 11, 2010 Posted June 11, 2010 Post the log file results of the batch file you are trying to execute. I think I know what it may be.
DJPro Posted June 11, 2010 Posted June 11, 2010 Post the log file results of the batch file you are trying to execute. I think I know what it may be.Hi mritter,Thx for replying, I just did an install from my network share and everything went fine.At least the cmd file was executed (the log file was succesfull)1 Items, 2 Commands-----vrijdag 11 juni 2010 23:28:11 Program: AutoIt v3 Uniek ID: AUTOITV3 Volgorde: 000211 Categorie: Personal Tools vrijdag 11 juni 2010 23:28:17 - cmd1 Success (returned code 0): Z:\install\progs\AutoIt3\autoit-v3-setup.exe /S vrijdag 11 juni 2010 23:28:18 - cmd2 Success (returned code 4): "cmd.exe" /C Z:\install\progs\AutoIt3\copy.cmd vrijdag 11 juni 2010 23:28:18 - Finished installation.-----Number of failed installations: 0Install process finished at: vrijdag 11 juni 2010 23:28:19Although, the script was run but nothing has been copied, the script I use was:CMDOW @ /HIDmkdir "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler"xcopy "Improved Decompiler\*.*" "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler" /YEXITStrange thing is that when I make an exe file from my script the files are copied well. (files inside the map 'Improved Decompiler') example here.Am I missing something, I would like to hear it.Thx in advance, DJPro
mritter Posted June 12, 2010 Posted June 12, 2010 Awhile back I updated the code to use the correct 32/64bit cmd.exe and I think it is not quite right. I will do some testing and see what's up. Be expecting a beta copy from me via personnal message on here.
mritter Posted June 12, 2010 Posted June 12, 2010 (edited) I did a quick test with this .cmd file:CMDOW @ /HIDIF EXIST "%programfiles(x86)%" GOTO :X64xcopy "C:\WPI\ChangeLog.txt" "C:\" /Y /iGOTO :END:X64xcopy "C:\WPI\wpi.xml" "C:\" /Y /i:ENDEXITThis is my logfile snippet:Saturday, June 12, 2010 6:48:36 PM Program: Test Copy Unique ID: TESTCOPY Order: 900040 Category: Applications Saturday, June 12, 2010 6:48:36 PM - cmd1 Success (returned code 0): "cmd.exe" /C "C:\WPI\Install\TestScript.cmd" Saturday, June 12, 2010 6:48:37 PM - Finished installation.My file is in quotes, yours is not. Add quotes and see what happens.Also, try not using %systemdrive%, use C:\ just to check if variables are honored. Edited June 13, 2010 by mritter
DJPro Posted June 13, 2010 Posted June 13, 2010 Hello mritter,I tested it with your script and indeed everything went fine.First I used this scriptCMDOW @ /HIDmkdir "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler"xcopy "Improved Decompiler\*.*" "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler" /YEXITand nothing was copied to the 'Improved Decompiler' folderThen I changed it to this scriptCMDOW @ /HIDmkdir "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler"xcopy "Z:\install\progs\AutoIt3\Improved Decompiler\*.*" "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoIt v3\Improved Decompiler" /YEXITand the files were copied to the 'Improved Decompiler' folder (Z:\ drive is the network share)The logfile gave me thiszondag 13 juni 2010 3:08:01 Program: AutoIt v3 Uniek ID: AUTOITV3 Volgorde: 000211 Categorie: Personal Tools zondag 13 juni 2010 3:08:07 - cmd1 Success (returned code 0): Z:\install\progs\AutoIt3\autoit-v3-setup.exe /S zondag 13 juni 2010 3:08:08 - cmd2 Success (returned code 0): "cmd.exe" /C Z:\install\progs\AutoIt3\copy.cmd zondag 13 juni 2010 3:08:08 - Finished installation.Before I got a returned code 4 and now it gave returned code 0The only thing I see is that there are no quotes in logfile on cmd2 part Z:\install\progs\AutoIt3\copy.cmdWhile you have qoutes there "C:\WPI\Install\TestScript.cmd"I don't know if this is important or not, although everything was fine.Only issue I see or think is that the mounted network drive has to be Z:\ if I use that variableThx again, DJPro
mritter Posted June 13, 2010 Posted June 13, 2010 Yeah, if you don't specify the full path it won't work. It will think you mean the current directory you are in, which would be WPI's folder, or C:\. In your case the quotes wouldn't really matter since there are no spaces in the path.
jadtunrau Posted June 14, 2010 Author Posted June 14, 2010 Ok, with the help from all of you, I think I've got it working. I'm using DJPro's script:CMDOW @ /HIDIF EXIST "%programfiles(x86)%" GOTO :X64xcopy ".\password\*.*" "%programfiles%\foldername" /Y /iGOTO :END:X64xcopy ".\password\*.*" "%programfiles(x86)%\foldername" /Y /i:ENDEXITWhat I can't seem to figure out is how to execute an installer using this same method. I have a 32bit and 64bit installer for Winrar, and the below commands within WPI don't work:{JSCRIPT}=(if getBits()==32) "%wpipath%\Install\Compression\WinRarx32.exe" /s{JSCRIPT}=(if getBits()==64) "%wpipath%\Install\Compression\WinRarx64.exe" /sI would prefer to have a single check box for both, so I don't have two for each program I have in WPI. But since the JSCRIPT option doesnt seem to work, can I use the a cmd script to install? I've tried the following without success:CMDOW @ /HIDIF EXIST "%programfiles(x86)%" GOTO :X64".\WinRarx32.exe"GOTO :END:X64".\WinRarx64.exe":ENDEXIT
mritter Posted June 14, 2010 Posted June 14, 2010 You HAVE to use RunCmd() for everything.{JSCRIPT}=if (getBits()==32) RunCmd('%wpipath%\Install\CCleaner.exe /s',false,true)
jadtunrau Posted June 14, 2010 Author Posted June 14, 2010 You HAVE to use RunCmd() for everything.{JSCRIPT}=if (getBits()==32) RunCmd('%wpipath%\Install\CCleaner.exe /s',false,true)Ok, I'll give that a go. Thanks!
DJPro Posted June 14, 2010 Posted June 14, 2010 (edited) @jadtunrauI've tested it with mritter's example and it worked.So with a single check box for both x86 and x64Example for winrar installation:In my config.js a have:cmds[pn]=['{JSCRIPT}=if (getBits()==32) RunCmd(\'%root%\\Install\\Progs\\Winrar\\Winrar-x32-371nl.exe\'%comma%false%comma%true)','{JSCRIPT}=if (getBits()==64) RunCmd(\'%root%\\Install\\Progs\\Winrar\\Winrar-x64-390nl.exe\'%comma%false%comma%true)'];For 32 bit operating system it installed 'Winrar-x32-371nl' and for 64 bit 'Winrar-x64-390nl'.Only thing I noticed that there were 2 command lines in installer window ( command 1 = success , command 2 = succes)Maybe this is normal, I think?My logfile gave me this:dinsdag 15 juni 2010 0:04:22 Program: Winrar 3.7.1 Uniek ID: WINRAR32 Volgorde: 000230 Categorie: Utilities dinsdag 15 juni 2010 0:04:23 - cmd1 Success (returned code undefined): if (getBits()==32) RunCmd('Z:\Install\Progs\Winrar\Winrar-x32-371nl.exe',false,true) dinsdag 15 juni 2010 0:04:32 - cmd2 Success (returned code 0): if (getBits()==64) RunCmd('Z:\Install\Progs\Winrar\Winrar-x64-390nl.exe',false,true) dinsdag 15 juni 2010 0:04:33 - Finished installation.(Installation on x64 system.)Thanks for this code mritter !!!Greetz, DJPro Edited June 14, 2010 by DJPro
mritter Posted June 14, 2010 Posted June 14, 2010 Yes, there is an entry for every one you made. WPI can't differeniate that you are doing a 32/64bit test. So one will always fail, one will succeed.Good to hear you got it all working.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now