🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8237

Re: Scheduled Task Wizard

#8237
From: Ted Tripp
Date: Fri, 05 Nov 2004 03:19
110 lines
3929 bytes
Thanks
That answered both questions
Minor correction
"Exec(PropertyGet("Name"))) == "Add Scheduled Tasks" )"
should be
Exec(PropertyGet("Name"))) == "Add Scheduled Task" )

Otherwise, perfect.

Regards
Ted


"Vladimir Afanasyev" <avv@systema.kiev.ua> wrote in message 
news:418a3a2b$1@newsgroups.borland.com...
>
> "Ted Tripp" <ttripp@rankexec.com> wrote:
>
>>Scheduled Tasks folder.
>
> You can retrieve the location of the Tasks folder from the registry by 
> getting data for the following value:
>
> HKEY_LOCAL_MACHINE
> SOFTWARE
> Microsoft
> SchedulingAgent
> TasksFolder
>
> In my case "%SystemRoot%\Tasks"
>
> it means "C:\WINNT\Tasks"
>
> You can run Scheduler via Scriptable Shell Objects.
> It's a little tricky but possible.
>
> Follow code for BCB5.
>
> Init shell objects:
>
> CoInitialize(NULL);
> Variant SA=Variant::CreateObject("Shell.Application");
> Function NameSpace("NameSpace");
> Function Items("Items");
>
> //Virtual folder containing icons for the Control Panel
> //applications. (value = 3)
> int ssfCONTROLS=3;
> //get it folder - scheduler there
> Variant fold=SA.Exec(NameSpace << ssfCONTROLS);
>
> //will be enum items of folder and search scheduler
> Variant It=fold.Exec(Items);
> int count=It.Exec(PropertyGet("Count"));
>
>
> //Search folder with name "Scheduled Tasks" inside CPAs
> Variant schedulerFold=Variant::Empty();
> for(int i=0; i<count; ++i)
>   {
>    if(AnsiString(Variant(It.Exec(Function("Item") << 
> i)).Exec(PropertyGet("Name"))) == "Scheduled Tasks" )
>         {
>           schedulerFold=It.Exec(Function("Item") << i);
>           break;
>         }
>   }
>
> if(schedulerFold.IsEmpty())
>    {
>     ShowMessage("Impossible! There are no any Scheduled Tasks folder");
>     Application->Terminate();
>     return;
>    }
>
> //get FolderItem object:
> bool d=schedulerFold.Exec(PropertyGet("IsFolder"));
> Variant op=schedulerFold.Exec(PropertyGet("GetFolder"));
>
>
> //find and run item "Add Scheduled Tasks"
> //really find ver inside
> //and it is not big secret that verb called "Open"
> Variant It1=op.Exec(Items);
> int count1=It1.Exec(PropertyGet("Count"));
> for(int i=0; i<count1; ++i)
>  {
>    if(AnsiString(Variant(It1.Exec(Function("Item") << 
> i)).Exec(PropertyGet("Name"))) == "Add Scheduled Tasks" )
>         {
>                Variant vb=Variant(It1.Exec(Function("Item") << 
> i)).Exec(Function("Verbs"));
>                int count2=vb.Exec(PropertyGet("Count"));
>                AnsiString MyVerb=Variant(vb.Exec(Function("Item") << 
> 0)).Exec(PropertyGet("Name"));
>           Variant(It1.Exec(Function("Item") << 
> i)).Exec(Function("InvokeVerb") << vb);
>           break;
>         }
>  }
>
>
> Dialog has to open. I try it for Windows2000.
> Of course some changes for localized Windows:
> I mean -
> "Scheduled Tasks"
> and
> "Add Scheduled Tasks"
>
> Vladimir. 
Technical Details
Message-ID: <418af125$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4189b3d2@newsgroups.borland.com> <418a3a2b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5162d133ddb169b3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Ted Tripp" <ttripp@rankexec.com>
From: "Ted Tripp" <ttripp@rankexec.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References:  <4189b3d2@newsgroups.borland.com> <418a3a2b$1@newsgroups.borland.com>
Subject: Re: Scheduled Task Wizard
Date: Thu, 4 Nov 2004 21:19:00 -0600
Lines: 112
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 216.160.57.213
Message-ID: <418af125$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099624741 216.160.57.213 (4 Nov 2004 19:19:01 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail