Rorax Posted October 26, 2011 Posted October 26, 2011 Good morning, I have a problem I thought I'd share and see if anyone have any suggestions. I am trying to get some basic functions working through my cellphone, like turning on and turning off my computer. I have checked out some apps doing just this but they usually contain a lot of other things I do not want and a third party application you need to install on your computer or they require you to remotely connect to your computer and control it to turn it off manually. What I want to do is the easy way I guess. I made an easy script that check the status of a program that monitors for wake-on-lan packages on a port that isnt used for wake-on-lan packages and if it see a package it will turn the computer off. The problem with that is that I cant run my script as a service, because unless I log in the program that monitors Wake-on-lan activity wont run. So I was wondering, is it possible to have an autoitscript monitor for WOL packages? Regards, Rorax
lgvlgv Posted October 26, 2011 Posted October 26, 2011 (edited) think that could be done in teori, but "wake on lan" dosent do router jumps without "IP Helper" on the routers. if u have another machine on the sam subnet on, he can issue the WOL broadcast http://en.wikipedia.org/wiki/Wake-on-LAN Edited October 26, 2011 by lgvlgv
Rorax Posted October 27, 2011 Author Posted October 27, 2011 think that could be done in teori, but "wake on lan" dosent do router jumps without "IP Helper" on the routers. if u have another machine on the sam subnet on, he can issue the WOL broadcast http://en.wikipedia.org/wiki/Wake-on-LAN I got the setup working so I can send the package from the phone, but to detect the package on my computer while its running I rely on a program to do. Basically this is how its set up 1. I send a wake on lan package from my cellphone (from the 3G net, not from my wireless)2. Computer wakes up3. A program that montiors for Wake on lan packages starts (if I login to the computer)4. I send another wake on lan package from my cellphone (on a different port)5. An autoit script checks the state of the program, and when it recieves a wake on lan package it turns the computer off What I wish I could do is put the function of the program part into the script so I can run it as a service instead. That way I am not forced to log into the computer or have an autologin for this to work..but I dont even know where to start.
lgvlgv Posted October 27, 2011 Posted October 27, 2011 (edited) First!!!Im not a programmer but here is what i did to make a service that starts automatic, i know the syntax in the create servie must be wrong but it works here is what i did to create a service that starts automatic and wait on TCPIP to start.se more about services Func InstallService() If Not (IsAdmin()) Then MsgBox(0, "ChargeDeamon", "Admin rights needed, will exit now") Exit EndIf _Service_Create($sServiceName, $sServiceName, BitOR($SERVICE_INTERACTIVE_PROCESS, $SERVICE_WIN32_OWN_PROCESS), $SERVICE_AUTO_START, $SERVICE_ERROR_NORMAL, '"' & @WindowsDir & '\' & @ScriptName & '"',StringStripCR("Tcpip"),StringStripCR("Tcpip"),StringStripCR("Tcpip")) If @error Then Return 0 Else in the service i only have this running.sleep(10000) While $gServiceStateRunning ; If ProcessExists("CH-Menu.exe") Then ; Sleep(10) ; Else ; if FileExists(@WindowsDir & "\CH-Menu.exe") Then ; ShellExecute(@WindowsDir & "\CH-Menu.exe"," /ErrorStdOut") ; Endif ; EndIf If ProcessExists("CH-Agent.exe") Then Sleep(10) Else if FileExists(@WindowsDir & "\CH-Agent.exe") Then ShellExecute(@WindowsDir & "\CH-Agent.exe"," /ErrorStdOut") EndIf EndIf WEnd Local $tempProc1 = ProcessExists("CH-Agent.exe") If $tempProc1 Then ProcessClose($tempProc1) EndIf _Service_Cleanup() then i had my main program in the "CH-Agent.exe" if u use WOL dont forget to enable WOL in the BIOS of the computer u want to wake up. Edited October 27, 2011 by lgvlgv
Rorax Posted October 28, 2011 Author Posted October 28, 2011 First!!! Im not a programmer but here is what i did to make a service that starts automatic, i know the syntax in the create servie must be wrong but it works here is what i did to create a service that starts automatic and wait on TCPIP to start. se more about services Func InstallService() If Not (IsAdmin()) Then MsgBox(0, "ChargeDeamon", "Admin rights needed, will exit now") Exit EndIf _Service_Create($sServiceName, $sServiceName, BitOR($SERVICE_INTERACTIVE_PROCESS, $SERVICE_WIN32_OWN_PROCESS), $SERVICE_AUTO_START, $SERVICE_ERROR_NORMAL, '"' & @WindowsDir & '\' & @ScriptName & '"',StringStripCR("Tcpip"),StringStripCR("Tcpip"),StringStripCR("Tcpip")) If @error Then Return 0 Else in the service i only have this running. sleep(10000) While $gServiceStateRunning ; If ProcessExists("CH-Menu.exe") Then ; Sleep(10) ; Else ; if FileExists(@WindowsDir & "\CH-Menu.exe") Then ; ShellExecute(@WindowsDir & "\CH-Menu.exe"," /ErrorStdOut") ; Endif ; EndIf If ProcessExists("CH-Agent.exe") Then Sleep(10) Else if FileExists(@WindowsDir & "\CH-Agent.exe") Then ShellExecute(@WindowsDir & "\CH-Agent.exe"," /ErrorStdOut") EndIf EndIf WEnd Local $tempProc1 = ProcessExists("CH-Agent.exe") If $tempProc1 Then ProcessClose($tempProc1) EndIf _Service_Cleanup() then i had my main program in the "CH-Agent.exe" if u use WOL dont forget to enable WOL in the BIOS of the computer u want to wake up. Thanks, I'll try that. I also think I got an idea on the whole WOL thing. And that is to use tcpdump and make it report it to a file. Then have the script scan the file for the package I'm after. Wont have time to try it for a while though. But in theory it should work.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now