Jump to content
Macro Express Forums

All Activity

This stream auto-updates

  1. Earlier
  2. It's my favourite as well, and the most effective. I might experiment with your refinement to see if it improves things. I thought of a fourth solution this afternoon. which I thought would be the best. But when I started using it on real spreadsheets, I noted the active cell was too inconspicuous when the surrounding cells were certain colours. But it's an interesting concept: Text Type (Simulate Keystrokes): <ESC> // If a cell is being edited, exit edit mode. Text Type (Simulate Keystrokes): <CONTROL>a<CONTROL>a // Select the spreadsheet. (Must press Ctrl+A twice to capture everything) Delay: 1000 milliseconds // While spreadsheet is selected, the active cell is a different colour Text Type (Simulate Keystrokes): <ARROW RIGHT><ARROW LEFT> // Deselect
  3. Clever. I didn't think of "undo". I like your third solution best, because there is no need to navigate through secondary panels. Just a couple quick keystrokes and it's done. In case the view has been previously shifted so the active cell is not visible, adding the ArrowRight-Arrow left before selecting row and column will bring it back into view.
  4. Here are three solutions. The first is inspired by rberq's. Originally, my version of his script changed the Pattern Style twice: change the pattern, wait a second, and change the pattern back to its default. My "aha" moment was realizing the second half of the script was unnecessary. All I had to do was change the pattern once, and then undo. // In Excel 2019, the focus ring is harder to spot than in previous versions. // Temporarily change "Pattern Style" of the selected cells Text Type (Simulate Keystrokes): <CTRLD>1<CTRLU> // Hotkey to show "Format Cells" window Delay: 100 milliseconds // (May need a longer delay for "Format Cells" to appear) Window Resize: Format Cells Size: 0, 0 // Shrink size to zero so script is less "flashy" Text Type (Simulate Keystrokes): p // Navigate directly to the "Protection" tab, then left to the "Fill" tab Text Type (Simulate Keystrokes): <ARROW LEFT> Text Type (Simulate Keystrokes): <ALT>p // Navigate to "Pattern Style" Text Type (Simulate Keystrokes): <ARROW RIGHT><ENTER> // Choose the first pattern to the right Text Type (Simulate Keystrokes): <TAB><ENTER> // Finalize the choice Delay: 800 milliseconds // Flash the pattern for this long Text Type (Simulate Keystrokes): <CONTROL>z // Undo the above action <COMMENT Value="In Excel 2019, the focus ring is harder to spot than in previous versions."/> <COMMENT Value="Temporarily change \"Pattern Style\" of the selected cells"/> <COMMENT/> <TEXT TYPE Action="0" Text="<CTRLD>1<CTRLU>" _COMMENT="Hotkey to show \"Format Cells\" window"/> <DELAY Flags="\x02" Time="100" _COMMENT="(May need a longer delay for \"Format Cells\" to appear)"/> <COMMENT/> <WINDOW RESIZE Option="\x01" Title="Format Cells" Partial="FALSE" Wildcards="FALSE" Method="\x00" Width="0" Height="0" _IGNORE="0x0006" _COMMENT="Shrink size to zero so script is less \"flashy\""/> <COMMENT/> <TEXT TYPE Action="0" Text="p" _COMMENT="Navigate directly to the \"Protection\" tab, then left to the \"Fill\" tab"/> <TEXT TYPE Action="0" Text="<ARROW LEFT>"/> <COMMENT/> <TEXT TYPE Action="0" Text="<ALT>p" _COMMENT="Navigate to \"Pattern Style\""/> <TEXT TYPE Action="0" Text="<ARROW RIGHT><ENTER>" _COMMENT="Choose the first pattern to the right"/> <TEXT TYPE Action="0" Text="<TAB><ENTER>" _COMMENT="Finalize the choice"/> <COMMENT/> <DELAY Flags="\x02" Time="800" _COMMENT="Flash the pattern for this long"/> <COMMENT/> <TEXT TYPE Action="0" Text="<CONTROL>z" _COMMENT="Undo the above action"/> For the second solution, you must change a setting in Control Panel > Mouse > Pointer Options. "Show location of pointer when I press the CTRL key" must be checked. The script makes a cell visible by flashing the pointer indicator three times. // In Excel 2019, the focus ring is harder to spot than in previous versions. // In "Mouse Properties" check "Show location of pointer when I press the CTRL key" // This script uses the feature to flash the mouse pointer near the focused cell. Get Mouse Position into (%x%, %y%) Relative to Current Window // Get current mouse position Mouse Move: To the Text Cursor Position Mouse Move: 30, 10 Relative to Last Position // Nudge the pointer toward the centre of the cell Text Type (Simulate Keystrokes): <CTRLD> Text Type (Simulate Keystrokes): <CTRLU> Delay: 300 milliseconds Text Type (Simulate Keystrokes): <CTRLD> Text Type (Simulate Keystrokes): <CTRLU> Delay: 300 milliseconds Text Type (Simulate Keystrokes): <CTRLD> Text Type (Simulate Keystrokes): <CTRLU> Mouse Move: %x%, %y% Relative to Current Window // Restore original mouse position <COMMENT Value="In Excel 2019, the focus ring is harder to spot than in previous versions."/> <COMMENT Value="In \"Mouse Properties\" check \"Show location of pointer when I press the CTRL key\""/> <COMMENT Value="This script uses the feature to flash the mouse pointer near the focused cell."/> <GET MOUSE POSITION Option="\x01" X="%x%" Y="%y%" _COMMENT="Get current mouse position"/> <COMMENT/> <MOUSE MOVE Option="\x00" X="0" Y="0" _PROMPT="0x000A"/> <MOUSE MOVE Option="\x03" X="30" Y="10" _PROMPT="0x000A" _COMMENT="Nudge the pointer toward the centre of the cell"/> <COMMENT/> <TEXT TYPE Action="0" Text="<CTRLD>"/> <TEXT TYPE Action="0" Text="<CTRLU>"/> <DELAY Flags="\x02" Time="300"/> <TEXT TYPE Action="0" Text="<CTRLD>"/> <TEXT TYPE Action="0" Text="<CTRLU>"/> <DELAY Flags="\x02" Time="300"/> <TEXT TYPE Action="0" Text="<CTRLD>"/> <TEXT TYPE Action="0" Text="<CTRLU>"/> <COMMENT/> <MOUSE MOVE Option="\x02" X="%x%" Y="%y%" _PROMPT="0x000A" _COMMENT="Restore original mouse position"/> The third solution shows the current cell by selecting and deselecting the entire row, and then selecting and deselecting the entire column. The point where the two "lines" intersect is the active cell. // In Excel 2019, the focus ring is harder to spot than in previous versions. // Select the row, then select the column. The active cell is where the two "lines" meet Text Type (Simulate Keystrokes): <ESC> // If a cell is being edited, exit edit mode. Text Type (Simulate Keystrokes): <SHIFT><SPACE> // Select the entire row, pause, then deselect Delay: 900 milliseconds Text Type (Simulate Keystrokes): <ARROW RIGHT><ARROW LEFT> Text Type (Simulate Keystrokes): <CONTROL><SPACE> // Select the entire column, pause, and deselect Delay: 900 milliseconds Text Type (Simulate Keystrokes): <ARROW RIGHT><ARROW LEFT> <COMMENT Value="In Excel 2019, the focus ring is harder to spot than in previous versions."/> <COMMENT Value="Select the row, then select the column. The active cell is where the two \"lines\" meet"/> <COMMENT/> <TEXT TYPE Action="0" Text="<ESC>" _COMMENT="If a cell is being edited, exit edit mode."/> <COMMENT/> <TEXT TYPE Action="0" Text="<SHIFT><SPACE>" _COMMENT="Select the entire row, pause, then deselect"/> <DELAY Flags="\x02" Time="900"/> <TEXT TYPE Action="0" Text="<ARROW RIGHT><ARROW LEFT>"/> <COMMENT/> <TEXT TYPE Action="0" Text="<CONTROL><SPACE>" _COMMENT="Select the entire column, pause, and deselect"/> <DELAY Flags="\x02" Time="900"/> <TEXT TYPE Action="0" Text="<ARROW RIGHT><ARROW LEFT>"/>
  5. This version works very fast (again, using Excel 2010.) The hotkey to activate it is RightArrow. The macro clears the background color (if any) of the current cell, TABs right to the next cell, and sets background color red. Similar macros could be written for left/up/down arrows, so that the moved-to cell will be colored and others not colored. In England, they will be coloured / not coloured. Note keystroke speed zero -- Excel is successfully buffering keystrokes, which helps the process run fast. There is one problem with this macro -- notice that the macro TABs to the next cell rather than simulating right arrow. That's because a simulated right arrow is the hotkey that starts the macro running again, and again, and again .... Using TAB avoids the problem for left/right movement, but I'm not sure what to do about up and down movement. // // Highlight Excel cell by making its background red Keystroke Speed: 0 milliseconds // clear color of current cell, if any Text Type (Simulate Keystrokes): <CTRLD>1<CTRLU> // format cells Text Type (Simulate Keystrokes): pff // assure "fill" tab Text Type (Simulate Keystrokes): <ALTD>c<ALTU> // background color Text Type (Simulate Keystrokes): <ENTER> // select no color Text Type (Simulate Keystrokes): <TAB><TAB><TAB><TAB><TAB><ENTER> // tab to OK and exit // arrow right to next cell Text Type (Simulate Keystrokes): <TAB> // set color of next cell to red Text Type (Simulate Keystrokes): <CTRLD>1<CTRLU> // format cells Text Type (Simulate Keystrokes): pff // assure "fill" tab Text Type (Simulate Keystrokes): <ALTD>c<ALTU> // background color Text Type (Simulate Keystrokes): <ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ENTER> // select red Text Type (Simulate Keystrokes): <TAB><TAB><TAB><TAB><TAB><ENTER> // tab to OK and exit Macro Return // <COMMENT Value=" "/> <COMMENT Value="Highlight Excel cell by making its background red "/> <KEYSTROKE SPEED Delay="0"/> <COMMENT Value="clear color of current cell, if any "/> <TEXT TYPE Action="0" Text="<CTRLD>1<CTRLU>" _COMMENT="format cells"/> <TEXT TYPE Action="0" Text="pff" _COMMENT="assure \"fill\" tab"/> <TEXT TYPE Action="0" Text="<ALTD>c<ALTU>" _COMMENT="background color"/> <TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="select no color"/> <TEXT TYPE Action="0" Text="<TAB><TAB><TAB><TAB><TAB><ENTER>" _COMMENT="tab to OK and exit"/> <COMMENT Value="arrow right to next cell"/> <TEXT TYPE Action="0" Text="<TAB>"/> <COMMENT Value="set color of next cell to red"/> <TEXT TYPE Action="0" Text="<CTRLD>1<CTRLU>" _COMMENT="format cells"/> <TEXT TYPE Action="0" Text="pff" _COMMENT="assure \"fill\" tab"/> <TEXT TYPE Action="0" Text="<ALTD>c<ALTU>" _COMMENT="background color"/> <TEXT TYPE Action="0" Text="<ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ENTER>" _COMMENT="select red"/> <TEXT TYPE Action="0" Text="<TAB><TAB><TAB><TAB><TAB><ENTER>" _COMMENT="tab to OK and exit"/> <MACRO RETURN/> <COMMENT Value=" "/>
  6. In Excel 2010, these keystrokes enter the "format cells" dialog and change the current cell background color to red. Stands out nicely. Would probably be a different key sequence for different generations of Excel. Also we would want a second macro to change the cell color back to No Color. I wanted to use "Background color" instead of "Fill effects" but, for reasons unknown, ALT-c doesn't work to get to "Background color". It seems to be a feature of Excel that non-intuitive navigation is the rule. Incidentally, Excel 2010 places a heavy border around the current cell instead of requiring an up-to-date eyeglass prescription like later Excel versions. // Text Type (Simulate Keystrokes): <CTRLD>1<CTRLU> // format cells Delay: 250 milliseconds Text Type (Simulate Keystrokes): p // protection tab Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ARROW LEFT> // left to fill tab Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ALTD>i<ALTU> // fill effects Delay: 250 milliseconds Text Type (Simulate Keystrokes): <TAB><TAB> // tabs and arrows to select fill colors Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ENTER> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <TAB> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ENTER> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <TAB><TAB> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ENTER> // apply colors Delay: 250 milliseconds Text Type (Simulate Keystrokes): <TAB><TAB><TAB><TAB> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ENTER> // done Delay: 250 milliseconds Macro Return //
  7. When navigating around Excel spreadsheets without a mouse using the four arrow keys, the cell you're interacting with has a rectangle around it. This rectangle provides a visual indicator of which cell has focus. In recent versions of Excel, Microsoft has made the focus indicator fainter. As a result, when you're not using a mouse, spotting which cell you're interacting with can be challenging, especially when cells have borders around them: Note the green rectangle around cell B5. Having trouble seeing it? Exactly!!! Apparently, the faint focus indicator is hardwired into Excel, and can't be changed. Switching from Office's default visual theme helps, but not much. Although there may not be a solution to this problem unless Microsoft decides to address it, perhaps we can come up with a temporary solution: a macro that draws attention to the focused cell. The challenge: Write a Macro Express hotkey macro for Excel that helps a user spot which cell they are interacting with.
  8. Thank you very much for your input. Actually it never happens that "C:"\ is in the title as the window title shows only the current folder name. I guess i have to define a handle variable for each instance of win explorer like %ex1% to %ex5% to "handle" those windows reliable. This also has the advantage that i can adress each window individually which might be useful. 😉
  9. I'm still hoping someone will say they've tried this and here's what worked! Thanks again!!
  10. Although this is not a perfect solution, this script activates each instance of File Explorer, one after another. So if you have ten windows open, and five of them are File Explorer, running the macro will place the five File Explorer windows on top of the stack. There are plenty of problems with this script: 1. The macro enumerates any window that includes "c:\" in its title bar. Therefore, the macro misidentifies all non-File Explorer windows that have "c:\" in their titles. 2. The macro misses File Explorer windows for non-c: drives, like "d:\" or "z:\". You might try to fix this by changing the target title from "c:\" to ":\" but I can imagine this might introduce all sorts of side effects. 3. The macro misses named File Explorer folders, like "This PC" and "Documents". However, I believe there is a registry hack that toggles off named folders. 4. The stop rule is ugly. If Line 5 (Window activate) fails because the window doesn't exist, the macro handles the error by bringing everything to a screeching halt. But I can live with this aesthetic blemish if others can. Hopefully someone can improve the script. Variable Set Handle %WinTitle% from all windows with the title of "C:\" Get Array Length (%WinTitle%) => %Count% Variable Set Integer %x% to 1 Repeat Start (Repeat %Count% times) Window Activate: %WinTitle[%x%]% On Error Catch Error: Window could not be found Macro Stop End Catch Error End Error Variable Modify Integer %x%: Increment End Repeat <VARIABLE SET HANDLE Option="\x00" Info="C:\\" Partial="TRUE" Wildcards="FALSE" Destination="%WinTitle%"/> <GET ARRAY LENGTH Array="%WinTitle%" Dest="%Count%"/> <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="1"/> <REPEAT START Start="1" Step="1" Count="%Count%" Save="FALSE"/> <WINDOW ACTIVATE Title="%WinTitle[%x%]%" Exact_Match="FALSE" Wildcards="FALSE" _HANDLE="0x0006"/> <ON ERROR/> <CATCH ERROR Code="6"/> <MACRO STOP/> <END CATCH ERROR/> <END ERROR/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%x%"/> <END REPEAT/>
  11. Sounds like you have it well in hand. Let us know how it works out with Team Viewer or VNC.
  12. 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.
  13. 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?
  14. 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.
  15. So it's not possible like, having multiple Chrome windows, and making them visible via "set window order" or activating them one after another, because Chrome always has Chrome in all of it's window titles. While WinExplorer windows always have the current opened folder as window title, correct?
  16. I don't think it's possible because of how Windows works. You can only interact with one window at a time. That window is the active window. Other windows may be visible, but they are in the background. You can't interact with a non-active window until you give it focus by clicking on it or switching to it via keyboard. It may be possible to write a macro that, when activated, brings up an instance of File Explorer. Activate the macro again, and the macro brings up another instance of File Explorer, if there is one. And so on.
  17. 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?
  18. Hey everyone, how do I activate all opened WinExplorer Windows? Their window title have different names depending on which folder is open. I tried to activate "explorer.exe" which I thought would be the application behind the WinExplorer windows, but that doesn't work. Is that even possible?
  19. 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!
  20. yes that could be... tab form top to bottom. Not sure I completly understand this with search. But if i search the word that is typed in this box, where i use mouse to click on because tab not works. Then the word is highlighted in the box. But still no tab or enter that can activate box. Another issue with web site is that in the adress field (www field) the site name is (changed a bit but quite similar). https://sys-online.dk/sys/#a_ when click in the first box where I should paste numbers it removes https:// and is now just sys-online.dk/sys/#a_ But whatever it is I can in macro express under timing "wait for window title" only see a window called "sys-online - google chrome" The same when I on web site goes further into website... The name in timing is still the same "sys-online - google chrome" yes that could be... tab form top to bottom. Not sure I completly understand this with search. But if i search the word that is typed in this box, where i use mouse to click on because tab not works. Then the word is highlighted in the box. But still no tab or enter that can activate box. Another issue with web site is that in the adress field (www field) the site name is (changed a bit but quite similar). https://sys-online.dk/sys/#a_ when click in the first box where I should paste numbers it removes https:// and is now just sys-online.dk/sys/#a_ But whatever it is I can in macro express under timing "wait for window title" only see a window called "sys-online - google chrome" The same when I on web site goes further into website... The name in timing is still the same "sys-online - google chrome"
  21. Sometimes tabbing from one field to the next doesn't take the fields in the order that you see them on the screen, but in a seemingly random order (but not really random). So successive TABs might go from the top of the window to some field near the bottom then back to the top. If the window is bigger than the screen, that can make it jump around like you describe. You might be able to use the browser's "find" command to get where you want to go. For example, one of my macros uses the following sequence to find "forgot your password?" text within the window, then tabs backwards to get to the fields where name and password are typed. Text Type (Simulate Keystrokes): 'forgot your password // single quote initiates Firefox Quick Search for hyperlink text Delay: 250 milliseconds Text Type (Simulate Keystrokes): <SHIFTD><TAB><TAB><TAB><TAB><SHIFTU> Delay: 250 milliseconds Text Type (Simulate Keystrokes): signonname<TAB> Text Type (Simulate Keystrokes): password<TAB>
  22. yes TAB is normally fine. This TAB makes the web site new window jump around the screen until it reach it's destination. It works but sometimes fails and I think it's because of this jumping up and down.
  23. TAB ten times is definitely better, if that's all you have to do. I thought you were having trouble getting focus on the appropriate window, or making sure it had loaded, before you could even do the tabs -- that's why the other suggestions. The command "Get Pixel Color" is under System commands. I agree it's hard to find -- there are several commands I have trouble locating whenever I want to use them. Get Pixel Color can be very useful; play around with it a bit when you have the time.
  24. I will try that.. but where did you find a way to check colors. have looked and could not find a command that can check colors But not sure it's much better than the TAB. I assume it's the web site constuction that is not macro freindly. Maybe there was a way around for that kind of sites.
  1. Load more activity
×
×
  • Create New...