Even i thought that it might be due to old macro as i am trying out something countinously.
I already tried with fresh installation.
here i am trying to acheive that if Drive is not m then get the second parameter vvijay_... from registry key.
somehow i missed semicolon while pasting the code.
so if i pass static value to _ntRegQueryValue it is working fine but it is not if i pass some dynamic value.
Working:
src1 := _ntRegQueryValue(HKEY_CURRENT_USER, "Network\\F", "", "RemotePath");
Not working:
drivepath := "Network\\" :+ Drive;
src1 := _ntRegQueryValue(HKEY_CURRENT_USER, drivepath, "", "RemotePath");
here is code snip
#pragma option(strict,on)
#include 'slick.sh'
void _cbsave_vvijay (...)
{
src := strip_filename(p_buf_name, 'DN');
Drive := substr(p_buf_name, 1, 1 );
_str usr = "", site = "", viewtype = "";
if (Drive != "M")
{
drivepath := "Network\\" :+ Drive;
src1 := _ntRegQueryValue(HKEY_CURRENT_USER, drivepath, "", "RemotePath");
_str pparts1[];
split(src1, FILESEP, pparts1); // split path, get root
_message_box("pparts1 is '" pparts1[3] "'");
if (pparts1._length() > 2)
{
_str uparts[];
split(pparts1[3], '_', uparts); // split root, get usr (1st), viewtype (2nd last) and site (last)
if (uparts._length() > 2)
{
usr = uparts[0];
site = uparts[uparts._length() -1];
viewtype = uparts[uparts._length() -2];
}
}
}
else
{
_str pparts[];
split(src, FILESEP, pparts); // split path, get root
if (pparts._length() > 2)
{
_str uparts[];
split(pparts[1], '_', uparts); // split root, get usr (1st), viewtype (2nd last) and site (last)
if (uparts._length() > 2)
{
usr = uparts[0];
site = uparts[uparts._length() -1];
viewtype = uparts[uparts._length() -2];
}
}
}
if (viewtype == "labx")
{
message("view is a labx view, will copy file to stage area under your home directory");
if ( (site :!= "blr") || (site :!= "wtl") )
//if ( (usr._length() == 0) || (site._length() == 0) )
{
_message_box("error: unexpected src path naming");
return;
}
dst := '\\' :+ site :+ "home-1\\" :+ "home\\" :+ get_env("USERNAME") :+ "\\stage_area" :+ src;
if ( !path_exists(dst) )
{
int err = make_path(dst);
if (err)
{
_message_box("make_path '" dst "' failed - rc =" err);
return;
}
}
dst :+= strip_filename(p_buf_name, 'DP');
//message("backing up '" src "' to '" dst "' ... ");
err := copy_file(p_buf_name, dst);
if ( err )
{
_message_box("copy_file '" dst "' failed - rc = " err);
}
}
}