Thursday, December 14, 2017

#1 2017-05-30 03:58:26 pm

dirtbikeflyboy917
Member
From:: Billings, MT, USA
Registered: 2009-03-21
Posts: 87

Elapsed Time/Billing

I need to make an app that starts recording the time since login, then automatically opens a screen at the end to bill for that time (maybe I just provide a link to a website where the credit card info can be added)?

Essentially, it's billing someone for the time they use the computer (like you would see at a Kinkos/Fedex, but for Mac). 

Here's an example:

1. User will login to the public computer this software would be used on;
2. This program then starts counting the elapsed time since the login (runs in the background, and can not be turned off);
3. When the person is ready to log off, they click the "log-off" button on this software, which then brings them to the billing screen (maybe even open a website link where billing can be done - whichever is easier);
4. The system then automatically inputs the time the computer was used, and calculates the total;
5. User then enters CC information, and clicks submit.  After the payment is processed successfully, the computer runs a program to delete all files and downloads user installed, and logs the computer off.

I think it's pretty simple.  I looked around online to find software that does this (or for various components of applescript that would eventually make this software when pieced together), but have had no luck.  Is anyone here able to do this?  Are you aware of software that already exists that does this (for Mac, obviously)?  Thank you in advance!


Thank you.

Best Regards,
Benjamin

Offline

 

#2 2017-06-01 06:33:45 am

DJ Bazzie Wazzie
Member
From:: the Netherlands
Registered: 2004-10-20
Posts: 2727
Website

Re: Elapsed Time/Billing

dirtbikeflyboy917 wrote:

I think it's pretty simple.


Well it's not wink

1. What if the users uses the terminal, looks up the process, kills it and start it right before he ends his session. Instead of hours only a few minutes are recorded.
2. AppleScripts is no saint and it can crash, what should you do then?
3. If the AppleScript is managed by launchd to tackle down problem #2, the recorded time is still not accurate because it will quit and restarts processes by its own will (to make Mac OS X look faster than other OS'es). 
4. What to do with fast user switching?
5. You can cancel out the login by creating an process where the delegate method applicationShouldTerminate: returns false but what do you do when the user force quits? The user won't see a recording screen and can logout for free. Re-login will reset the timer to 0.
6. What if the users halts the system?
7. What if an kernel panic occurs (Mac OS X's version of BSOD)?

These are common problem when you see in practice and therefore internet cafes uses different solutions.

Offline

 

#3 2017-06-01 09:35:50 am

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 211

Re: Elapsed Time/Billing

I agree with DJ that getting this right would be a significant programming project, not a quick Applescript.

Unless you want to hire a team of developers for months, you want something off-the-shelf. Do more Googling. It didn't take me long to find some possibilities:

iCafe, but it appears to be discontinued: https://www.macupdate.com/app/mac/15760/icafesystem

Hodomon Timer http://www.hodoman.com/

eCrisper http://ecrisper.com/


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#4 2017-06-02 02:00:14 am

dirtbikeflyboy917
Member
From:: Billings, MT, USA
Registered: 2009-03-21
Posts: 87

Re: Elapsed Time/Billing

Hi DJ and T.Spoon,

Thank you both for your input.  I'll look into the links T.Spoon provided (obviously my Googling skills need to be improved big_smile )

Thank you!!


Thank you.

Best Regards,
Benjamin

Offline

 

#5 2017-06-06 01:26:21 am

dirtbikeflyboy917
Member
From:: Billings, MT, USA
Registered: 2009-03-21
Posts: 87

Re: Elapsed Time/Billing

Those programs seem to be more for online use.  I need the entire computer (not just the internet) use billable.  Say someone wants to create a Word document.  That needs to be billed time while logged in.  What am I missing from my google searches?

Thank you!!!! big_smile big_smile


Thank you.

Best Regards,
Benjamin

Offline

 

#6 2017-06-06 01:33:41 pm

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 211

Re: Elapsed Time/Billing

Sorry, I didn't find much else. I'm surprised there isn't much out there, but I wasn't finding it in a few quick searches.


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#7 2017-06-07 03:56:42 am

blend3
Member
From:: UK
Registered: 2006-03-28
Posts: 464

Re: Elapsed Time/Billing

I agree also that this has got lots of ifs and buts to it but I put this script together that I think should cover points 1-3 of the original post:

Applescript:

set currUser to do shell script "whoami"
set loginTime to do shell script "w -h " & currUser & " | awk '{print $4}' | awk 'NR==1{print}'"
set currDateString to date string of (current date)
set fullLoginTime to date (currDateString & " at " & loginTime)
set loginSeconds to (current date) - fullLoginTime

---------------------------------------------this part is credit to StefanK [url]http://macscripter.net/viewtopic.php?id=43844[/url]---------------------------------------------
set totalLoginTime to secondsToHMS from loginSeconds

display dialog currUser & " has been logged in for " & totalLoginTime

on secondsToHMS from theSeconds
   tell theSeconds to return my pad(it div hours) & ":" & my pad(it mod hours div minutes) & ":" & my pad(it mod minutes)
end secondsToHMS

on pad(v)
   return text -2 thru -1 of (v + 100 as text)
end pad
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hope this helps,
Nik


I can resist everything in life except temptation.
(Oscar Wilde)

Offline

 

#8 2017-11-16 03:38:40 pm

dirtbikeflyboy917
Member
From:: Billings, MT, USA
Registered: 2009-03-21
Posts: 87

Re: Elapsed Time/Billing

Sorry it took me so long to reply.  I don't often check this website. 

I'll test out that script here shortly, and get back to you!  Thank you very much for your help!!


Thank you.

Best Regards,
Benjamin

Offline

 

#9 2017-11-18 05:03:43 pm

dirtbikeflyboy917
Member
From:: Billings, MT, USA
Registered: 2009-03-21
Posts: 87

Re: Elapsed Time/Billing

It seems to work fine for points 1-3.  Thank you!  I'll see what else I can piece together for the rest (if anything), and will try to remember to post back.  lol

Thank you!!!


Thank you.

Best Regards,
Benjamin

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)