Variables passed to a batch file?

Got an idea, post it here

Variables passed to a batch file?

Postby jowaldo on Tue Feb 08, 2005 5:16 pm

Would it be possible (or maybe it is already) to be able to have say a DB menu where each item has a specific variable attached to it, and when you click any of the items it launches a batch file, but depending on which item you click it sends its variable to specified parts of the batch file?

If so this could really open up some new options.
jowaldo
 
Posts: 903
Joined: Wed May 21, 2003 7:17 pm

Postby vicom on Tue Feb 08, 2005 5:49 pm

Are you refering to a DOS batch file ?
vicom
 
Posts: 206
Joined: Tue Apr 20, 2004 6:16 am
Location: South Africa

Postby jowaldo on Tue Feb 08, 2005 6:34 pm

vicom wrote:Are you refering to a DOS batch file ?


Yep
jowaldo
 
Posts: 903
Joined: Wed May 21, 2003 7:17 pm

Postby stevenhanna6 on Wed Feb 09, 2005 12:38 am

you lost me here

but depending on which item you click it sends its variable to specified parts of the batch file?


are you talking about calling one batch file with arguments, or different batch files depending on the variable?
stevenhanna6
 
Posts: 904
Joined: Tue Feb 18, 2003 10:39 am
Location: Ontario, Canada

Postby jowaldo on Wed Feb 09, 2005 5:43 am

sorry i should have gave an example of what i'm tryin to do.

Right now I have a "styles" page that has a db menu, where each item has a specific event tied to it that runs a regular ol' dos batch file (that copies and overwrites certain images to change the style) and then a refresh images command to show the changes.

Each batch file looks something like this:

copy mainButtonblue.png mainButton2.png /y

I'm trying to change all of my buttons, not just the main ones to be changed by this batch file, but the more buttons, and the more style/color options I add, I have to create a new event, and batch file.

If I could have a db item variable for the blue button called say blue then if I could pass something like

copy mainButton%variable%.png mainButton2.png /y
copy smallButton%variable%.png smallButton2.png /y
copy roundButton%variable%.png roundButton2.png /y

Then I would only need one batch file, and one event to work for them all.

I hope that makes more sense... let me know if it doesn't.
jowaldo
 
Posts: 903
Joined: Wed May 21, 2003 7:17 pm

Postby marque on Wed Feb 09, 2005 10:13 am

Isnt it possible to copie and overwrite the complete button directory, so for each style you have one button directory and one batch file?
marque
 
Posts: 55
Joined: Thu Dec 09, 2004 11:18 pm

Postby jowaldo on Wed Feb 09, 2005 4:32 pm

I could do that, but I'm not using this to change all of my buttons, only about a third of them.

Also if I did that, I'd still need a batch file and an event for each individual db entry, which is what I'm trying to avoid.
jowaldo
 
Posts: 903
Joined: Wed May 21, 2003 7:17 pm

Postby vicom on Fri Feb 11, 2005 12:01 pm

How about this

lets name the bacth file [STYLE.BAT]

the contents of STYLE.BAT will be as follows:


Code: Select all
@ECHO OFF
IF %1 == "BLUE" THEN GOTO BLUE
IF %1 == "RED" THEN  GOTO RED
IF %1 == "GREY" THEN GOTO GREY
GOTO END

REM 'Put your Blue routine here' --------
:BLUE   
 COPY  xxx.PNG yyy.png
 COPY ........
GOTO END

REM 'Put your Red routine here'  --------
:RED   
 COPY  xxx.PNG yyy.png
 COPY ........
GOTO END

REM 'Put your Grey routine here' ---------
:GREY   
 COPY  xxx.PNG yyy.png
 COPY ........
GOTO END

:END




You run the batch file passing parameters eg:
STYLE BLUE or STYLE RED
from XLOBBY it will be STYLE %your colour parameter%


How'z that, one batch file with different parameters
vicom
 
Posts: 206
Joined: Tue Apr 20, 2004 6:16 am
Location: South Africa

Postby jowaldo on Fri Feb 11, 2005 4:37 pm

Hmm so you are saying that way, I would only need one batch file, but a separate event for each command, like

style.bat blue
style.bat red

etc...?
jowaldo
 
Posts: 903
Joined: Wed May 21, 2003 7:17 pm

Postby vicom on Sat Feb 12, 2005 2:30 pm

exactly :wink:
vicom
 
Posts: 206
Joined: Tue Apr 20, 2004 6:16 am
Location: South Africa