WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Registry
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Setting Binary Values Greater than 255 Characters

Keywords:  RegSetBin  255 256

Question:

How do I set a binary value in the Registry, when the value I'm trying to set is around 700 characters long?

Answer:

You'll have to save each 255 sequence of characters in a variable and StrCat them together. All you have to do is keep your WinBatch lines shorter with a trick like...
a="first 255 characters"
b="second 255 characters"
c="third set of 255 characters"

myvalue=strcat(a,b,c)

RegSetBin(@REGCURRENT, "A Test Key\[My Binary Value]", myvalue)
as in this real-life example:
key=RegCreatekey(@REGMACHINE,"SOFTWARE\BusinessObjects\BusObj Configuration\BusinessDesigner\BusInitialization")

parta="kagtdac.dll,$kagtldb.dll$kobfldb.dll$,kagtuser.dll,kagtres.dll,kagtsbo.dll,#kbus.dll#kagtrepo.dll#REPOSITORY#"
partb="AgentReposit#,#kbus.dll#kagtdp.dll#DP#|rsc_dp|#,*kagtdps.dll*dpfsql.dll*,"

finalpart=strcat(parta,partb)
RegSetMulSz(key, "[AgentDll List]",finalpart,",")

RegCloseKey(key)

Question:

I'm trying to set multiple printer configs, for the same printer, via a winbatch dialog, but I keep getting the errors "invalid string" or "string too long," (depending on whether I use "" or %%. My code is as follows:
regkey = RegOpenKey(@REGMACHINE, "System\CurrentControlSet\control\Print\Printers\Plotter B")

a11 = '50 6C 6F 74 74 65 72 20 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 30 02 94 00 50 00 0F 07 00 00 02 00 18 01 B8 23 D0 17 00 00 01 00 01 01 FF FF 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00'
a12 = '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6E 20 04 00'
a13 = '00 00 0A 00 00 00 02 00 EA 0A 00 00 6F 08 00 00 10 80 28 00 00 00 01 00 00 00 01 00 05 00 0F 01 00 00 00 00 01 00 01 00 01 00 01 00 01 00 01 00 C8 00 00 00 64 00 EA 0A 00 00 6F 08 00 00 01 01 02 00 00 00 02 00 00 00 00 00 00 00'
data = StrCat(a11,a12,a13)
;message("data=",data)

RegSetBin(regkey, "[Default DevMode]", data)
;newkey = RegQueryBin(regkey, "[Default DevMode]")
;message("",newkey)
RegCloseKey(regkey)
I use 12 different configs for 2 different plotters. I aquired the hex code via RegQueryBin. If I can get this to work, I'd rather do it this way than have 24+ printers. If there's an easier way, advice is appreciated.

Answer:

Soooo close.
  1. The %% stuff is bad cause the line is too long.

  2. Without %% was failing because you did not have spaces seperating the binary values in your strings. Change he statement
    data = StrCat(a11,a12,a13)
    
    to
    data = StrCat(a11," ",a12," ",a13)
    
    And I think it might work. It puts the spaces in between the ending and beginning binary values.

Article ID:   W13739
Filename:   Setting Binary Values Greater than 255 Chars.txt
File Created: 1999:06:22:13:12:26
Last Updated: 1999:06:22:13:12:26