Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/11/2004 Posts: 7
|
I have an AutoIt script that starts my TC, updates, and exports a watchlist.
Works great when I am logged in--even shuts down the system when finished.
However, I want this to happen even if I get home late and my PC is off. Have wake-on-lan packet(from server) that turns on my PC and boots to the login screen. I have the task-scheduler running 5 minutes after boot and logging in as me. The task runs as scheduled, but the TC does not run the update/dump--I guess because it has no physical screen? (real screen still at login from boot).
Can anyone tell me how to get this working without leaving my PC on all the time?
Thanks.
|
|
Registered User Joined: 12/11/2004 Posts: 7
|
After searching the forums I have found others looking to automatically update and export their data. I am including an AutoIt script to show how to do this. Please note that AutoIt is well documented, free, and easy to use; Google to find it.
The end of the following script also loads the data into a MySQL database on a remote Linux box for custom programming in Java. Cygwin (Google) is used for bash to run mysqlimport. Default/current TC watchlist is exported. Box is power-off shutdown at the end so I can continue real work on Linux machine.
Run ("C:\Program Files\TeleChart\TeleChart.exe") WinWaitActive ("TeleChart Gold - ") Sleep (8000) ; pause 8 more seconds TC is slow Send("!d") ; alt-Database Send("u") ; Update WinWaitActive ("Update TeleChart Databank") Send("!u") ; Alt-Update
; Sometimes the update process hangs here and must be canceled ; The window name is 'Updating TeleChart' and it is Step 14 ; 'Transferring Description Data', but you cannot tell that.
; wait up to 3 minutes for update report - if it comes
If WinWaitActive("Daily Worden Reports","",180) then send("!o") ; if report window opens, just close it EndIf
; So if the winwait timed-out then check for the hung window ; from above and 'Cancel' it and check for report once more.
if WinExists("Updating TeleChart") Then send("!c") EndIf If WinWaitActive("Daily Worden Reports","",1) then send("!o") ; if report window opens, just close it EndIf
WinWaitActive ("TeleChart Gold - ") ; Now export data Send("!dx") ; Alt-Database, eXport WinWaitActive ("Data Export to Text") Send("!e") WinWaitActive ("TeleChart") Send("{ENTER}") WinWaitActive ("Data Export to Text") Send("!o") WinClose ("TeleChart Gold - ")
sleep (2000)
RunWait (@COMSPEC & " /c C:\cygwin\bin\bash --login -c 'mysqlimport -h mylinuxbox -u myuser " _ & "-pmypassword --delete --local tcdump stock.txt'")
MsgBox(0,"TC2005-Update-Export","TC2005 Update and Export is Complete",2)
Sleep (10000) Shutdown (9)
|
|
Registered User Joined: 12/11/2004 Posts: 7
|
I have a final solution for anyone interested:
With XP Pro you can have your PC logon a user at boot. Go to Start->Run and enter: control userpasswords2
Follow the simple directions at: http://windowsxp.mvps.org/Autologon.htm (there is another way described also)
Now, my cron-scheduled wake-on-lan packet from my Linux box turns on my XP box and automatically logs on my user. Set Task Manager to execute the AutoIT script at logon. The script runs, updates TC, exports the data, loads the data to my Linux/MySQL box, and shuts down the XP box.
Cool, right? Except the script runs even if I want to turn on the box to use the browser and is unsecure with no password required. To get around this I added the following to the start of the AutoIT script:
if @HOUR <> 19 Or @MIN < 50 Or @MIN > 52 Then MsgBox(0, " Unscheduled Startup ", " Locking Session ", 1) Run(@SystemDir&"\rundll32.exe user32.dll,LockWorkStation") Exit ; when password provided, end script EndIf
This locks the session (with password required) if the boot is not in a small time window at the scheduled boot time. When the password is entered, the script stops so I can use the PC normally.
I'm happy with the way this works now.
|
|
Registered User Joined: 10/7/2007 Posts: 13
|
Hi lws,I have a little question. If I only want to export the closing price of the S&P500 members to a file with the name "fivehundred". How do I do this? What do I need to add to your code?Many thanks
|
|
Guest-1 |