SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't create event without UserName and Password

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent
View previous topic :: View next topic  
Author Message
NickN



Joined: 22 Oct 2006
Posts: 6

PostPosted: Sun Nov 05, 2006 4:42 am    Post subject: Can't create event without UserName and Password Reply with quote

I'm new, have tried your demo but can't even get demo to work without UserName and Password. My intention was to use this component to set events though my software using this component (advertised feature being I would not need to use timer resources). This is a snipet of your demo... which fails to do anything unless UserName and Password is also supplied. Can you provide modified code that will work from my application... for example: to run another application once a day, on a computer which I know nothing about (which is the normal case). Thanks. Here's your current code from your demo:

procedure TMainForm.Createtasktorunevery10minutesfor24hours1Click(
Sender: TObject);
var
TriggerDetails: TTriggerDetails;
ANow: TDateTime;
S: string;
begin
if not odExecutable.Execute then Exit;
with Scheduler.CreateNewItem(Format('New task %d', [GetTickCount])) do
begin
ApplicationName := odExecutable.FileName;
Triggers.Add;
Triggers[0].TriggerType := ttDaily;
// Modern Delphi can use this code
// Triggers[0].StartTime := IncHour(Now, 1);
// Delphi 4 compatible code
ANow := Now;
Triggers[0].StartTime := ((ANow * 24) + 1) / 24;
Triggers[0].BeginDate := Date;
Triggers[0].EndDate := Date + 30; // not needed!
Triggers[0].HasEndDate := False;
TriggerDetails.Daily.DaysInterval := 1;
Triggers[0].Details := TriggerDetails; // trigger details must be changed only this way
Triggers[0].Duration := 24 * 60; // run for 24 hours
Triggers[0].Interval := 10; // 10 minutes
// could be used UpdateTriggers and Save
Triggers.UpdateTriggers;
Save;
// or just Deactivate(True)
//Deactivate(True);
end;
acRefresh.Execute;
end;
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Sun Nov 05, 2006 7:50 am    Post subject: Reply with quote

Hello,

To setup task without user name and password you need to call SetAccountInformation("", "") method. Did you use the trial version available for download from our web site? The exact text of this demo in the latest package looks like:

Code:

procedure TMainForm.Createtasktorunevery10minutesfor24hours1Click(
  Sender: TObject);
var
   TriggerDetails: TTriggerDetails;
   ANow: TDateTime;
   S: string;
begin
  if not odExecutable.Execute then Exit;
  with Scheduler.CreateNewItem(Format('New task %d', [GetTickCount])) do
  begin
    ApplicationName := odExecutable.FileName;
    Triggers.Add;
    Triggers[0].TriggerType := ttDaily;
    // Modern Delphi can use this code
//    Triggers[0].StartTime := IncHour(Now, 1);
    // Delphi 4 compatible code
    ANow := Now;
    Triggers[0].StartTime := ((ANow * 24) + 1) / 24;
    Triggers[0].BeginDate := Date;
    Triggers[0].EndDate := Date + 30; // not needed!
    Triggers[0].HasEndDate := False;
    TriggerDetails.Daily.DaysInterval := 1;
    Triggers[0].Details := TriggerDetails; // trigger details must be changed only this way
    Triggers[0].Duration := 24 * 60; // run for 24 hours
    Triggers[0].Interval := 10; // 10 minutes
    // could be used UpdateTriggers and Save
    Triggers.UpdateTriggers;
     // to set-up a task for user w/o password
      // use the code below
      {Flags := Flags + [tfRunOnlyIfLoggedOn];
      SetAccountInformation(GetOSUser, '');}
    Save;
    // or just Deactivate(True)
    //Deactivate(True);
  end;
  acRefresh.Execute;
end;

Please take a note to the commented code between Triggers.UpdateTriggers; and Save;.
Please let me know if this helps.
Back to top
View user's profile Send private message
NickN



Joined: 22 Oct 2006
Posts: 6

PostPosted: Sun Nov 05, 2006 4:28 pm    Post subject: Reply with quote

Igor, thanks for the quck reply... but it does not work still. I use the Quick Demo, select for every 10 minutes to run Notepad, use the code "SetAccountInformation('', '');" and am using version 1.0.4 of the component source code.

After 10 minutes "Next Run Time" column in the demo application updates as if Notepad did run (but it did not) and shows the next 10 minutes. So, the timers are working but nothing really happens.

Since the source you supplied for the demo is different from the source I have when I registered (about 3 weeks ago), I wonder if maybe I just don't have th correct demo AND source code.

Could you please email me the correct registered version (including demo) so I can update what I received and then I can try again.

Do you have my registration info?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Sun Nov 05, 2006 6:09 pm    Post subject: Reply with quote

Nick,

Actually, there were just few changes made in the demo projects and may be the source code differs a little. We're planning to release updated version for Scheduling Agent in few days. So it will include updated sample projects. Please let me know if you wait for 1.0.5 or still need 1.0.4.
Back to top
View user's profile Send private message
NickN



Joined: 22 Oct 2006
Posts: 6

PostPosted: Sun Nov 05, 2006 9:07 pm    Post subject: Reply with quote

Oh, I can wait. And thank you for all the quick replies. Hope new version handles being able to create tasks without UserName & Password.

Regards.
Back to top
View user's profile Send private message
NickN



Joined: 22 Oct 2006
Posts: 6

PostPosted: Thu Nov 16, 2006 9:26 pm    Post subject: Tried new version 1.0.5 Reply with quote

Hi Igor, just to update my previous request about UserName and Password... I tried the 1.0.5 version using the Demo program and now it is working correctly when _NOT_ entering a password. I also modified several parameters and tested again -- and again, it is working properly using delphi 7 and using the Demo program.

Big thanks and best regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group