Jump to content
Macro Express Forums

Using Macro Express on a VPS


Recommended Posts

I am wanting to run a macro on a VPS.  There were a few posts on this topic some years ago, but nothing seemed to be resolved.  Per the VPS hosting site I contacted, he said I will have problems when I close the connection between my computer and the server due to the keyboard and mouse no longer being active.  He said I would need to use Session 0 and that Remote Desktop Services uses Session 1.  He suggested using Team Viewer or VNC as they use Session 0.  I am not familiar with Windows Session or how to invoke one versus the other.  I also do not know if I use Team Viewer or VNC, can they be disconnected and have the server maintain Session 0?  It would defeat the purpose if I had to keep a remote connection open between my PC and the VPS.

 

Has anyone successfully run a macro that needs mouse, keyboard, and monitor on a VPS?  Is a Virtual Machine the only reasonable way to do this?

 

Thank you for any help you can offer!

Link to comment
Share on other sites

7 hours ago, Brian White said:

It would defeat the purpose if I had to keep a remote connection open between my PC and the VPS.

Has anyone successfully run a macro that needs mouse, keyboard, and monitor on a VPS?

 

It sounds like the macro is to run only when your remote connection is open.  Yes?  No?  Could you start Macro Express itself right after (or as part of) initiating the connection, and kill it when disconnecting?  Or does the macro need to continue running after you disconnect, doing stuff that no longer needs keyboard/mouse/monitor?  

Link to comment
Share on other sites

Sorry!  I was not clear.  The macro runs continuously.  At the moment, I have a PC running the macro continuously trading the forex markets.  I would like to move this to a VPS so I am not running my laptop 24/5.  The macro is tying together multiple data sources with the trading platform.  Some of the steps in the macro require the keyboard, mouse, and location on the screen.  Consequently, if the closure of the remote connection causes these Windows services to shut down, then the macro will stop functioning.

 

Thank you for taking the time with my question.

Link to comment
Share on other sites

Sounds very interesting. 

 

I am kind of thinking out loud here, so what follows may be useless.

 

Could you use the Windows Task Scheduler, on the server, to start Macro Express?  Or just start ME when the server starts up.  The macro itself could be started by the scheduler within Macro Express. 

 

Or (see Command Line Options in Macro Express Help) the /A option can start the macro with program MEPROC.EXE via a Windows-scheduled batch file. 

 

I have run macros repeatedly or continuously on a server using those methods.  Mine did not use the mouse/keyboard/monitor, however.  I'm not sure whether this would work in your case.  Since ME would be starting and running independently of your remote session, I don't know whether it would use imaginary peripherals. 

 

Maybe you could just buy a cheap PC and dedicate it to be always remotely connected to the server, so as to avoid impacting your primary machine?  Or just forget about the VPS server and run the macro on the dedicated PC?

Link to comment
Share on other sites

I am currently running a dedicated PC and it does work well.  The macro boots via the ME schedule option; if ME starts, so does the macro.  I also have it set up whereby if the macro detects an issue that it cannot correct, it will reboot the PC and restart ME.  Most issues I have had have been from running through a VPN in Europe from North America.  This is another reason to use a VPS.  Also, while traveling, I have to shut the PC off and move it.  A VPS seems to make sense...if I can get it to work!

 

I have followed up with the VPS supplier to confirm if Team Viewer or VNC will keep the Windows services running when disconnected.

Link to comment
Share on other sites

  • 1 month later...

I have been running MEPro for years on a VPS.  The trick is to not log off, but move your current (remote logged on) windows session to the "console" session.  When Windows server is in "console" mode, keyboard and mouse and screen are still available, but the session is running without any connection to a remote terminal.
I use the following batch (DOS) commands to put the current remote session to the console session:
for /f %%i in ('qwinsta ^| findstr /C:">rdp-tcp#"') do set RDP_SESSION=%%i
:: Strip the >
set RDP_SESSION=%RDP_SESSION:>=%
tscon %RDP_SESSION% /dest:console

 

It is the TSCON command that will assign a session to the console session (/dest:console).  The first 2 lines in the batch file are to determine the session number of the current remote logged on session.

The result is that you will leave the remote connected server, but MEPro will still run and trigger macros.

 

  • Thanks 1
Link to comment
Share on other sites

First and foremost, thank you very much for the reply.  It seems you are doing exactly what I would like to do.  You are also way beyond me with computer skills; I am not familiar with most of the command line commands.

 

I just typed the first line at the command prompt and it returned an error of "%%i was unexpected at this time."  The second line looks like a comment to me to remove the ">", so I removed it from the line of code, but the result was the same.

 

I think I understand how the batch file would work.  It seems that it will change the VPS session to what the local computer was running so it will have access to the mouse, keyboard, and monitor without the local computer being connected to the VPS. I am not familiar enough with the commands to be able to understand and correct the error it is giving me.

 

My apologies for being slow with what you are saying.  I hope you will have the time to give me a bit more more guidance.

 

Thank you for your help!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...