Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows logon script, run macro (exe) when pc fully booted
#2
I think there are no reliable ways to know when Windows and startup programs/services are fully loaded. Also, depends on what must be loaded/working. Is it when Windows becomes quiet and responsive, or when you can access network files, internet, or when certain process is loaded, etc.

For me, the main indicator that Windows is still loading is disk activity. This code waits while disk is busy.
Code:
Copy      Help
int n d=GetDiskUsage
;int c=GetCPU
rep
,1
,d=GetDiskUsage
,out d
,;out "%-5i %5i" d GetCPU
,if(d<=5)
,,n+2
,,if(n>=10) break
,else if(n>0) n-1
GetDiskUsage uses performance counters. On some Windows versions it does not work if the macro runs not as administrator.
This code may wait too long if something uses disk after Windows is fully loaded, for example some Windows service or antivirus. Try to replace 5 to 20 or 50. Waiting for CPU is less reliable. Maybe better simply use wait 10 or wait 20 etc, depending on your PC startup speed.

To wait for a tray icon, wait for its accessible object.
Code:
Copy      Help
int w=wait(60 WV win("" "Shell_TrayWnd"))
Acc a.Find(w "PUSHBUTTON" "QTranslate 4.1.0" "class=ToolbarWindow32[]id=1504" 0x1005 60)

See also:
http://stackoverflow.com/questions/1050 ... er-startup


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)