All Activity

This stream auto-updates   

  1. Yesterday
  2. Last week
  3. Hi, thanks! And you're welcome. =) Yes, this works without having Program Manager flash on the screen at all, which is exactly what I was hoping for! It is some Operating System window that is 'hidden'. So when I run the macro, all I see on the screen is the Image Viewer program (JPEGView) become inactive [the top bar of the program becomes gray], then less than a second later, JPEGView becomes the active window again, and the Left Arrow key is pressed to go to the previous image (which is the image that was just recovered when the Ctrl+Z command was run).
  4. See if you can struggle through making my macro or acantor's work for you. You will learn a lot. If you give a man a fish you feed him for a day ....
  5. Very clever! Thanks for posting this. So, are you saying this works without the Program Manager screen temporarily replacing JPEGView? Or do you mean Program Manager flashes up and is replaced by JPEGView so quickly that it is no longer a problem?
  6. If you don't understand what it means to call one macro from another, don't worry. Suffice to say it is a technique for recycling Macro Express scripts. For now, focus your energies on perfecting a script that searches a line of, say, 400 pixels, maybe something like this... Variable Set Integer %x% to 100 // Initial x coordinate Variable Set Integer %y% to 300 // Initial y coordinate Variable Set String %TargetColour% to "255" // Target pixel colour 255 = RED of the words "Macro Stop" in the MEP "Script Editor" Repeat Start (Repeat 400 times) Delay: 10 milliseconds // Slow down the macro so you can see what's happening Mouse Move: %x%, %y% Relative to Screen Get Pixel Color from Beneath the Mouse into %PixelColour% If Variable %PixelColour% Equals "%TargetColour%" Text Box Display: Pixel found! Macro Stop End If Variable Modify Integer %x%: Increment // Increase the value of x by 1 End Repeat Text Box Display: Pixel NOT found! ====== <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="100" _COMMENT="Initial x coordinate"/> <VARIABLE SET INTEGER Option="\x00" Destination="%y%" Value="300" _COMMENT="Initial y coordinate"/> <VARIABLE SET STRING Option="\x00" Destination="%TargetColour%" Value="255" NoEmbeddedVars="FALSE" _COMMENT="Target pixel colour 255 = RED of the words \"Macro Stop\" in the MEP \"Script Editor\""/> <COMMENT/> <REPEAT START Start="1" Step="1" Count="400" Save="FALSE"/> <DELAY Flags="\x02" Time="10" _COMMENT="Slow down the macro so you can see what's happening"/> <MOUSE MOVE Option="\x01" X="%x%" Y="%y%" _PROMPT="0x000A"/> <GET PIXEL COLOR Option="\x00" Rel_To_Screen="TRUE" Destination="%PixelColour%"/> <IF VARIABLE Variable="%PixelColour%" Condition="\x00" Value="%TargetColour%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Pixel found!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang4105{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <MACRO STOP/> <END IF/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%x%" _COMMENT="Increase the value of x by 1"/> <END REPEAT/> <TEXT BOX DISPLAY Title="Pixel NOT found!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang4105{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
  7. Wow, what a beauty. Not sure how to actually use it, so someone hurry and do that. What does it mean to call from another macro?
  8. So a random idea popped in my head! I said, what if I set focus to some "hidden" window that's part of the operating system, Control + Z, refocus my image program, press the left key to go to previous image (the one that I just recovered)? That idea seems to be working! (If it stops working, which it shouldn't, then I'll post back on that). But I will post a screen shot of that macro. The bottom part was my original method stated earlier. (I'm holding on to it for now just in case)
  9. This macro will search a rectangular area. The "rectangle" can be as simple as a single horizontal or vertical row of pixels depending on how you set the upper-left and lower-right boundaries. There is no error checking in the macro -- if you exceed the limits of the screen, or specify a bottom-right point that is above or left of the top-left point, results are not guaranteed. The first Mouse Move command makes the mouse track the pixels being checked, which is handy for testing because you can watch the search pattern. That Mouse Move should be inactivated for normal usage as it slows the macro down considerably. Log Message to Default Error Log Log Errors // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Keystroke Speed: 30 Milliseconds Mouse Speed: 30 Milliseconds // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // // This macro is intended to be called from another macro // Macro searches rectangular area for specifie pixel color, puts mouse on first pixel found // // Variables passed from caller: // .... %N90% and %N91% Top left corner of area to be searched (screen relative) // .... %N92% and %N93% Bottom right corner of area to be searched (screen relative) // .... %N94% Pixel color to be located // // // For testing set up coordinates normally passed from calling macro Variable Set Integer %N90% to 800 Variable Set Integer %N91% to 500 Variable Set Integer %N92% to 850 Variable Set Integer %N93% to 500 Variable Set Integer %N94% to 6956042 // // // Copy search area coordinates to working variables Variable Modify Integer: Copy %N90% to %N20% Variable Modify Integer: Copy %N91% to %N21% // Search until pixel color found or until area boundaries exceeded // Search proceeds left to right in a row, then drops to next row, etc. Repeat Until %T1% <> %T1% // For testing move mouse to next pixel to be checked Mouse Move Screen %N20%, %N21% Get Pixel: Screen Coords: %N20%,%N21% into %N24% If Variable %N24% = variable %N94% Mouse Move Screen %N20%, %N21% Repeat Exit End If // Bump pixel coordinates Variable Modify Integer: Inc (%N20%) If Variable %N21% = variable %N93% AND If Variable %N20% > variable %N92% Repeat Exit End If If Variable %N20% > variable %N92% Variable Modify Integer: Inc (%N21%) Variable Modify Integer: Copy %N90% to %N20% Else Variable Modify Integer: Inc (%N20%) End If Repeat End // // // // Macro Return
  10. Thanks for the encouragement! Hope the feature makes it into the next release. In the meantime, someone here please show the most efficient way of checking a HORIZONTAL LINE, say 10 pixels across. Actual case I'm dealing with involves navy blue text on a white background, on a particular web page. Trouble is, page gets refreshed, and the text moves slightly from where it was before. A horizontal line could catch it, though.
  11. I have written many scripts to search for a particular pixel colour within a region. There are several ways to approach the problem. Here are five methods I have tried: 1. Examine a single coordinate at regular intervals. 2. Check a vertical or horizontal line. 3. Check a rectangular region, one line at a time. 4. Check the entire screen or a specific window, one line at a time. 5. Check each pixel in a spiral pattern from a single coordinate. My experience is that only [1] and [2] execute quickly enough to be practical. [3] works fine if the rectangle isn't too large. [4] can take too long to execute: a 1366 x 768 screen would require 1,049,088 pixel colour tests! [5] is elegant and works nicely, but only if you have a rough idea of where to start the search. I have never found a practical application for [5], at least not yet. A series or combination of these methods is possible. I have, for example, searched a vertical line until I have found a pixel, and then hunted horizontally for a second pixel colour. I have done this for applications that have large rectangles consisting of only a few colours, e.g., a web app that has two or three frames. My most sophisticated macro of this ilk does four searches one after another: along a vertical line, then horizontal, then vertical and then horizontal again. During the last search, the macro counts the number of times a certain colour is found. It was challenging to make this macro work reliably. When I need to search large regions for a pixel colour, I sometimes opt for other scripting tools. Search rectangle for a pixel colour would be a dynamite feature to add to a future release of Macro Express! At one point I submitted a feature request to the good folks at Insight... I would encourage others to do the same.
  12. The area being searched for a particular color doesn't necessarily have to be a square, thinking more about it. Could be a line. A horizontal line. What is actually on screen is TEXT. So a line passing through the text would do perfectly. A full square or rectangle would be overkill.
  13. A "one-second" cost would be a real bargain. Would love to see an expert here put the macro together. Can hardly wait, in fact. Thanks!
  14. That would be a handy feature to have. You could write a macro to do it, that could be run (called) from any number of other macros. The calling macro would simply pass the starting location and dimensions of the search area to the called macro (in variables), along with the color to be searched for; with results returned in another variable. One scan of a 100x100 square is fairly time-consuming -- perhaps a second on my PC running Windows 7 and ME 3. There have been recent threads on this forum complaining of MUCH longer pixel-check times on Windows 10 systems, indicating such an extended search must be done in some other computer language than Macro Express and might not be feasible even there.
  15. As things now stand we can look for a color at a particular screen pixel. Please add the allowance to look wider than the single pixel. For example: Anywhere in a 10x10 pixel region. Or anywhere in a 100x100 pixel region. Say, specifically: <REPEAT UNTIL Variable="%N1%" Condition="\x00" Value="15597568"/> <GET PIXEL COLOR Option="\x01" Rel_To_Screen="TRUE" X="1000" Y="500" Destination="%N1%"/> Only covers one single pixel. I'd like to be able to say, if ANY NAVY BLUE is present in a 100x100 square, then move on. If not, keep repeating the 'looking for.' I'd greatly appreciate your assistance. Thanks, Nicholas Kormanik
  16. Yes, File Explorer works to recover any file that I deleted. The thing is that I want to avoid a macro to set focus to File Explorer whenever I need to recover a deleted file. Is there no other work-around for that?
  17. Here is an idea about how to tackle it. You will need two macros. Macro 1 - gets the list of files and stores them in a file. Run this only once to set up. Something like this. (You will need to change the paths): // Delete registry counter and files to set things up to process files Delete Registry Value: HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\$Temp\NextFileNumber // Delete the file number, if it exists Delete File/Files: "e:\FilesToProcess.txt" // Delete output file, if it exists // Get a list of the files to process Repeat with Folder e:\temp Variable Modify String: Append %File% to text file, "e:\FilesToProcess.txt" End Repeat Macro 2 - opens the next file from the list. Run each time you are finished manually processing one file. (Again, you will need to change the paths): // Use a hotkey activation for this macro // Get the NextFileNumber from the registry Variable Set Integer %NextFileNumber% to 1 // Default in case the registry value does not exist Read Registry Value "HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\$Temp\NextFileNumber" into %NextFileNumber% // Get number of file to use // Get the name of the next file in the list Text File Begin Process: e:\FilesToProcess.txt Break // Only get one file Text File End Process // If NextFilename is blank then all files have been processed If Variable %NextFilename% Equals "" Text Box Display: Done Macro Stop End If // Increment and save the NextFileNumber to the registry Variable Modify Integer %NextFileNumber%: Increment Write Registry Value "%NextFileNumber%" into HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\$Temp\NextFileNumber // Get number of file to use Variable Set From File path // Get file extension Text Box Display: Opening file If Variable %Ext% Equals ".pdf" // Process pdf files OR If Variable %Ext% Equals ".txt" // or txt files OR If Variable %Ext% Equals ".doc" // or doc files OR If Variable %Ext% Equals ".docx" // or docx files OR If Variable %Ext% Equals ".jpg" // or jpg files OR If Variable %Ext% Equals ".png" // or png files OR If Variable %Ext% Equals ".ini" // or ini files Change Directory/Folder to "e:\temp" Program Launch: "%NextFilename%" (Normal) Parameters: Else Delay: 1 seconds End If Here is code you can copy and paste for the "Get filenames" macro: <COMMENT Value="----------------------------------------------------------------------------------------------------------------------------------"/> <COMMENT Value=" Get filenames -"/> <COMMENT Value="----------------------------------------------------------------------------------------------------------------------------------"/> <COMMENT/> <COMMENT Value="Delete registry counter and files to set things up to process files"/> <DELETE REGISTRY VALUE Value="HKEY_CURRENT_USER\\Software\\Insight Software Solutions\\Macro Express 4\\$Temp\\NextFileNumber" _IGNORE="0x0025" _COMMENT="Delete the file number, if it exists"/> <DELETE FILE/FILES Path="e:\\FilesToProcess.txt" Progress="FALSE" Recurse="FALSE" Permanent="FALSE" _COMMENT="Delete output file, if it exists"/> <COMMENT/> <COMMENT Value="Get a list of the files to process"/> <REPEAT WITH FOLDER Path="e:\\temp" OnlyFiles="TRUE" Destination="%File%" FullPath="FALSE" ProcSubfolders="FALSE"/> <VARIABLE MODIFY STRING Option="\x12" Destination="%File%" Filename="e:\\FilesToProcess.txt" Strip="TRUE" NoEmbeddedVars="FALSE"/> <END REPEAT/> Here is code you can copy and past for the "Process one file" macro: <COMMENT Value="----------------------------------------------------------------------------------------------------------------------------------"/> <COMMENT Value="Process one file - "/> <COMMENT Value="----------------------------------------------------------------------------------------------------------------------------------"/> <COMMENT Value="Use a hotkey activation for this macro"/> <COMMENT/> <COMMENT Value="Get the NextFileNumber from the registry"/> <VARIABLE SET INTEGER Option="\x00" Destination="%NextFileNumber%" Value="1" _COMMENT="Default in case the registry value does not exist"/> <READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\Software\\Insight Software Solutions\\Macro Express 4\\$Temp\\NextFileNumber" Destination="%NextFileNumber%" _COMMENT="Get number of file to use"/> <COMMENT/> <COMMENT Value="Get the name of the next file in the list"/> <TEXT FILE BEGIN PROCESS Filename="e:\\FilesToProcess.txt" Start_Record="%NextFileNumber%" Process_All="TRUE" Records="1" Variable="%NextFilename%"/> <BREAK _COMMENT="Only get one file"/> <TEXT FILE END PROCESS/> <COMMENT/> <COMMENT Value="If NextFilename is blank then all files have been processed"/> <IF VARIABLE Variable="%NextFilename%" Condition="\x00" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Done" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue255;}\r\n\\viewkind4\\uc1\\pard\\qc\\cf1\\f0\\fs24 All files have been processed.\\cf0\\f1\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="337" Height="125" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <MACRO STOP/> <END IF/> <COMMENT/> <COMMENT Value="Increment and save the NextFileNumber to the registry"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%NextFileNumber%"/> <WRITE REGISTRY VALUE Key="HKEY_CURRENT_USER\\Software\\Insight Software Solutions\\Macro Express 4\\$Temp\\NextFileNumber" Destination="%NextFileNumber%" _COMMENT="Get number of file to use"/> <COMMENT/> <COMMENT/> <VARIABLE SET FROM FILE Filename="e:\\temp\\%NextFilename%" Option="\x01" Extension="%Ext%" Expand="FALSE" Flags="\x08" _COMMENT="Get file extension"/> <COMMENT/> <TEXT BOX DISPLAY Title="Opening file" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Opening File %NextFilename%\r\n\\par Extension: %Ext%\\f1 \r\n\\par }\r\n" Left="Center" Top="Top" Width="574" Height="97" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x01" Delay="0"/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".pdf" IgnoreCase="TRUE" _COMMENT="Process pdf files"/> <OR/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".txt" IgnoreCase="TRUE" _COMMENT="or txt files"/> <OR/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".doc" IgnoreCase="TRUE" _COMMENT="or doc files"/> <OR/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".docx" IgnoreCase="TRUE" _COMMENT="or docx files"/> <OR/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".jpg" IgnoreCase="TRUE" _COMMENT="or jpg files"/> <OR/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".png" IgnoreCase="TRUE" _COMMENT="or png files"/> <OR/> <IF VARIABLE Variable="%Ext%" Condition="\x00" Value=".ini" IgnoreCase="TRUE" _COMMENT="or ini files"/> <CHANGE DIRECTORY/FOLDER Path="e:\\temp"/> <PROGRAM LAUNCH Path="%NextFilename%" Mode="\x00" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/> <ELSE/> <DELAY Flags="\x01" Time="1"/> <END IF/>
  18. When you press something like Ctrl+z it goes to the window that has focus. If Macro Express types Ctrl+z then it too goes to the window that has focus. In order to have a macro undo the delete you need to the macro set focus to File Explorer. Does the Windows Recycle Bin do what you need? If you accidentally delete something you can use the Recycle bin to recover it.
  19. That's correct. The Acrobat window is viewable but doesn't respond to anything except the wait-for key -- in my case F2, since there's lots of right-clicking required in each file's editing session. (Also, those sessions can last hours and may include closing the file to do other things, so my goal isn't to leave ME suspended in a waiting state, just to have it get the next file when told.)
  20. I don't understand exactly what you mean. While ME is waiting for you to right-click (in my example) in order to continue on to the next file, are you not able to do any processing or editing of the opened file? Or does ME lock it?
  21. Hi Paul. Yeah, that's pretty much what I tried at first, but (of course) ME doesn't release control after the file is opened. (I should've clarified: the tasks each file needs done to it while open are various unpredictable edits and other non-ME-able things.) So as I see it, instead of looping, the macro needs to begin executing when I've finished with each file, and terminate when the next file is open. I was hoping to do something like store an array of the filenames and have the macro (a) remember which file is open, (b) figure out from the array which file is next, and then (c) save+close the former and open the latter. But I seem to be out of my depth with loading & reading arrays in ME. Does this make any sense?
  22. Here's an idea I wrote about several years ago which may, or may not, be helpful <g>! It's quite complex! It is possible to write a total of 39 macros (one for each character and number, plus 3 control macros) which are fired according to which key has been pressed. Thus, pressing 3 intiates macro-3, pressing h initiates macro-h. It involves writing a total of 39 macros (most of which are almost identical)! See Detecting Keys pressed for details. But this works only in ME4.
  23. How about this? Repeat with Folder YourFolderName (Return Files only) Wait for Right Mouse Click End Repeat This returns filenames in alphabetical order (as long as the file system is NTFS - order is random under FAT). In this instance the script waits for a right-click before continuing - you could have it wait for text, or for a window to lose focus, etc.
  24. Anyone have a way in ME to save & close the active file (a PDF) and automatically open the alphabetically next one in its folder? I thought Repeat With Folder might be useful but on closer inspection it doesn't look it. I don't want to iterate through, as each file needs nonrepetitive tasks done to it after opening. I'd just like to be able hit a key when finished to save & close it and open the next one. Had this same challenge with a huge pile of Word docs recently and a VBA macro to go get the next one saved my sanity. Now with PDFs it's less rosy. Does ME do any simple file I/O? If it does, I could collect the PDF names in a text file for ME to read. Thanks in advance for any clues.
  25. Whenever I'm going through the pictures and deleting the ones I don't want, Right clicking on the Desktop, for example, will always have the Undo Delete option, because there is nothing else that's running in the background that could interfere with this process. I am only asking for a method that could run the Undo command through Macro Express without going through the process of the set up that I posted earlier. Or in other words, how can I do Ctrl+Z without having File Explorer focused?
  26. I have noticed if you do a copy or move, then right clicking gives you the option to undo that copy or move -- it does not revert to the the last delete. If you undo a delete then right click, you get the option to re-do the delete (or copy, or move). So it is context-sensitive to your last action, and could quickly degenerate into who-knows-what if you are not watching closely. Perfect is the enemy of good. At this point you are good. Be satisfied.
  27. The application is a Picture Viewer. I download a collection of wallpaper images. I go through the pictures and press the Delete button to the pictures that I don't want to keep. The Delete button deletes a picture, yet there is no Undo Delete function within the application. So suppose I delete a picture accidentally, and I want to recover that picture, I cannot press CTRL+Z in the application, because that is not supported in there. Yet I have a Macro Express macro that when I press Backspace (specifically in that application), it will minimize everything, it will send the mouse to the top left corner of the Desktop, it will Right-Click the mouse, Text Type U [for undo], and then restore the picture viewer application. I want to avoid all that from happening, and only to undo the delete while the application is open on the screen (not minimized). I hope this post makes what I'm trying to say, clearer.
  1. Load more activity