Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time And Date Dialog 1

Status
Not open for further replies.

mrnoisy

Programmer
Mar 1, 2003
78
AU
I once found an aspect script tip to generate a dialog box with a clock and calander that could be used to set time and date variables to use with the script. It used a DLL File (ASPTIME.DLL I think but this I cannot be sure).

I tested it at the time (about 6-12 months ago) and thought this would be handy, but had no use for it at that time. Now that I have a use for it, I cant remeber how it was done. Can anybody help me with this?
 
Take a look at ASPTIME.TXT in the ASPECT directory under your Procomm install, that's probably where you saw the script originally. aspect@aspectscripting.com
 
This is a subroutine called DATESTAMP I use in many scripts. Hope it helps:

;**********************************************
PROC DATESTAMP
integer MONTH, DAY , YEAR, HOUR, MIN, SEC
String TWODIGDAY = "0" ; ADDS THE ZERO AT WHERE A 1 DIGIT DAY OCCURS.
String THISMONTH, THISDAY, THISYEAR, TWODIGMONTH, TWODIGYEAR
ltimeints $LTIME YEAR MONTH DAY HOUR MIN SEC ;INTEGER DATE VALUES.
Strset TODAY 0 0 255
Strcpy TODAY $DATE
Numtostr MONTH THISMONTH ; CONVERT TO STRING VALUES.
NumtoStr DAY THISDAY
NumtoStr YEAR TWODIGYEAR ; COLLECT 2 DIGIT YEAR STRING.
StrCat TWODIGMONTH THISMONTH ; ADDS STRING VALUE FOR 2 DIGIT CONVERSION.
Strcat TWODIGDAY THISDAY
Strset THISMONTH 0 0 255 ; RESETS STRING THAT WAS USED TO ADD VALUE
Strset THISDAY 0 0 255
Strright THISMONTH TWODIGMONTH 2 ; COPIES LAST TWO DIGITS BACK TO STRING
Strright THISDAY TWODIGDAY 2
Strright THISYEAR TWODIGYEAR 2 ;COPIES LAST TWO DIGITS OF YEAR.

; SAVE AS STRING DATEFNAME
Strcpy DATEFNAME THISYEAR
Strcat DATEFNAME THISMONTH
Strcat DATEFNAME THISDAY
;Now the string datefname = "yymmdd"
ENDPROC
;**************************************** Robert Harris
 
Thank you both knob and RLHarris for your responses.

knob,
The ASPTIME.TXT file was just what I was looking for. You were right, this is probably where I found it the tip in the first place.

RLHarris,
If you haven't already read the ASPTIME.TXT file in you Aspect directory, I recommend that you do. It shows how to display a GUI interface to allow users to set a Time and/or Date(very cool). Just to give you some idea of what it can do, try the example below.

Code:
proc main
string TimeStr
integer RetVal, TimeHandle
long LongTime
if dllload "ASPTIME.DLL" TimeHandle
   dllcall TimeHandle "ASPLTIME" $PWMAINWIN 2 RetVal LongTime            "Set Time And Date" "Set Date" "Set Time"
   ltimestring LongTime TimeStr
   dialogbox 0 10 22 190 12 23 "Script Execution Suspended" 
      text 1 2 2 55 9 "Suspended Until:" left 
      text 2 58 2 128 9 TimeStr left 
   enddialog 
   waituntil LongTime
   dlgdestroy 0 cancel
else
   errormsg "Unable To Load DLL file: ASPTIME.DLL"
endif
usermsg "Done"
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top