How can i make a ppc script to run every time date changes?

jony

Member
Hi. I am experimenting with a calendar - kind aplication. I wrote a script which is working. it shows me a birthday. When the date changes, i need to run it again to see next birthday. Is there a way, to auto check date and every time the date changes to run again? I dont want to be running always, because it will spent my battery phone. Only when clock goes 0:00 and the date changes.. Any help? Thanks ,
 

jony

Member
Ok, i didn't reply fast because i wanted to test it.
This is my test code

Sub Globals
End Sub
Sub App_Start
Hardware1.New1
t = TimeParse("22:23")
t = DateAdd(t,0,0,0)
Hardware1.RunAppAtTime( "E:\Free\ResHacker\ResHacker.exe", t)


End Sub


I have add HardwaerDesctop.dll to both device and deskctop, from tool-add object-hardware , i added hardware1. So i have hardware1: hardware to my right list. The time on my pc was 22:20, i run it and waiting if the application ResHacker.exe will run in 3 minutes. It didn't. After i run my script, it ends without an error message or something. What is wrong? Thanks ,
 
Last edited:

Zenerdiode

Active Member
Licensed User
Hello Jony,

Your post is slightly confusing :confused:

How can i make a ppc script to run every time date changes?

B4X:
...
Hardware1.RunAppAtTime( "E:\Free\ResHacker\ResHacker.exe", t)

Are you trying to make this work with a desktop or device application? The Hardware library is a device only library - HardwareDesktop.dll is provided so you may develop in the desktop IDE and other technical reasons.

If ResHacker.exe is a device executable, you'll need to store it on the device somewhere - because the reference to your e:\ drive is meaningless to the device.

Else if you want to have this program run each time on the desktop; you may use the Task Scheduler (START>Accessories>System Tools>Scheduled Tasks)

EDIT:
I dont want to be running always, because it will spent my battery phone.
Sorry, I have just re-read your original post - and I see it is for your phone. My advice about the reference to your e:\ drive still stands.
 
Last edited:

jony

Member
Thanks all for the replies .
I didn't know that it is not working in a pc. Anyway, i want to use it in my phone (htc diamond 1), and the above script was just to test it on my pc to see if it is working before use the original script . The original script is this:

Sub Globals
'Declare the global variables here.
End Sub

Sub App_Start
hw.new1
t=TimeParse("00:01")
t=DateAdd(t,0,0,1)
hw.RunAppAtTime(AppPath & "\myCalendar.exe",t)
End Sub

I have created the object hw:Hardware
If i understand well , this script should run when the clock goes to 00:01 .
So to test it (and not have to wait hours) , i change the clock e.g to 11:59 and wait.. Well nothing happens .
Do i have something wrong to the above?

*** edit I am runing it in windows mobile 6.5.1 If i haven't anything wrong with the above, is it possible that it is not working to this?
 
Last edited:

Zenerdiode

Active Member
Licensed User
I've just tested it on a WM2003SE device I had to hand and it works fine. Maybe there is an issue with you running it from the device IDE rather than it being a compiled application.

Does your HTC have a 'custom' ROM?
 

agraham

Expert
Licensed User
Longtime User
I have add HardwaerDesctop.dll to both device and deskctop
This is wrong. You need to remove HardwareDesktop from the device and add Hardware.dll instead. Hardware.dll is the functional library for the device, HardwareDesktop is a largely non-functional place-holder for the desktop that is needed for development on the desktop and for optimised compilation.
 

jony

Member
Yes !! :)
agraham and all the others thank you very much. You said the magic word . When i read it i understand where i was wrong. I have made every possible thing to make it work, but i didn't try to use Hardware.dll in device AND HardwaerDesctop.dll deskctop . Now it finally works. Thanks again all.
 
Top