Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code seems to execute twice
Message
De
14/05/2007 20:35:43
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Code seems to execute twice
Divers
Thread ID:
01225415
Message ID:
01225415
Vues:
50
I have the following function (parts have been snipped for convenience)
DEFINE CLASS RunTasks as Custom 
  FUNCTION Run_scheduled_tasks()
    oWWIP = CREATEOBJECT("wwIPStuff")
             .
             .
    lcTime = TIME()
    oMySQLData.Get_Scheduled_Tasks('zSchld_tasks')
    SELECT what I need INTO CURSOR 'zTasks_toRun'
    SELECT zTasks_toRun
    SCAN
      IF NOT EMPTY(ALLTRIM(zTasks_toRun.cParameters)) THEN 
        lcCommand = ALLTRIM(zTasks_toRun.cRunCmd) + ' ' + ALLTRIM(zTasks_toRun.cParameters)
      ELSE 
        lcCommand = ALLTRIM(zTasks_toRun.cRunCmd)
      ENDIF 
      oshell = CREATEOBJECT("wscript.shell")
      oshell.run(lcCommand,1,.t.)
      oMySQLData.Update_Task_LastRun(zTasks_toRun.CID)
      oWWIP.cSubject = zTasks_toRun.ScheduleName + ' completed.'
      oWWIP.cAttachment = TRIM(zTasks_toRun.cAttachments)
      ** semi-colons not allowed.  In case users try them
      ** Separate Notify email list items with either comma or semi-colon
      lnRecips = ALINES(aRecips,zTasks_toRun.cNotify,",",";") 
      FOR I = 1 TO lnRecips
        oWWIP.cRecipient = ALLTRIM(aRecips[i])
        oWWIP.SendMail()
      ENDFOR
    ENDSCAN 
  ENDFUNC 
ENDDEFINE
I've created a program which has several messageboxes.

When I step through this code in the VFP Debugger the oshell.run() line takes effect, the second program runs and I respond to all the messageboxes, and then the email gets sent.

When the program runs unattended via an exe, the oshell.run() line executes, an email is immediately sent, I respond to the messageboxes, and a second email is sent.

I'm perplexed, confused, etc.

Can anybody point me to what I might have set up incorrectly that would result in this behavior?

Thanks to all..........Rich
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform