Jump to content
Macro Express Forums

Newbie Question with Remote Desktop


Recommended Posts

Have good computer knowledge but new to MacroExpress. Want to create macros on a remote Win 10 computer to which I log in with Remote Desktop. I installed MEPro trial. I want the macros to automate some processes in Act! database program, but I am having trouble with the "Capture" mode. I have been able to capture mouse movements but no keystrokes, and when I run the macro, it minimizes the Act! window and I don't see that anything is happening.

As a test, I am trying to capture just the following in Act!: Alt-i to on Write tab, "T" to Edit Template, double-click mouse on a template, mouse click on "X" to close template and "Enter" to save the template.

 

Is there something about capturing mouse and keystrokes on a remote box via Remote Desktop?

Link to comment
Share on other sites

It's not clear if you are, but the first thing is you need to be running MEP on the RD host machine. Are you doing that?

It's difficult and nearly impossible to make MEP work though the 'window'' of the Remote Desktop client program. 

Link to comment
Share on other sites

When RD is running on the serving RD machine you need to understand that the GUI elements stop functioning when the RD client window is disconnected, minimized, and such when it's a "remote session" of Windows. IOW it needs to be an active window on the client machine.

One can use Remote Desktop to connect to the console session. The console session is the one you connect to when you're physically in front of the machine. I don't remember why, but I had some problems with that too. But it's much more functional. I only skimmed this article, but it seems ot describe how to do that. 

Link to comment
Share on other sites

You might also consider using a different remote access application. I had a client that was running 14 computers using MEP to process huge batches of data. We had some problems with RDP so I used an app I've known for many years called VNC. It natively runs in the console session so it's fundamentally different than the way RDP works. But you need to keep the remote machine physically secure as the session will be open and active. I.E. a person could walk up and see what's happening if the monitor is on or move the mouse and mess up a macro. 

Link to comment
Share on other sites

You are not connected to the console session. All RDP sessions begin with "rdp". No one is logged into the console.

You haven't answered my question. Are you running MEP on the remote machine?

 

Link to comment
Share on other sites

First off I've written hundreds of macros, maybe thousands, and I avoid using mouse moves, clicks, and such like the plague. It only breeds troubles. Also I never record macros and I encourage newbies to not go with the "training wheels" approach and learn to write macros without the recorder. 

Avoid mousing. If you haven't tried it, learn how to use the Windows Controls commands first. For a newbie it's a little challenging to learn, but worth it. I avoided learning them for a long time and when i did I could have shot myself for all the time I wasted not using them. 

The other thing is I would never develop a macro on a remote machine. I would develop it on a test machine then deploy it to a remote machine. Can you develop it locally? 

Link to comment
Share on other sites

Yes, I took your advice on both counts and created macros on my laptop here using keyboard commands only. They both run perfectly on the laptop and do exactly as I intended so I was excited to run them on the remote machine, where they need to interact with the program installed there. So I then exported them to my laptop desktop and emailed them to myself at the remote machine. But I cannot get either one to run on the remote computer, and I have logged in to that machine with RDP. VNC Viewer and Team Viewer. The result is the same with any of the remote access methods...when I select <Debug> <Test Run>, the only activity that ever shows up is a complex pause, and sometimes the typing of text in strange places.I will attach the files and maybe you will see something right awa y that I did incorrectly...

 

I appreciate your help, Cory, and I'm glad to be using the Windows keyboard shortcuts.

F & F Emailer.mex Activities Emailer.mex

Link to comment
Share on other sites

You will be even happier with the Windows Controls. There's a tutorial in the sample macros that installed with MEP using Window Calculator. 

There's a section in the help titled "Controls - Overview. 

I had trouble understanding for a time but then I learned something that made it all clear. The way I saw it the Get Control command seemed misnamed and it confused me. But when I learned how it works, it makes perfect sense. Windows control shave addresses they can be accessed by and MEP needs the address. But they are inconstant. So the Get Control command finds the control using a set of instructions, kind of like driving directions, to the location of the control then it gives one's control variable that  address. 

If you want to save yourself a lot of time in the next year, learn to use Windows Controls. 

I'm sorry I don't have time to review your macros right now. I'll try later this afternoon. One question however. How are you handling the focus of the macro? Are you using "Activate Window" to start with? Also what scope have you been using?

Link to comment
Share on other sites

Here are some observations:

 

Activities Emailer.mex

 

1. I would recommend a delay after the Activate or Launch command. It may take some time for the computer to load the program and be ready to accept keystrokes. This might be why it does not work on the remote computer.

 

2. Since you are not doing any mouse movements or clicks you could remove the Window Resize command.

 

