WW Portable

To load WW to a USB stick so I can take it with me I run this script:

!PortableBuilder.cmd[code]@title Create or update a Portable WW system
@echo off
setlocal

set WW=…
set MyFiles=
set Portable=
::set Portable=WW_Test_Folder
::set Portable=I:\PortableApps"Weather Watcher Portable"\App
::set Portable=G:\Documents"Weather Watcher Portable"
:: Change the above sets to meet your needs.

:: NB Folder names including spaces/blanks must be enclosed in quotes. See examples above.

if %Portable%!==! (
echo.
echo 1. WW_Test_Folder
echo 2. G:\Documents"Weather Watcher Portable"
echo 3. I:\PortableApps"Weather Watcher Portable"\App
echo.
set /p Portable= Enter 1 - 3 or a valid folder name to write Portable WW to or Q to Exit: )
if /I %Portable%! EQU Q! exit
if /I %Portable%! EQU 1! set Portable=WW_Test_Folder
if /I %Portable%! EQU 2! set Portable=G:\Documents"Weather Watcher Portable"
if /I %Portable%! EQU 3! set Portable=I:\PortableApps"Weather Watcher Portable"\App
set Key=Y
if not exist %Portable%\ (
echo.
echo %Portable% not found
set Key=
set /p Key=Enter Y to create %Portable%, Q to Exit: )
if /I %Key%! EQU Q! exit
if /I %Key%! NEQ Y! goto END

:WWBASE
echo.
echo Updating %Portable%
echo.
xcopy %WW%ww.exe %Portable%\ /y
xcopy %WW%dl.exe %Portable%\ /y
xcopy %WW%GetFile.exe %Portable%\ /y
::xcopy %WW%WWInstaller.exe %Portable%\ /y
::xcopy %WW%.ww? %Portable%\ /y
xcopy %WW%
.ww %Portable%\ /y
xcopy %WW%.gif %Portable%\ /y
xcopy %WW%
.chm %Portable%\ /y
xcopy %WW%*.wtp %Portable%\ /y

xcopy %MyFiles%!wwPortable.cmd %Portable%\ /y
if exist %MyFiles%Default.ini (
xcopy %MyFiles%Default.ini %Portable%\ /y)

xcopy “%AppData%\WeatherWatcher”*.cmb %Portable%\Users\Default\ /y
xcopy “%AppData%\WeatherWatcher”*.wtp %Portable%\Users\Default\ /y
xcopy “%AppData%\WeatherWatcher”*.ww %Portable%\Users\Default\ /y
xcopy “%AppData%\WeatherWatcher”*.html %Portable%\Users\Default\ /y

echo.
set Key=
set /p Key=Enter Y to build/update Skins folder, Q to Exit:
if /I “%Key%” EQU “Q” exit
if /I “%Key%” NEQ “Y” goto TESTBUILD

:SKINS
xcopy %WW%Skins*.* %Portable%\Users\Default\Skins\ /y
xcopy %WW%Skins\ToolTip*.* %Portable%\Users\Default\Skins\ToolTip\ /s /y
::rd %Portable%\Users\Default\Skins\ToolTip\Classic /s /q

call :SKINS Icons “Eds”
call :SKINS Icons “Eds Shiny”
call :SKINS Icons “NY Times”
call :SKINS Icons “SFGate”
call :SKINS Interface “Eds Classic”
call :SKINS Interface “Eds Classic EyeCandy”
call :SKINS Interface “Eds EyeCandy”
call :SKINS Interface “Eds Mini”
call :SKINS Interface “Eds Mini Tronnix”
call :SKINS Interface “Eds Mini Xt”
call :SKINS Forecasts “Eds Classic”
call :SKINS Forecasts “Eds Splendid Mini”

:TESTBUILD
echo.
echo Portable WW folder loaded.
set /p Key=Enter N to bypass test of Portable WW, Q to quit:
if /I “%Key%” EQU “Q” exit
if /I “%Key%” EQU “N” goto EOJ
start /min %Portable%\ww.exe -id

:EOJ
echo.
set Key=""
set /p Key=Enter Y to Delete %Portable% folder, Q to quit:
if /I “%Key%” EQU “Q” exit
if /I “%Key%” NEQ “Y” exit
rd %Portable% /s /q

:END
endlocal
exit

:SKINS
xcopy %WW%Skins%1%2*.* %Portable%\Users\Default\Skins%1%2\ /s /y

