Source language: Translate to:

Elapsed time from last RUN

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Elapsed time from last RUN

Postby Dudus » Tue Oct 17, 2017 1:46 am

Hello,

do you have a working elapsed time calculator script since the last PUB start?

Thank you!
Dudus
User avatar
Dudus
 
Posts: 106
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Elapsed time from last RUN

Postby virger » Tue Oct 17, 2017 9:24 am

In "StartUp" action this code. EnJoy
En "StartUp" accion poe este codigo. Disfrutalo

Code: Select all
DateToNum "[DateShort]" "Default" "[vDias]"
Math "([Hour]*60)+[minute]" "" "[vMinutos]"

FileExists "Pas.tim" "[Tf]"
If "[tf]" "=" "True"
   FileRead "Pas.tim" "All" "[Dt]"
   StrParse "[Dt]" "~" "[DM]" "[X]"
   Math "[vDias]-[DM1]" "" "[Dias]"
   Math "[vMinutos]-[DM2]" "" "[TM]"
   If "[TM]" "<" "0"
      Math "[Dias]-1" "" "[Dias]"
      Math "1440+[TM]" "" "[TM]"
   EndIf
EndIf

Math "Trunc([TM]/60)" "" "[HH]"
Math "[TM]-([HH]*60)" "" "[MM]"

If "[HH]" "<" "10"
   SetVar "[HH]" "0[HH]"
EndIf

If "[MM]" "<" "10"
   SetVar "[MM]" "0[MM]"
EndIf

SetVar "[xDias]" ""
If "[Dias]" ">" "0"
   SetVar "[xDias]" "[Dias] d"
EndIf
FileWrite  "Pas.tim" "All" "[vDias]~[vMinutos]"

alertbox "LAST VISIT" "[xDias]  [hh] h : [mm] m"

COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Elapsed time from last RUN

Postby Dudus » Tue Oct 17, 2017 1:00 pm

Thanks for the code,

but how can I modify this if I want to show for the users in action, for example in the pub you can see:
Tha last update of the list was 12hours 25min ago (Press Update Button to refresh the datas)

and each 5min it is change. next one will be 12hours 30min (Press Update Button to refresh the datas)

Thank you in advance!
D
User avatar
Dudus
 
Posts: 106
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Elapsed time from last RUN

Postby virger » Tue Oct 17, 2017 3:01 pm

Test the code in a button

Pruebe el codigo en un boton
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Elapsed time from last RUN

Postby Dudus » Tue Oct 17, 2017 11:04 pm

Its works okay in a button as well, just how to modify to check in the background the elapsed time?

For example you push the button and execute the script, than 12min later [HH] [MM] will show 00:12
One mintute later (in background a timer) will show the variable 00:13
until you push the button again and reset the timer to 00:00

Any solution to do this?
D
User avatar
Dudus
 
Posts: 106
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Elapsed time from last RUN

Postby virger » Wed Oct 18, 2017 6:25 am

Try the code on a button and make the necessary adjustments. It is simple
Pruebe el codigo en un boton y haga los ajustes necesarios. Es simple
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Elapsed time from last RUN

Postby Dudus » Wed Oct 18, 2017 6:30 am

Belive me I'm trying but no results... always starts from 0 :(
User avatar
Dudus
 
Posts: 106
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Elapsed time from last RUN

Postby virger » Wed Oct 18, 2017 7:13 am

Muy bien en 2 horas estoy de vuelta, debo salir de casa y al regreso resolvere tu problema
Very well in 2 hours I'm back, I have to leave home and I'll solve your problem on the way back
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Elapsed time from last RUN

Postby virger » Wed Oct 18, 2017 9:44 am

GOOD IF I DO NOT UNDERSTAND THIS WILL HELP YOU, PUT THE CODE ON A NEW APPLICATION.
And you tell me

BUENO SI NO ENTIENDO MAL ESTO TE AYUDARA, PONGA EL CODIGO EN UNA APLICACION NUEVA
Y me cuentas