3. Line 16 is

Text Type (Simulate Keystrokes): <CTRL> <SPACE>

Did you intent to have <ctrl><space><space> ? There is an extra space between > and <

 

4. Is there a reason why you cannot combine some of the lines? You could replace several lines beginning on line 71 with

Text Type (Simulate Keystrokes): Neah Activities Message

5. You could simplify the macro by including a Keystroke Speed command and eliminating many of the delays.

 

Friends & Family Emailer.mex has similar issues.

 

Something like this may work (I did not test run this modified macro):

Activate or Launch: Window "Act! Premium", Program "Act! Premium.lnk", Parameters ""
Delay: 4 seconds
 
Keystroke Speed: 1000 milliseconds
Text Type (Simulate Keystrokes): <ALT>it<F4><F6>
Delay: 3000 milliseconds
Text Type (Simulate Keystrokes): <F6>
Delay: 1700 milliseconds
Text Type (Simulate Keystrokes): <F6>
Delay: 1700 milliseconds
Text Type (Simulate Keystrokes): <CTRL><SPACE>
Text Type (Simulate Keystrokes): <CONTROL>c
Delay: 250 milliseconds
Text Type (Simulate Keystrokes): <CONTROL>v
Delay: 1250 milliseconds
 
Text Type (Simulate Keystrokes): <ALT>o
Pause: Complex
Delay: 500 milliseconds
Keystroke Speed: 1000 milliseconds
Text Type (Simulate Keystrokes): <ALT><F4><ALT>y<ALT>imn
Delay: 2000 milliseconds
Text Type (Simulate Keystrokes): e<ENTER><TAB><ENTER><F4><F6><F6><F6>
 
Text Type (Simulate Keystrokes): <CTRL><SPACE><ENTER><TAB><TAB><ENTER>
Delay: 2000 milliseconds
Text Type (Simulate Keystrokes): g<TAB><TAB><TAB><ENTER>
 
Text Type (Simulate Keystrokes): Neah Activities Message
Text Type (Simulate Keystrokes): <ENTER><ENTER><ENTER>

Keystroke Speed: 0 milliseconds
<ACTIVATE OR LAUNCH Title="Act! Premium" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Act! Premium\\Act! Premium.lnk" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12"/>
<DELAY Flags="\x01" Time="4"/>
<COMMENT/>
<KEYSTROKE SPEED Delay="1000"/>
<TEXT TYPE Action="0" Text="<ALT>it<F4><F6>"/>
<DELAY Flags="\x02" Time="3000"/>
<TEXT TYPE Action="0" Text="<F6>"/>
<DELAY Flags="\x02" Time="1700"/>
<TEXT TYPE Action="0" Text="<F6>"/>
<DELAY Flags="\x02" Time="1700"/>
<TEXT TYPE Action="0" Text="<CTRL><SPACE>"/>
<TEXT TYPE Action="0" Text="<CONTROL>c"/>
<DELAY Flags="\x02" Time="250"/>
<TEXT TYPE Action="0" Text="<CONTROL>v"/>
<DELAY Flags="\x02" Time="1250"/>
<COMMENT/>
<TEXT TYPE Action="0" Text="<ALT>o"/>
<PAUSE Flags="\x11" Message="Susan, type in whatever you need to here, or cut and paste text from another document, then click on <Resume>" Left="Center" Top="Center" Monitor="0"/>
<DELAY Flags="\x02" Time="500"/>
<KEYSTROKE SPEED Delay="1000"/>
<TEXT TYPE Action="0" Text="<ALT><F4><ALT>y<ALT>imn"/>
<DELAY Flags="\x02" Time="2000"/>
<TEXT TYPE Action="0" Text="e<ENTER><TAB><ENTER><F4><F6><F6><F6>"/>
<COMMENT/>
<TEXT TYPE Action="0" Text="<CTRL><SPACE><ENTER><TAB><TAB><ENTER>"/>
<DELAY Flags="\x02" Time="2000"/>
<TEXT TYPE Action="0" Text="g<TAB><TAB><TAB><ENTER>"/>
<COMMENT/>
<TEXT TYPE Action="0" Text="Neah Activities Message"/>
<TEXT TYPE Action="0" Text="<ENTER><ENTER><ENTER>"/>
<COMMENT/>
<KEYSTROKE SPEED Delay="0"/>

 

Link to comment
Share on other sites

Thanks, Samrae, for some reason on the remote machine, only some of the commands are being acted on...for example "Alt-i" should open the Write drop-down, then "t" opens the Template folder, etc, etc. But those commands are not acting on the window, and the only command that produces a visible output on the desktop is the complex pause!

