1.

Solve : UI To Edit A .bat?

Answer»

I'm trying to give my "Macilizer" a configuration UI......just a regular windows message box with 3 check boxes, descriptions for each, and a SAVE button instead of an OK button..... that could be run to configure what is to be run..

check boxes would read:
(box) Battery Meter
(box) Konfabulator
(box) Object Dock

...and checking or rechecking would add or remove the entries one by one:
Code: [Select]
echo Starting Battery Meter
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"


echo Starting Konfablator
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"


echo Starting Object Dock
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"

from the final .bat file
Code: [Select]echo off
title Macilizer
echo Macilizer starting...
ping -n 1 -w 2000 1.1.1.1 >nul
echo Initializing...
ping -n 1 -w 500 1.1.1.1 >nul
Choice /M "Do You Want To Run Mac Look-Alike Programs?"

If %errorlevel% EQU 2 goto no
If %errorlevel% EQU 1 goto yes

:yes
echo Starting Battery Meter
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
echo Starting Konfablator
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
echo Starting Object Dock
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
ping -n 1 -w 2000 1.1.1.1 >nul
echo Exiting....
ping -n 1 -w 2000 1.1.1.1 >nul
exit

:no
echo Exiting....
ping -n 1 -w 2000 1.1.1.1 >nul
exit

can this be done........somewhat/remotely.............easily?


I do have Adobe Photoshop and Flash if I had to create a box, but i would need help to code itthere aren;t any checkboxes in DOS. I can think of ways to do it but not as graphically as yours.

FBno, i don't mean a DOS checkbox, just a windows box (or custom) with checkboxes that change the .bator, well what are you thinking of how to do it?or could i create a box in Adobe flash, and code the checkboxes so when a specific one gets checked, it runs a batch file to add and entry, and when it gets unchecked, it runs a batch file to remove that entry?I'm confused are you asking for help building a DOS file or are you looking for help making a message box?

FBan interactive message box, that will edit a batch file?



(wrong forum section? )


this should be in the Programming Section...... lol yes i think this should be in the programming section. Gah i can't suggest a WAY of doing it in DOS at the moment, have got to move house!!

FBI basically understand this:
Code: [Select]rem macilizer_config.bat
echo off
choice /m would you LIKE to run Mioplanet battery meter.exe?
if errorlevel 1 echo 1>macilizer_config.dat
if errorlevel 2 echo 0>macilizer_config.dat
if errorlevel 255 goto :eof

choice /m would you like to run YahooWidgets.exe?
if errorlevel 1 echo 1>>macilizer_config.dat
if errorlevel 2 echo 0>>macilizer_config.dat
if errorlevel 255 goto :eof

choice /m would you like to run ObjectDock.exe?
if errorlevel 1 echo 1>>macilizer_config.dat
if errorlevel 2 echo 0>>macilizer_config.dat
if errorlevel 255 goto :eof

exit
but can you explain this:
Code: [Select] for /f "tokens=* delims=" %%A in ('type macilizer_config.dat') do (
set %I%=%%A
set /a I+=I
)
set I=1
if %I%=1 (
echo Starting Battery Meter
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
)
err, the config .bat just opens then CLOSES IMMEDIATELY...sorry scrap that attempt. I'm a little too busy to write and debug the code right now. Sorry

FBdunno what are you mean in this topic but i've edited the code above and should work now

Code: [Select]echo off
setlocal enabledelayedexpansion

echo.>file.txt


for %%E in (ObjectDock.exe YahooWidgets.exe Mioplanet_battery_meter.exe) do (
choice /C YN /M "Would you like to run %%E?"
echo %errorlevel% >>file.txt
)
call :START


:START
set num=0
set app_1="C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
set app_2="C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
set app_3="C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"

for /L %%a in (1,1,3) do (
for /F "tokens=1* delims= " %%b in (file.txt) do (
set /a num+=1
set tmp_!num!=%%b
)
)

for /L %%A in (1,1,3) do (
call set tmpa=!app_%%A!
call set tmpn=!tmp_%%A!
if '!tmpn!' equ '1' start "" !tmpa!
)

exit
ofc you have choice.exe ? Quote from: devcom on August 29, 2008, 11:52:03 AM

dunno what are you mean in this topic but i've edited the code above and should work now

Code: [Select]echo off
setlocal enabledelayedexpansion

echo.>file.txt


for %%E in (ObjectDock.exe YahooWidgets.exe Mioplanet_battery_meter.exe) do (
choice /C YN /M "Would you like to run %%E?"
echo %errorlevel% >>file.txt
)
call :START


:START
set num=0
set app_1="C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
set app_2="C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
set app_3="C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"

for /L %%a in (1,1,3) do (
for /F "tokens=1* delims= " %%b in (file.txt) do (
set /a num+=1
set tmp_!num!=%%b
)
)

for /L %%A in (1,1,3) do (
call set tmpa=!app_%%A!
call set tmpn=!tmp_%%A!
if '!tmpn!' equ '1' start "" !tmpa!
)

exit
ofc you have choice.exe ?

thank-you, yes i do have choice.exe, i will try this code when i get back home. (i am at my friend's house CURRENTLY) thanks devcom i had to move house, so i couldn't finish the code.

FB


Discussion

No Comment Found