[/code][size=2]Updated 6/01 - eliminated the ww2 Maps and WWinstaller from WWBASE
Updated 6/07 - added a menu for 3 fixed paths
[/size]
Obviously the Skins selections can be changed to meet the desires of others. (But why would you? :lol: )

!WWPortable.cmd@title Starting Weather Watcher Portable @start /min ww.exe -id
I keep both scripts in a folder named My Files in the WW install folder. If you locate them differently you need to change the SET commands.

Once loaded to the USB device start WW by dbl clicking on the !WWPortable.cmd.

Depending on what else you have on the USB device you can add the !WWPortable.cmd file to a menu for easier access or even automatic starting. I find PStart to be VERY easy to work with. PortableApps is ok if you can get around the each EXE equals a menu item problem. I used a utility named Bat2Exe to compile the simple bat file below to an EXE file, which some AVs flag as a virus, but it works for me. And according to this link http://portableapps.com/node/13754 AutoIt and AutoHotKey scripts are also a possibility.

Bat2ExeInput.bat@echo off&title Starting Weather Watcher&Mode CON Lines=3 COLS=25 rem A quick & dirty way to set a environmental variable to a drive letter. set MyUSB= echo @set MyUSB=%%3:> Volume.cmd dir *.cmd | find "Volume" > temp.cmd call temp.cmd del temp.cmd del Volume.cmd START /MIN %MyUSB%\"PortableApps\Weather Watcher Portable\App\ww.exe" -id

Hope this helps.

BTW I’m not sure I need to copy the Maps.ww2 file to the device but I do. I also have no idea what WWInstaller would do with WWS files if executed from the USB device but I include that also. :-s

N.B. Newer version below.

Would it be prudent to modify the script to ask the user what the drive value is so that the user does not have to manually edit the script each time?

ask added sir. :icon_smile:

IMO For testing ask can be useful but for the longer USB paths I think embedding the name in the script is easier, especially if it will remain fixed over time.

ask expanded to include support for a menu of fixed paths, which can of course be customized to meet a user’s needs. :icon_smile:

-Update-

BTW This concept can be used to run additional copies of WW should you desire to track the temp in multiple locations simultaneously.

Added U3 build support. (U3 - http://software.u3.com/interstitial.aspx)

!PortableBuilder.cmd

[code]@title Create or update a Portable WW system
@echo off
setlocal

set U3=N
set WW=C:“Program Files\Weather Watcher”
set MyFiles=
set Portable=
::set Portable=WW_Test_Folder
::set Portable=I:\PortableApps"Weather Watcher Portable"\App
::set Portable=G:\Documents"Weather Watcher Portable"
:: Change the above sets to meet your needs.

:: NB Folder names including spaces/blanks must be enclosed in quotes. See examples above.

:MENU
set Key=
if %Portable%!==! (
cls
echo.
echo WW Portable Build folder selection menu
echo.
echo 1. WW_Test_Folder - HD
echo 2. G:\Documents"Weather Watcher Portable" - U3 drive
echo 3. I:\PortableApps"Weather Watcher Portable"\App - FingerPrint drive
echo 4. U3P\host - U3 app - static
echo 5. U3P\device - U3 app - flexible
echo.
set /p Key= Enter 1 - 5 or a valid folder name to write Portable WW to or Q to Exit: )
if /I %Key%! EQU Q! exit
if /I %Key%! EQU 1! set Portable=WW_Test_Folder
if /I %Key%! EQU 2! set Portable=G:\Documents"Weather Watcher Portable"
if /I %Key%! EQU 3! set Portable=I:\PortableApps"Weather Watcher Portable"\App
if /I %Key%! EQU 4! set U3=host
if /I %Key%! EQU 4! set Portable=U3P\host
if /I %Key%! EQU 5! set U3=device
if /I %Key%! EQU 5! set Portable=U3P\device
if /I %Key%! GEQ 6! goto MENU

set Key=Y
if not exist %Portable%\ (
echo.
echo %Portable% not found
set Key=
set /p Key=Enter Y to create %Portable%, Q to Exit: )
if /I %Key%! EQU Q! exit
if /I %Key%! NEQ Y! goto END

:WWBASE
if not exist %Portable%\ww.exe goto BUILDBASE
echo.
echo Current %Portable% files
for /F “delims=> tokens=1” %%i in (‘dir %Portable%*.exe /OD’) do (
if “%%i” gtr " Z" echo %%i )
echo.
for /F “delims=> tokens=1” %%i in (‘dir %Portable%\Users\Default*.ww? /OD’) do (
if “%%i” gtr " Z" echo %%i )

:BUILDBASE
echo.
echo Building/Updating %Portable%\ folder
echo.
xcopy %WW%ww.exe %Portable%\ /y
xcopy %WW%dl.exe %Portable%\ /y
xcopy %WW%GetFile.exe %Portable%\ /y
::xcopy %WW%WWInstaller.exe %Portable%\ /y
::xcopy %WW%.ww? %Portable%\ /y
xcopy %WW%
.ww %Portable%\ /y
xcopy %WW%.gif %Portable%\ /y
xcopy %WW%
.chm %Portable%\ /y
xcopy %WW%*.wtp %Portable%\ /y

xcopy %MyFiles%!wwPortable.cmd %Portable%\ /y
if exist %WW%Default.ini (
If not exist %Portable%\Default.ini (
xcopy %WW%Default.ini %Portable%\ /y))

xcopy “%AppData%\WeatherWatcher”*.cmb %Portable%\Users\Default\ /y
xcopy “%AppData%\WeatherWatcher”*.wtp %Portable%\Users\Default\ /y
xcopy “%AppData%\WeatherWatcher”*.ww %Portable%\Users\Default\ /y
xcopy “%AppData%\WeatherWatcher”*.html %Portable%\Users\Default\ /y

if not exist %Portable%\Users\Default\Skins*.* goto SKINS
echo.
set Key=
set /p Key=Enter Y to build/update Skins folder, Q to Exit:
if /I “%Key%” EQU “Q” exit
if /I “%Key%” NEQ “Y” goto TESTBUILD

:SKINS
echo.
xcopy “%AppData%\WeatherWatcher”\Skins*.* %Portable%\Users\Default\Skins\ /y > nul
call :SKINS Icons “Eds”
call :SKINS Icons “Eds Shiny”
call :SKINS Icons “NY Times”
call :SKINS Icons “SFGate”
call :SKINS Tooltip “Eds Classic”
call :SKINS Tooltip “Eds Classic - Wm plus 6 items”
call :SKINS Tooltip “Eds Classic - Wm plus 8 items”
call :SKINS Interface “Eds Classic”
call :SKINS Interface “Eds Classic EyeCandy”
call :SKINS Interface “Eds EyeCandy”
call :SKINS Interface “Eds Mini”
call :SKINS Interface “Eds Mini Tronnix”
call :SKINS Interface “Eds Mini Xt”
call :SKINS Forecasts “Eds Classic”
call :SKINS Forecasts “Eds Classic XL”
call :SKINS Forecasts “Eds Splendid Mini”
:: Add, delete and modify the above calls to select the
:: skins you prefer to include in your USB version.

:CONFIGBUILD
if not exist %Portable%\Default.ini (
echo.
echo Config WW Portable
start /wait /min %Portable%\ww.exe -id
goto TEST4U3)

:TESTBUILD
echo.
echo Portable WW folder loaded.
echo.
set /p Key=Enter N to bypass test of Portable WW, Q to quit:
if /I “%Key%” EQU “Q” exit
if /I “%Key%” EQU “N” goto TEST4U3
echo Build will continue after test ends.
start /wait /min %Portable%\ww.exe -id

:TEST4U3
if “%U3%” EQU “N” goto EOJ
echo.
echo Building U3P file
cd U3P
if exist wwp.u3p del wwp.u3p
if “%U3%” equ “host” (
xcopy manifest%U3%.u3i manifest\manifest.u3i /y
xcopy U3Action.exe %U3%\ /y
rd device /s /q
md device )
if “%U3%” equ “device” (
xcopy manifest%U3%.u3i manifest\manifest.u3i /y
xcopy U3Action.exe %U3%\ /y
rd host /s /q
md host )
c:“Program Files”\7-Zip\7z a -tzip wwp.u3p -ir!host\ > nul
c:“Program Files”\7-Zip\7z a -tzip wwp.u3p -ir!device\ > nul
c:“Program Files”\7-Zip\7z a -tzip wwp.u3p -i!manifest\
echo.

echo wwp.u3p ready to be installed
cd …

:EOJ
echo.
set Key=""
set /p Key=Enter Y to Delete %Portable% folder, Q to quit:
if /I “%Key%” EQU “Q” exit
if /I “%Key%” NEQ “Y” goto END
rd %Portable% /s /q

:END
endlocal
echo.
echo !PortableBuild finished
pause > nul
exit

:SKINS
echo Building %1%2\ Skins folder
xcopy “%AppData%\WeatherWatcher”\Skins%1%2*.* %Portable%\Users\Default\Skins%1%2\ /s /y > nul

[/code][size=2]Updated 8/28 - tweaked the MENU code.
Updated 8/31 - revamped the U3 code.
Updated 10/16 - tweaked the U3 code.
[/size]

The U3P folder contains 3 files; U3Active.exe, manifesthost.u3i and manifestdevice.u3i together with 3 subfolders; host, manifest and device. (U3Active.exe can be downloaded from here: http://www.u3.com/developers/downloads/tools.aspx)

The device and host folders start off empty. The !PortableBuilder script will load Portable WW into one of them based on which menu option you choose.

In the manifest folder is the WeatherWatcher.ico. The !PortableBuilder script will add one of the following manifest.u3i files to it based on which menu option you choose. Note the u3i files are text files in XML format.

ManifestHost.u3i

<?xml version="1.0"?> <u3manifest version="1.0"> <application uuid="57656174-6865-7220-5761-746368657200" version="1.6.0.0"> <icon>WeatherWatcher.ico</icon> <name>Weather Watcher</name> <description>Weather Watcher configured for portable use on U3 by EdP</description> <shortDescription>Weather Watcher Portable by EdP</shortDescription> <vendor>Singer's Creations</vendor> <options> <minFreeSpace>24</minFreeSpace> <upgrade appData="add" deviceExec="remove" /> </options> <i18n /> </application> <actions> <!-- Static version of WW - runs from the host like a standard U3 app --> <hostCleanUp cmd="%U3_HOST_EXEC_PATH%\U3Action.exe">-hostCleanUp</hostCleanUp> <appStop cmd="%U3_HOST_EXEC_PATH%\U3Action.exe">-appStop -MaxStops 999</appStop> <appStart cmd="%U3_HOST_EXEC_PATH%\U3Action.exe">-appStart \"%U3_HOST_EXEC_PATH%\ww.exe\" -id </appStart> </actions> </u3manifest>

ManifestDevice.u3i

<?xml version="1.0"?> <u3manifest version="1.0"> <application uuid="57656174-6865-7220-5761-746368657200" version="1.6.0.0"> <icon>WeatherWatcher.ico</icon> <name>Weather Watcher</name> <description>Weather Watcher configured for portable use on U3 by EdP</description> <shortDescription>Weather Watcher Portable by EdP</shortDescription> <vendor>Singer's Creations</vendor> <options> <minFreeSpace>3</minFreeSpace> <upgrade appData="add" deviceExec="remove" /> </options> <i18n /> </application> <actions> <!-- Maintainable version of WW - runs totally from the USB drive. --> <hostCleanUp cmd="%U3_DEVICE_EXEC_PATH%\U3Action.exe">-hostCleanUp</hostCleanUp> <appStop cmd="%U3_DEVICE_EXEC_PATH%\U3Action.exe">-appStop -MaxStops 999</appStop> <appStart cmd="%U3_DEVICE_EXEC_PATH%\U3Action.exe">-appStart \"%U3_DEVICE_EXEC_PATH%\ww.exe\" -id </appStart> </actions> </u3manifest>

I use 7-Zip to compress the 3 folders into a U3P file for U3. It is a free app and very powerful. (It can be downloaded from here: http://www.7-zip.org/)

So that is how you create a Weather Watcher U3 app.

As noted above there are two possible install options for the U3 app. One is where WW is a part of the U3P file that runs from the “host”. This version runs very quickly. The disadvantage is changes to it; new skins, different city, etc have to be done outside of U3 to be permanent and the U3P file rebuilt. If your view of the weather is static this is a very good option for a USB stick.

If on the other hand you want flexibility to change skins, change options, add cities, etc on the fly and have your changes kept without rebuilding the U3P file taking the U3 “device” option is the way to go. The disadvantage is it runs slower. All reading and writing is to the USB stick.

To switch between one version and the other simply choose a different menu option when running !PortableBuilder. The top one is for the static version, the bottom one for the flexible version.

N.B. Should you choose the flexible U3 version option updates, such as new versions of WW, new skins, etc, can be made to the U3 device folder directly. (x:\System\Apps\57656174-6865-7220-5761-746368657200\Device) It is not necessary to create a new U3P file, remove the old version and add the new version.

hth

If I get smarter I may determine a means for the U3 host version to at least remember basic WW changes such as which city to use, which skin, etc. =P~