Act! Window.PNG

Link to comment
Share on other sites

And you can manually use CTRL+i on the remote machine?

It sounds like your window isn't focused to me. See earlier message. Scope and focus should be set. 

If you learn to use controls as I suggest, you can use the availability of the control to control flow. That way you can wait for the control to exist before sending text to it. Also it doesn't need to be focussed and you don't need scope. Controls are a little hard to understand at first, but they are much better. 

Have you considered importing these contacts into ACT instead of using a macro to create them? I don't know yet what you're doping, so it might not be a good suggestion. 

Link to comment
Share on other sites

Cory,

Here is the situation. I help manage the database for our neighborhood association, and the database (Act!) lives on a Win 10 machine at my friend's house. I set up the router to port forward to the database computer and then we set up RDP so that each of the Board members could be a User and work on the database remotely. They mainly use it to update contact information, but also to send merge letters (emails) to our Members. That's where I had the macro idea. One of the Board members is "intimidated by computers, intimidated by Act!" and I was trying to find a way to automate a plain-vanilla merge document so that all she would have to do would be click on the macro icon and at the appropriate place (the complex pause in the macro) she would only need to enter the text she wants, click <Resume> and the macro would do the merge and send the email. So the macro I created, which works on the local machine, selects <Write>, opens a template, makes a copy of the template and then opens that copy for her to insert text. When she hits <Resume> the macro finishes the merge and send the email.

 

As I said, it works perfectly on my local laptop, but not over RDP (or for that matter neither VNC Viewer nor Team Viewer) on the remote machine. I have been trying to work with the Controls you mentioned, but I am NOT a programmer, and it's going to take way too much time for me to become familiar enough to get it to work that way...and after all, I am just trying to create one macro...I may not create another one for months! So if I could just solve this one problem of getting it to run on the database (remote) machine, I'd be all set.

 

I'm attaching a snip of the results of "Query Session" run on the remote machine when I logged in with VNC Viewer. It says I am logged into the console, but not ID=0. I read that now Windows reserves ID=0 for "Services".

Query Session.PNG

Link to comment
Share on other sites

19 hours ago, IndigoJon said:

for some reason on the remote machine, only some of the commands are being acted on...for example "Alt-i" should ...

 

Sometimes <ALT>i does not work. Try using <ALTD>i<ALTU>. While I sometime run across a program where things like <ALT>i do not work I have never had an instance where <ALTD>i<ALTU> failed for me.

Text Type (Simulate Keystrokes): <ALTD>i<ALTU>
Delay: 500 milliseconds
 Text Type (Simulate Keystrokes): t
Delay: 500 milliseconds

 

Link to comment
Share on other sites

When Macro Express runs it can type keystrokes and move or click the mouse much faster than a human can do it manually. Each computer and application responds differently. I would expect that connecting to your neighbor's computer via RDP is much, much slower than running ACT on your laptop.

 

It is possible that the problem is as Cory describes where keystrokes and mouse movements are not occurring because of the RDP connection and the application having focus. However, it could also be that the macro is just running too fast.

 

Here are some suggestions.

 

1. Try having the macro type ridiculously slowly. This lets you watch each step as it occurs. I suggest Keystroke Speed: 500 milliseconds. My previous recommendation of Keystroke Speed: 1000 milliseconds is too slow.

 

Watch the macro run. Make a note about what works and what does not. If even one keystroke works then you should be able to get the macro to work.

 

2. Try launching Notepad (notepad.exe) and typing something into it. That will help us determine if the issue is with RDP, keystrokes, or ACT. Here is a sample you can just copy (from the second box) and paste into a new macro.

  Program Launch: "Notepad.exe" (Normal)
Parameters: 
   
  Delay: 0.3 seconds // Wait for Notepad to come up and get focus
  Text Type (Simulate Keystrokes): This is a test: %Count%
   
  Keystroke Speed: 500 milliseconds
  Text Type (Simulate Keystrokes): <ENTER><ENTER>The macro should be typing very slowly now.
1
2
3

DONE

  Keystroke Speed: 0 milliseconds
<PROGRAM LAUNCH Path="Notepad.exe" Mode="\x00" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/>
<COMMENT/>
<DELAY Flags="\x01" Time="0.3" _COMMENT="Wait for Notepad to come up and get focus"/>
<TEXT TYPE Action="0" Text="This is a test: %Count%"/>
<COMMENT/>
<KEYSTROKE SPEED Delay="500"/>
<TEXT TYPE Action="0" Text="<ENTER><ENTER>The macro should be typing very slowly now.\r\n1\r\n2\r\n3\r\n\r\nDONE\r\n"/>
<KEYSTROKE SPEED Delay="0"/>

