Starting a program in a past date then reset the correct date after a delay.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • franknagy
    New Member
    • Oct 2011
    • 27

    Starting a program in a past date then reset the correct date after a delay.

    The moderator refused my question in this topic:
    "Try it yourself before you ask it".
    He/she is right.
    Here is my solution in
    Visual Prolog 5.2.

    1. I defined a project with UI strategy "VPI" and VPI option "MDI mode".
    2. I inserted the following line in te automatically generated code:
    Code:
    predicates
    
      past()
    
    clauses
    
      past():-!,
      	date(Y,M,D),
      	Win=cast(window,0),
      	Command="Full\\Path\\To the\\desired.exe",
      	Param="",
      	WsFlag=wsf_restored,
      	PastY=2011, PastM=10, PastD=20,
      	date(PastY,PastM,PastD),
    	_ApplicationId = vpi_CreateProcess( Win, Command, Param, WsFlag ),
    	Minute=3,
    	Centisec=6000*Minute,
    	sleep(Centisec),
    	date(Y,M,D).
    3. I inserted the call of the above predicate in the GOAL section before the generation of the task window and exited the program.

    Code:
     
    
    goal
    
    ifdef use_mdi
      vpi_SetAttrVal(attr_win_mdi,b_true),
    enddef
    ifdef ws_win
      ifdef use_3dctrl
        vpi_SetAttrVal(attr_win_3dcontrols,b_true),
      enddef
    enddef 
      past(),
      exit, 
      vpi_Init(task_win_Flags,task_win_eh,task_win_Menu,"past",task_win_Title).
    A small explanation from the VIP 5.2 Help:
    date(INTEGER Year, INTEGER Month, INTEGER Day)

    Flow patterns (i, i, i), (o, o, o)

    Read or set the system date
    Remarks

    (o, o, o) Reads the date from the computer's internal clock.
    (i, i, i) Sets the date used by the computer's internal clock. On UNIX you must have root privileges to use this flow pattern.
Working...