# Store the elapsed use time in the IDE

**URL:** <https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274>\
**Category:** General\
**Created:** [September 15, 2014, 7:57am UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274 "2014-09-15T07:57:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 15, 2014, 7:57am UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/1 "2014-09-15T07:57:18Z")

</div>

I was walking to my car when that idea comes to mind:

how many times did I spend to develop

And: is theres a development tool that compute a project ellapsed time (time ellapsed since the project was created, only when the project window is open on screen, of course) ?

Someone ?

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [September 15, 2014, 9:35am UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/2 "2014-09-15T09:35:35Z")

</div>

` dim start as new date
  dim elapsed as new date
  dim f as FolderItem = specialfolder.Applications.child("TextEdit.app").child("Contents").child("MacOS").child("TextEdit")
  if f = nil then return
  if not f.Exists then return
  S1.mode = 0
  S1.Execute(f.shellpath)
  dim stopped as new date
  elapsed.totalseconds = stopped.totalseconds-start.totalseconds
  msgbox "You have used TextEdit for : "+str(elapsed.hour)+ " hours "+str(elapsed.Minute)+" and "+str(elapsed.Second)+" seconds."
  `

The trick is to use shell mode zero on the Unix executable inside the bundle. It ties the calling app until the child process is terminated. For Xojo 2014 line 3 should read as follow :

```auto
dim f as FolderItem = specialfolder.Applications.child("Xojo 2014 Release 2.1").child("Xojo.app").child("Contents").child("MacOS").child("Xojo")
```

Of course if you have moved Xojo.app that path should be modified.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 15, 2014, 10:13am UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/3 "2014-09-15T10:13:57Z")

</div>

Thank you Michel.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [September 15, 2014, 11:25am UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/4 "2014-09-15T11:25:39Z")

</div>

I forgot ; I usually place a shell class in the project. You should put

```auto
Dim S1 as new Shell
```

at the beginning of the code I posted.

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [September 15, 2014, 2:24pm UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/5 "2014-09-15T14:24:55Z")

</div>

Albin Kiland has an app on the MAS (£0.69p) - It’s called Aeon Timer:  
I believe this may be what you are looking for - take a look on the MAS.  
[link text](https://itunes.apple.com/se/app/aeon-timer/id723330958?mt=12)

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [September 15, 2014, 5:21pm UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/6 "2014-09-15T17:21:29Z")

</div>

The method I posted above is for Macintosh. It can probably work for Linux as well by just pointing to the executable, since Mac’s Unix and Linux have the same way of handling shell.

To do the same on Windows requires using the Completed event of the shell. Here is what to do.

- Insert a class into the project called S with super `Shell`.
- Drag an instance of the class to the window. It will automatically be called S1.
- Add the event Completed to S1
- Add a Date property to the window called start

Here is the code to launch the IDE for 2014R2.1. Attention, if you are still using XP, the folderitem is simply Applications.Programs ; I have indicated here the path for Windows 7 and 8/8.1 in which Xojo is installed in the folder for 32 bits applications `Program Files (x86`.

` start = new date
  dim f as FolderItem = specialfolder.Applications.Parent.child("Program Files (x86)").child("Xojo").child("Xojo 2014r2.1").child("Xojo.exe")
  if f = nil then return
  if not f.Exists then return
  S1.mode = 2
  S1.Execute(f.shellpath)
  `

In the S1 `Completed` event :

` dim elapsed as new date
  dim stopped as new date
  elapsed.totalseconds = stopped.totalseconds-start.totalseconds
  msgbox "You have used Notepad for : "+str(elapsed.hour)+ " hours "+str(elapsed.Minute)+" and "+str(elapsed.Second)+" seconds."`

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [September 15, 2014, 5:28pm UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/7 "2014-09-15T17:28:10Z")

</div>

Is it not funny ? Whenever there is something to correct, esotalk won’t let you edit… Grrr…  
Please read “Xojo” instead of “Notepad” in the fourth line of the Completed event.

[quote=129502:@Richard Summers]Albin Kiland has an app on the MAS (£0.69p) - It’s called Aeon Timer:  
I believe this may be what you are looking for - take a look on the MAS.  
[link text](https://itunes.apple.com/se/app/aeon-timer/id723330958?mt=12)[/quote]

Nice app. It is unclear if it measures the time an app has been running, though. Could be a nice feature to add to his version 2 🙂

---

<div class="post-metadata">

**Author:** ![Albin\_Kiland](https://forum.xojo.com/user_avatar/forum.xojo.com/albin_kiland/32/1028_2.png) [@Albin\_Kiland](https://forum.xojo.com/u/Albin_Kiland)\
**Post date:** [September 15, 2014, 6:29pm UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/8 "2014-09-15T18:29:40Z")

</div>

[quote=129529:@Michel Bujardet]  
Nice app. It is unclear if it measures the time an app has been running, though. Could be a nice feature to add to his version 2 :)[/quote]  
It does not measure the time spent in an application. BUT, that was a good suggestion for a feature though 😉

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:25pm UTC](https://forum.xojo.com/t/store-the-elapsed-use-time-in-the-ide/19274/9 "2020-10-29T17:25:00Z")

</div>