3. It is possible that Macro Express needs to run as Administrator in order to interact with ACT.

 

Link to comment
Share on other sites

I'll answer your questions in order:

1. I changed the keystroke speed to 500, and it did not correct the problem. I am assuming a person just enters that speed command at the beginning of he macro, not before each command.

2. I can launch Notepad and type text into it with no problem. I was able to copy the Notepad macro and it runs without problem.

I can also type commands over RDP like <Alt> i, and the Write menu in Act opens.

3. I am running Macro Express as Administrator.

 

Is there somewhere that I can find a tutorial on using Windows Controls that is written for someone who is not a programmer?

 

Thanks for all of your help...I really appreciate it!

Link to comment
Share on other sites

Your response tells us that it is possible to run a macro on the remote computer (assuming you ran Notepad on the remote computer). At this point I would not worry about Window Controls (sorry Cory). Maybe later but not right now.

 

This is how I would approach this. (Do all this on the remote machine.) Put a Macro Stop command in your macro. Start by putting it after the launch of ACT and, perhaps, the first keystrokes. Run it. If something does not work adjust the macro commands until it does. If it does what it is supposed to move the Macro Stop command down in your macro. Run that. Repeat.

Link to comment
Share on other sites

So I tried it with just a few lines. Nothing happens. I have found it best if I actually launch the program manually, put in the password etc, and get to the screen that you see attached here. With that screen visible, if I hit <Alt>i, the Write button opens. But with the commands you see both in Script Editor and Direct Editor view, nothing happens. The Act! program doesn't see the keyboard command <Alt>i for some reason. I'm tearing out my hair!!! 

 

Here is the Direct Editor file: <MACRO PLAYBACK SPEED Speed="1"/>
<ACTIVATE OR LAUNCH Title="Act! Premium - NeahNewServer" Exact_Match="TRUE" Wildcards="TRUE" 
Path="C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Act! Premium (Web)\\Act! Premium (Web).lnk"
 Mode="\x00" Default_Path="TRUE" Wait="10" Wait_For_Program="15"/>
<DELAY Flags="\x01" Time="5"/>
<WINDOW ACTIVATE Title="Act! Premium - NeahNewServer" Exact_Match="TRUE" 
Wildcards="FALSE" _PROMPT="0x0006" _PROMPT="0x0007" _PROMPT="0x0008" _PROMPT="0x0003"/>
<KEYSTROKE SPEED Delay="500"/>
<TEXT TYPE Action="0" Text="<ALT>i"/>
<DELAY Flags="\x03" Time="500"/>
<TEXT TYPE Action="0" Text="t"/>
<DELAY Flags="\x03" Time="500"/>
<MACRO STOP/>

Act! Window.PNG

Script Editor Clip.PNG

Link to comment
Share on other sites

Did you try the suggestion from Samrae to use <ALTD>i<ALTU>?

 

i would also use the regular Delay command.

 

I agree about not getting into Controls at this stage of your experience.

 

To narrow the diagnostic focus, have you tried a simple local macro, not remote, using that keystroke successfully?

 

Link to comment
Share on other sites

I tried Samrae's <AltD>i<AltU> and that did not work.

 

I created a short macro on my laptop that activates the Act! window, types Alt-i, then Alt-t and saved it as a playable macro. On the laptop it opens the Write drop-down, then opens the list of Templates (the Alt-t). So on the laptop it works fine.

I sent it to me as an email attachment, opened the email on the RDP remote machine, dragged the playable to the desktop, and opened the same Act! window. Clicking on the playable shortcut does nothing! 

 

Maybe this is just some problem with Act! ? As Samrae had suggested, I copied the Notepad macro he created, put it into a new macro on the Remote machine, and it played fine, opened Notepad etc., etc. I don't know what else to do, but pretty frustrated.

Link to comment
Share on other sites

You don't need to be a programmer. I wasn't a programmer when I learned them. It's actually simple. All typical programs have a form. On that form are controls. Controls are, as they imply, things that users control. For the most part, anyway. To define the control it dead simple. ISS even gives you a little utility to pick the control. If I want to get the text from a control, I do a Get Control command and, well, get the text from the control. It takes 2 lines. 

What's also nice is that you have a built in flow control by adding aits for the controls. Also you're not slave to text typing delays and such. You simply set the controls text. Boom! Done.

 

It does sound like you're using focus. I've mentioned scope and focus but I haven't heard you explain how you'e controlling focus yet. What are you doing. Sorry, I don't have time to read your macro. 

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...