computergroove

Powercycling the power control in Hamachi

8 posts in this topic

#1 ·  Posted (edited)

WinActivate("LogMeIn Hamachi")
Sleep(1000)
ControlSend("LogMeIn Hamachi","","Power","{SPACE}")
WinSetState("LogMeIn Hamachi","",@SW_MINIMIZE)

I have a client that is using Hamachi to remote access her office PC from home with VNC. There is an issue where the clients in the Hamachi network will randomly stop communicating with the rest of the Hamachi network group. The quick fix is to log into teamviewer and click the power button and let hamachi "power off" and then power it back on. This usually fixes it. I had her pay the $29 annual fee thinking that the problems would go away but they haven't. I made the above script and it does power off the machine and I can run it again to turn it back on but I would like to do it without having to activate the Hamachi window and then power cycling it then minimizing it. Also I would like to get notified if there is a client in the Hamachi window that is on the net but cannot connect. The difference in the GUI is that the client is flagged as red if they cannot connect, green if everything is ready and grey/white if they are offline. Any assistance on this is appreciated. Yes the above code works to power the hamachi network on and if I run it again it will power it off.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well the solution to the first issue is simple, all you have to do is ControlSend 2 times without the rest

ControlSend("LogMeIn Hamachi","","Power","{SPACE}")
ControlSend("LogMeIn Hamachi","","Power","{SPACE}")

ill look into the other issue tho i think its not easy/possible to get pixels without focus.

instead why don't you check Hamachi log file maybe it can tell you if somebody is on the network and cant connect. i cant test it because my other computer is not currently working.

 

Edited by CrypticKiwi

Share this post


Link to post
Share on other sites

If I just put

ControlSend("LogMeIn Hamachi","","Power","{SPACE}")

without the other then it doesn't work. Doing it twice won't either.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

It Works for me, got my second pc working  and tested it twice on two different pcs.

what version of Hamachi/Autoit/Windows are you using?

Before_Nafter.png

Edited by CrypticKiwi

Share this post


Link to post
Share on other sites

Hamachi Version 2.2.0.383.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Hamachi Version 2.2.0.383.

what about windows and Autoit?

Share this post


Link to post
Share on other sites

Windows 8.1 and autoit version 3.3.14.1


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

some people are having the same problem controlsend works on one pc but not the other...Try to run the script as admin and disable UAC. 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • lganta
      By lganta
      Hello!
      I created some scripts for a simple farming bot a few years ago and they rely on ControlSend.
      A year ago I quit that game and then installed Windows 10 (was using windows 7).
      Recently I installed that game and tried running them again and they seem to work (I have some messages displayed on the screen with the state of the bot ), except for the ControlSend part (which obviously is crucial).
      I started debugging the scripts so I created a basic script that makes use of Send. I tested this with Notepad in focus and works just fine and then with my game window in focus and it didn't work (it's supposed to write that text in an input box from the game).
      #include <MsgBoxConstants.au3> Sleep(3000); Send("some text"); MsgBox($MB_OK, "Notification", "Control was sent!");  
      Is there a way for the creators of the game to create some kind of security system against this? Or something happens because I updated to Windows 10?
      Is there something I'm missing?
      Thank you!
    • rawkhopper
      By rawkhopper
      Hello everyone,
      I have a script that is automating a piece of sluggish software.  I want to automate it with a bit of caution and I am not sure the best way to do it.  ControlSend works great most of the time.  If I have it enter 10 into a text box every once in a while it will enter 1 or 11 and then hit enter.
      To overcome this I use MouseClick to select the text I just entered and then see if it matches the string it was supposed to put in before it hits enter.  This seems to work but what I love about ControlSend is there is less room for human interaction messing it up.  
      Yes I could block input but I prefer not to do that (permissions).
      Is there a better way of doing this?  Any Help would be much appreciated.
      Anyway here is the snippet of the script in question:
      Func KVSend () WinActivate ( "Window", "" ) Local $WindowPos = WinGetPos("Window", "") If $kV < 30 Then WinActivate ( "Window", "" ) ControlClick ("Window", "", 1001) ;Click in Accel Voltage box Sleep (100) ControlSend ("Window", "", 1001, $kV) ; \ kV Sleep (100) MouseMove($WindowPos[0]+130,$WindowPos[1]+75,1) MouseClick($MOUSE_CLICK_LEFT) MouseClick($MOUSE_CLICK_LEFT) Send ("^c") Local $clip = ClipGet () If $clip = $kV Then ControlSend ("Window", "", 1001, "{ENTER}") ;Hit ENTER if value is correct Sleep (100) ControlClick ("Window", "", 1518) ;Lens Clear Else Send ("{BACKSPACE}") KVSend() ; If value is incorrect try again EndIf EndIf  
    • magmet00
      By magmet00
      Do you have a working imagesearch.au3 with working dll?
      and how can i gethandle and send keyboard/mouse commands to hidden d3d window?
       
      i have tried imagesearch2015 but im getting dll error every time and tried older imagesearchs too in forum what i found.
      i have tried many things to send commands to hidden/background d3dwindow still nothing works.
      Can you help me please?
       
    • Guy_
      By Guy_
      Was testing ControlSend("My Window Name", "", "", "^c") vs the normal Send("^c") or _SendEx("^c") to copy selected text from a window...
      In Windows, I have a setting that when I click the Ctrl key only, my mouse pointer is "highlighted" [that I could of course disable].
      If I use Send("^c"), or do this manually, the mouse pointer is never highlighted, as I wish it to be.
      With ControlSend it *does* highlight...
      I thought that maybe the Ctrl key goes up a few ms too soon in that one and increased AutoItSetOption("SendKeyDownDelay", 5) to way higher, but it doesn't make a difference.
      As it doesn't seem possible to do "^ down", could it be prevented in some way?
      Beside the slight annoyance, it simply alerted me that these seem to work differently [and of course, they are different].
      I also get the early impression that ControlSend [to copy] seems in no way quicker to get something on the clipboard, maybe even slower?
      Thanks 
    • SkysLastChance
      By SkysLastChance
      How would I go about writing a IF Then statement if the conrol send fails?
      Run ("Notepad.exe") WinWaitActive ("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "Edit1", ("Provider Practice Record")) I have been running into lag alot. So my script has been missing input. I would like to be able to have it retry to put in "Provider Practice Record" if it misses. 
      I am assuming  a if then statement is what I need but I am not sure what ControlSend will return if it tries to send to Edit1 and it is not there. 
      Or do I need to just add a timeout?