Code: Select all
NBW Publication Source File
(C)2016 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,80
ScreenColors=16777216
ScreenWidth=320
ScreenHeight=200
BkndColor=0
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=28
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=3
Name=BtResetSave
X=6
Y=89
W=122
H=38
Anchor=0
Text=Reset Timer¶& Save
Align=1
ImageStyle=0
ObjAction=... optional save the new RESET TIME¶DateToNum "[DateShort]" "Default" "[vDias]"¶Math "([Hour]*60)+[Minute]" "" "[vMinutes]"¶FileWrite  "Pas.tim" "All" "[vDias]~[vMinutes]"¶setvar "[iH]" "00"¶setvar "[iM]" "00"¶setvar "[xDias]" ""¶... optional ...¶¶setvar "[vMinutes]" "0"¶setvar "[HH]" "00"¶setvar "[MM]" "00"¶¶.. change 1000 (1sec) for 60000 (1 minute)¶TimerStart "Tm" "1000"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=15
Name=TM
X=282
Y=161
W=32
H=32
Anchor=0
AutoStart=No
Interval=1000
ObjAction=Math "[vMinutes]+1" "" "[vMinutes]"¶Math "Trunc([vMinutes]/60)" "" "[HH]"¶Math "[vMinutes]-([HH]*60)" "" "[MM]"¶¶If "[HH]" "<" "10"¶   SetVar "[HH]" "0[HH]"¶EndIf¶¶If "[MM]" "<" "10"¶   SetVar "[MM]" "0[MM]"¶EndIf
ObjectType=8
Name=Inf2
X=54
Y=165
W=212
H=31
Anchor=0
Font=Arial
FontSize=16
FontStyle=1
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs32\cf0\b [hh] h : [mm] m}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=7
ObjectType=8
Name=Inf1
X=54
Y=136
W=212
H=28
Anchor=0
Font=Arial
FontSize=18
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs36\cf0\ul\i Time Ago}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=6
ObjectType=3
Name=BtInit
X=10
Y=4
W=302
H=80
Anchor=0
Text=REMEMBER LAST VISIT¶& INIT TIMER¶[xDias]  [ih] h : [im] m
Align=2
ImageStyle=0
ObjAction=DateToNum "[DateShort]" "Default" "[vDias]"¶Math "([Hour]*60)+[Minute]" "" "[vMinutes]"¶¶FileExists "Pas.tim" "[Tf]"¶If "[tf]" "=" "True"¶   FileRead "Pas.tim" "All" "[Dt]"¶   StrParse "[Dt]" "~" "[DM]" "[X]"¶   Math "[vDias]-[DM1]" "" "[Dias]"¶   Math "[vMinutes]-[DM2]" "" "[TM]"¶   If "[TM]" "<" "0"¶      Math "[Dias]-1" "" "[Dias]"¶      Math "1440+[TM]" "" "[TM]"¶   EndIf¶EndIf¶¶Math "Trunc([TM]/60)" "" "[iH]"¶Math "[TM]-([iH]*60)" "" "[iM]"¶¶If "[iH]" "<" "10"¶   SetVar "[iH]" "0[iH]"¶EndIf¶¶If "[iM]" "<" "10"¶   SetVar "[iM]" "0[iM]"¶EndIf¶¶SetVar "[xDias]" ""¶If "[Dias]" ">" "0"¶   SetVar "[xDias]" "[Dias] d"¶EndIf¶¶FileWrite  "Pas.tim" "All" "[vDias]~[vMinutes]"¶¶setvar "[vMinutes]" "0"¶¶.. change 1000 (1sec) for 60000 (1 minute)¶TimerStart "Tm" "1000"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=16
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=BtNoSave
X=190
Y=89
W=122
H=38
Anchor=0
Text=Reset Timer¶Don't Save
Align=4
ImageStyle=0
ObjAction=setvar "[vMinutes]" "0"¶setvar "[HH]" "00"¶setvar "[MM]" "00"¶¶.. change 1000 (1sec) for 60000 (1 minute)¶TimerStart "Tm" "1000"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=7
Name=Line1
X1=-1
Y1=137
X2=321
Y2=137
EndCaps=0
LineColor=0
LineWidth=3
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=8
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Elapsed time from last RUN

Postby Dudus » Wed Oct 18, 2017 10:49 am

Virger,

you saved my life :)
I put into subrutine and works great in background!

Thanks a lot, works wonderful...
:D
User avatar
Dudus
 
Posts: 106
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest