Hi,
54% ... that I would expect on dual core processors. I think your Atom is not dual core, but it has hyper threading, which might cause this.
In case you would like low CPU usage, you might consider using DoEvents right after Do in the loop, on my PC it cut the usage to almost 0%:
' Empty GUI script created on 11-13-2009 10:16:56 by (ThinAIR)
' Routine to write start time of program and
' writes every 15 min
' W Little
' TY to Michael Clease for file operation
Uses "UI", "CONSOLE"
Uses "FILE"
Dim Minutes As Long
Dim Seconds As Long
Dim sMsg As String
Dim sMsgset As String
Dim errornumber As Long
Dim FileHandle As DWord
Dim Status As DWord
Dim TestString As String
Dim FileName As String
'-----------------------------------------------------
' Start
TestString = Time$ ' String to write to file
FileName = APP_ScriptPath + "test.txt" ' Build filename
Status = FILE_Append( FileName, "Time Started at -- "+ TestString )
Do
DoEvents ' < ---
errorNumber = Err
'console_writeline err
Minutes = Mid$(Time$, 4, 2) ' Extract the Day from the returned string
Seconds = Mid$(Time$, 7, 4)
'console_writeline MINutes
sMsg = Minutes + Seconds
' -- MOD gives remainder of division minutes / 15
If Mod(minutes, 15) = 0 And Seconds = 0 Then
cbPrintScreen()
End If
Loop
Sub cbPrintScreen()
If sMsg <> sMsgset Then
Console_WriteLine Time$
TestString = Time$ ' String to write to file
FileName = APP_ScriptPath + "test.txt" ' Build filename
Status = FILE_Append( FileName, TestString )
' sMsg = FILE_Load(Filename)
sMsgset = sMsg
End If
End Sub
If you want to try the maximum time with your EEE, lower the CPU usage is, longer it will stay awake.
Another cleaner solution would be to create dialog with timer - it executes code when timer event is generated:
Uses "UI", "File"
' -- ID numbers of controls
Begin Const
%bClose = 1000
%eLog
%tTimer
End Const
Global sMsg As String
Global sMsgset As String
Global errornumber As Long
Global FileHandle As DWord
Global TestString As String = Time$
Global FileName As String = APP_ScriptPath + "test.txt"
Global Status As DWord = FILE_Append( FileName, "Time Started at -- "+ TestString )
Global hDlg As DWord
' -- Create dialog here
Function TBMAIN()
Dialog NEW 0, "Notebook Tester",-1,-1, 160, 120, _
%WS_POPUP Or %WS_VISIBLE Or %WS_CAPTION Or %WS_SYSMENU Or %WS_MINIMIZEBOX To hDlg
' -- Place controls here
Control ADD TEXTBOX, hDlg, %eLog, "Time Started at -- "+ TestString+$CRLF, 5, 5, 150, 90, %ES_MULTILINE
Control ADD BUTTON, hDlg, %bClose, "Click to close", 95, 100, 60, 14, Call btnCloseProc
Dialog SHOW MODAL hDlg, Call dlgProc
End Function
' -- Callback for dialog
CallBack Function dlgProc()
Local Minutes, Seconds As Long
' -- Test for messages
Select Case CBMSG
Case %WM_INITDIALOG
' -- Put code to be executed after dialog creation here
' 30s timer
Dialog SET Timer CBHNDL, %tTimer, 1000*30, 0
' -- Timer event is launched on timer tick
Case %WM_TIMER
errorNumber = Err
Minutes = Mid$(Time$, 4, 2) ' Extract the Day from the returned string
Seconds = Mid$(Time$, 7, 4)
sMsg = Minutes + Seconds
' -- MOD gives remainder of division minutes / 15
If Mod(minutes, 15) = 0 And Seconds = 0 Then
cbPrintScreen()
End If
Case %WM_CLOSE
' -- Put code to be executed before dialog end here
FILE_Append( FileName, "Program ended at "+Time$ )
End Select
End Function
' -- Callback for close button
CallBack Function btnCloseProc()
If CBMSG = %WM_COMMAND Then
If CBCTLMSG = %BN_CLICKED Then
' -- Closes the dialog
Dialog End CBHNDL
End If
End If
End Function
Sub cbPrintScreen()
If sMsg <> sMsgset Then
Control APPEND TEXT hDlg, %eLog, Time$+$CRLF
TestString = Time$ ' String to write to file
FileName = APP_ScriptPath + "test.txt" ' Build filename
Status = FILE_Append( FileName, TestString )
sMsgset = sMsg
End If
End Sub
Bookmarks