X++ code to copy file from one location to another location

static void WinApiClassestocopythefile(Args _args)
{
#avifiles
boolean present;
SysOperationProgress simpleProgress;
int i;
;

// startlengthyoperation();
SimpleProgress = SysOperationProgress::newGeneral(#aviupdate, 'Simple', 100);
if(WinAPI::fileExists("D:\\Ramesh_Ax_Docs\\AX Books\\AXInstallationGuide.pdf"))
{
for (i=1; i<=100; i++)
{
simpleProgress.incCount();
simpleprogress.setText(strfmt("%1% Of File is being Copied",i));
sleep(200);
}
WinAPI::copyFile("D:\\Ramesh_Ax_Docs\\AX Books\\AXInstallationGuide.pdf","D:\\Ramesh_Ax_Docs\\AXInstallationGuide.pdf",true);
Simpleprogress.kill();
}
else
{
info("This file does not exist");
}
info("The file has been Copied :)");
info(strfmt("The filesize is %1",WinApi::fileSize("D:\\Ramesh_Ax_Docs\\AXInstallationGuide.pdf")));
info(WinAPI::getComputerName());
//endlengthyoperation();
}

1 comment:

  1. Args args = new Args();
    ;

    formRun = new MenuFunction(menuitemdisplaystr(iDMS_N_AMAssetNew), MenuItemType::Display).create(args);
    args.caller(this);
    FormRun = classfactory.formRunClass(args);
    FormRun.init();
    FormRun.run();
    FormRun.wait();

    if (FormRun.closedOk())
    {
    Source = FormRun.Source();
    ProjId = FormRun.ProjId();
    acquisitionId = FormRun.acquisitionId();
    Proj_sco = FormRun.Proj_scoId();
    Proj_MCO = FormRun.Proj_mcoId();
    Proj_Rep = FormRun.Proj_RepId();

    if (Source == enum2str(iDMS_N_AMAssetSource::Project))
    {
    this.getRecordFromProject();
    return true;
    }

    ReplyDelete