Jump to content
Macro Express Forums

Leaderboard

Popular Content

Showing content with the highest reputation since 11/28/2020 in Posts

  1. In general, you will be better off learning how to use the keyboard to do things in a web page and use TextType to automate. Each control, including links in a webpage should be a tab-stop. All my later macros before I started writing programs were all based on the number of tabs it takes to get to any control in a web page. I have written hundreds of macros to automate web pages and found the overall effort and lines of code about 10% of that trying to use the mouse. Mouse moves is the road less travelled. And, BTW, that means it's the one you don't want to take 🙂 List boxes you can tab to them then arrow down or start typing to highlight an item. Do yourself a favor and look up a list of keyboard shortcuts available for your browser and try to use them first.
    2 points
  2. I don't know as I use .NET, but I am guessing you can. You will need to create some objects and populate them. In .NET I have a WebBrowser object which I can navigate to an address. When it downloads the text of the HTML, it renders it into the DOM object. All elements become objects within the DOM object. WebBrowser Document. Then in there one can iterate though the element object or search for elements by ID. I'm guessing an equivalent could be found in JavaScript and you could command that from MEP. I'm sorry I don't know specifically and I'm not answering your question. I just thought I'd share how it works with other languages and that most languages have equivalent objects. https://www.w3schools.com/js/js_htmldom.asp
    1 point
  3. Hi John, In Outlook, you have the option to add a "Quick Step" in the "Message" ribbon called "Create a task with attachment." I think this does what you want. When setting up the new Quick Step, you can assign one of nine "Shortcut keys" to activate it: Shift + Ctrl + 1, Shift + Ctrl + 2, etc. Once you set up the shortcut, you don't really need a macro, as the shortcut key will do it all. However, if you want to use a different hotkey, create a Macro Express script that is activated by, for example, F10. Have this macro output Shift + Ctrl + number, and you should be good to go!
    1 point
  4. I'm going to make a SWAG (Silly Wild-A** Guess). It's not a solution so it will satisfy no one. And my knowledge of Windows structure is vague enough I could be totally wrong. There -- so much for disclaimers. Q-Dir has been around for a long time. Over the years, an application's relationship to the keyboard has evolved from the primitive ability to interact directly with the BIOS, to present-day highly-structured "layers" of software between the application and the hardware. Perhaps Q-Dir generally adheres to Windows conventions, but has an old embedded module or two using an outdated technique that still works, but that sneaks in below the officially-correct level used by MEX. Like coming in the back door instead of the front. So sometimes MEX and Q-Dir communicate just fine, and sometimes not. OK, there's my semi-magical-mystical view of the machine's mind. Works for me, you guys can come up with your own religion. 😐
    1 point
  5. Thanks - I have made a feature request.
    1 point
  6. If Variable %all% Contains "%part%" Text Box Display: Yes! Else Text Box Display: No! End If
    1 point
  7. There are many ways to test for evenness / oddness, including this: Variable Set Decimal %Value%: Prompt Variable Modify Decimal: %HalfValue% = %Value% / 2 Variable Modify Decimal %HalfValue%: Remove Integer Portion (%DecimalsOnly%) If Variable %DecimalsOnly% Equals "0" Text Box Display: Even Else Text Box Display: Odd End If
    1 point
  8. I use the .NET WebBrowser control to make my own automated browsers sometimes. This way it's all a model including the rendered DOM which I can interact with programmatically. I figured if I was going to learn a language, which most web automation tools like iMacros need, I woudl just learn how to do it in .NET and make a proper program. Most of the ones I do I use the HTTPWebRequest/Response objects as rendering the document takes time and the text is modified before rendering to 'fix' common problems. So I just grab the raw HTML and get what I need from it using RegEx. I can even travers though a series of pages that way picking up tokens and cookies or whatever needed to interact with the statefull... state. It's much faster than navigating and rendering each page. Also I often find tokens can be reused or steps skipped speeding the process. Also I often find that the navigation isn't necessary and that at the end there's a simple GET with URI parameters or a HTTP POST with parameters I can tweak. Say the web form search offers 10, 50, or 100 results per page. Well that's a parameter in the post data and I change it to 10,000. I can often get the entire results set in a single request. Seconds to get a boatload of data. I often avoid reCAPTCHA's too this way as they often only protect the form pages. In many cases the last step is a query in JSON from a script on the web page to a AWS server or somehting. The script takes that then propagates a table on the web page for instance. Well I just copy that request, tweak the parameters, and get huge JSON DataSets I can port directly into my MS SQL database using the JSON Deserializer. No HTML, no DOM. Just the data. And for pushing data though forms it's also similar. I analyze and make a stripped down process that just uses POST requests to push a bunch of data to their server. No filling out textboxes or clicking buttons. Just send the data like the Web Browser does.
    1 point
  9. Hi Alan, My greatest challenge at present is trying to achieve a day’s worth of intended tasks in a 24 hour day! Can hardly believe that I used to manage a commute and work as well as hobbies. Terry
    1 point
  10. Ah, 'tis truly a work of art! Learned some new things. THANKS!!! Reminds me of an old rule I seem to no longer follow: 1. Read up on new software 2. use it for a while 3. go back and see what you forgot/missed. So poking about all the functions would be a good idea! LOVE posting both versions of the macro!!! Nice!! VV
    1 point
  11. You can still use Text File Process to loop through the text. Each line of a text file used by Windows ends with CR followed by LF referred to as CRLF. The Text File Begin/End process reads a line of text up to the CRLF. For convenience in your macro the string read by Text File Process does not include the CRLF. However, in your case, you know that each line originally had the CRLF. So, to determine the number of CRLF's just count the lines. Something like this: Variable Set Integer %N99% to 0 Text File Begin Process: "ansisavedcopy.txt" Variable Modify Integer: Inc (%N99%) // If the line is empty then stop the Text File loop If Variable %T1% = "" Break End If Text File End Process // Here: %N99% contains the number of times through the loop. This is also the number of CRLF's found. This sample does what you described. I counts the number of CRLF's found and it stops when the line is blank. There are some file formats that use only CR or only LF. If that were the case then you would have to read the entire file into a variable and parse through it. But, since Notepad+ indicates the file is ANSI format we know that each line of your file ends with CRLF.
    1 point
  12. Text File Begin Process reads one line at a time, and I believe it strips the CRLF, so your macro will never see the CRLF (as you have found!) I think Samrae is suggesting that you use the command Variable Set String, with option "Set Value from File." That single command loads the ENTIRE file into a text variable, bang, all at once. See illustration below -- my screen shot is ME Pro, but ME3 is similar. When you use this command, the data loaded into the variable retains the CRLF characters. The checkbox to Strip Trailing CR/LF is deceptive -- if you check the box, it strips the FINAL CRLF from the end of the file, but does NOT strip any others. So you could get the entire file into one variable, then write macro logic to parse out the individual lines, with CRLF sequences where you expect to see them.
    1 point
  13. This worked for me: The /c parameter tells cmd.exe to close after running. %TEMP% points to the temporary folder. You could also put commands in a batch file c: cd %TEMP% dir > %TEMP%\DirCmd.txt and use the Program Launch command to run the batch file. And then, as rberg said, load the file into a macro via a 'Variable Set String %T1% from File' command or the Text File Begin process command.
    1 point
  14. The only way I have found is to redirect the output to a text file, then read back the text file with the macro script (Text File Begin Process).
    1 point
  15. Well nothing against ISS as it's hard to describe, but importing a text file might sound like CSV data or something. I'll suggest they change the wording. I think "Import Macro Text File" might be better.
    1 point
  16. I think it's just Import > Import Text File ... It's been a decade probably since I've messed with this. BTW you could also create a macro to modify those lines 🙂
    1 point
  17. I think you might be able to Export > Output Macro Information, make changes, and import. I would suggest trying one simple macro to see if it works before trying the big one. And back up all your data. You might also contact ISS support. Also please report the bug to ISS.
    1 point
  18. This sounds like a good Macro Express project. The instructions you will probably need are: Variable Set String %ProgramName% to topmost program name and/or Variable Set String %WindowTitle% to topmost window title
    1 point
  19. Note that you don't have to use parameters. BTW Kevin's example on the support page illustrates that only a space shoudl be between the values. I know this is the same in .NET and other languages and programs. To be clear, if your value was 9 and you used that comma the JScript would receive a parameter "9," (numeral nine and a comma) which can only be used as text. I'm guessing what you did using the Number() function was to create an invalid cast exception. I don't have time to research it now, but what you saw returned "-1.#IND" is an exception code. I found this article for IEEE codes in C++ which look similar. I didn't read it, but it might be a clue for you here. You should use exception handling in your scripts and macros to avoid exceptions.
    1 point
  20. You have a comma and space in between the parameters when is should only be a space. This works for me.
    1 point
  21. I am speculating that you can't write to the console and get the value back. You need to use the Return function which terminates the script and writes the value to the console. That's what MEP reads in. Post an example of a script. Make is super simple and make sure it only contains commands that are needed to demonstrate the problem.
    1 point
  22. You're right, Terry! Much better. Here's my version, which is functionally identical to yours: Variable Set Integer %x% to 1 Text File Begin Process: C:\Tmp\File Start.txt // This is the text file that contains the index you want to process If Variable %Line[%x%]% Contains "," Variable Set Integer %CommaPosition% to the position of "," in %Line[%x%]% Variable Modify Integer: %CommaPosition% = %CommaPosition% - 1 Variable Modify String: Copy part of text in %Line[%x%]% starting at 1 and %CommaPosition% characters long to %Line[%x%]% Else Variable Set String %Line[%x%]% to "" End If Variable Modify String: Append %Line[%x%]% to text file, "C:\Tmp\File End.txt" // This is the file that will receive the results Text File End Process <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="1"/> <TEXT FILE BEGIN PROCESS Filename="C:\\Tmp\\File Start.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%Line[%x%]%" _COMMENT="This is the text file that contains the index you want to process"/> <IF VARIABLE Variable="%Line[%x%]%" Condition="\x06" Value="," IgnoreCase="FALSE"/> <VARIABLE SET INTEGER Option="\x0E" Destination="%CommaPosition%" Text_Variable="%Line[%x%]%" Text="," Ignore_Case="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x01" Destination="%CommaPosition%" Value1="%CommaPosition%" Value2="1"/> <VARIABLE MODIFY STRING Option="\x09" Destination="%Line[%x%]%" Variable="%Line[%x%]%" Start="1" Count="%CommaPosition%" NoEmbeddedVars="FALSE"/> <ELSE/> <VARIABLE SET STRING Option="\x00" Destination="%Line[%x%]%" NoEmbeddedVars="FALSE"/> <END IF/> <VARIABLE MODIFY STRING Option="\x12" Destination="%Line[%x%]%" Filename="C:\\Tmp\\File End.txt" Strip="TRUE" NoEmbeddedVars="FALSE" _COMMENT="This is the file that will receive the results"/> <TEXT FILE END PROCESS/>
    1 point
  23. Here's my version, which works OK here. It's heavily commented so hopefully easy to follow, but post if anything unclear. // These variables will be used to end each line of the edited file Variable Set to ASCII Char 13 to %CR% // Set CR Variable Set to ASCII Char 10 to %LF% // Set LF Variable Set String %CRLF% to "%CR%%LF%" // Set combined CRLF // Split each the line into as many parts as the max expected (up to 99). I've used 10. Text File Begin Process: C:\Users\terry\Dropbox\Macro Express (Sundry)\Parsing-1.txt // Test if line is blank. If Variable %tLine% Equals "" // Include a blank line and bypass the split. Variable Set String %tArray[1]% to "" Goto:AfterSplit End If // If there is no comma in the line AND it is not blank, ignore it and go to the next. If Variable %tLine% Does not Contain "," AND If Variable %tLine% Does not Equal "" Continue End If // Otherwise proced to parse. Split String "%tLine%" on "," into %tArray%, starting at 1 // But only use the first element, tArray[1]. Ignore the rest. // Build the result, stating with an empty new file. // Add a new line. :AfterSplit Variable Modify String %tEditedFile%: Append Text String Variable (%tArray[1]%) // Add the EOL characters Variable Modify String %tEditedFile%: Append Text String Variable (%CRLF%) Text File End Process Variable Modify String: Save %tEditedFile% to "C:\Users\terry\Dropbox\Macro Express (Sundry)\EditedFile.txt" Beep: Save %tEditedFile% to "C:\Users\terry\Dropbox\Macro Express (Sundry)\EditedFile.txt" // End of macro, so edited file sholud be ready. Full code: <COMMENT Value="These variables will be used to end each line of the edited file"/> <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CR%" _COMMENT="Set CR"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%" _COMMENT="Set LF"/> <VARIABLE SET STRING Option="\x00" Destination="%CRLF%" Value="%CR%%LF%" NoEmbeddedVars="FALSE" _COMMENT="Set combined CRLF"/> <COMMENT Value="Split each the line into as many parts as the max expected (up to 99). I've used 10."/> <TEXT FILE BEGIN PROCESS Filename="C:\\Users\\terry\\Dropbox\\Macro Express (Sundry)\\Parsing-1.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%tLine%"/> <COMMENT Value="Test if line is blank.\r\n"/> <IF VARIABLE Variable="%tLine%" Condition="\x00" IgnoreCase="FALSE"/> <COMMENT Value="Include a blank line and bypass the split."/> <VARIABLE SET STRING Option="\x00" Destination="%tArray[1]%" NoEmbeddedVars="FALSE"/> <GOTO Name="AfterSplit"/> <END IF/> <COMMENT Value="If there is no comma in the line AND it is not blank, ignore it and go to the next.\r\n"/> <IF VARIABLE Variable="%tLine%" Condition="\x07" Value="," IgnoreCase="FALSE"/> <AND/> <IF VARIABLE Variable="%tLine%" Condition="\x01" IgnoreCase="FALSE"/> <CONTINUE/> <END IF/> <COMMENT Value="Otherwise proced to parse."/> <SPLIT STRING Source="%tLine%" SplitChar="," Dest="%tArray%" Index="1"/> <COMMENT Value="But only use the first element, tArray[1]. Ignore the rest."/> <COMMENT Value="Build the result, stating with an empty new file."/> <COMMENT Value="Add a new line."/> <LABEL Name="AfterSplit"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%tEditedFile%" Variable="%tArray[1]%" NoEmbeddedVars="FALSE"/> <COMMENT Value="Add the EOL characters"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%tEditedFile%" Variable="%CRLF%" NoEmbeddedVars="FALSE"/> <TEXT FILE END PROCESS/> <VARIABLE MODIFY STRING Option="\x11" Destination="%tEditedFile%" Filename="C:\\Users\\terry\\Dropbox\\Macro Express (Sundry)\\EditedFile.txt" Strip="FALSE" NoEmbeddedVars="FALSE"/> <BEEP _COMMENT="End of macro, so edited file sholud be ready."/>
    1 point
  24. To delete the page numbers, find the position of the first comma and delete everything from there to the end of the line. (The first image below should have % signs around the variable names -- my error, sorry.)
    1 point
  25. I'm constantly fidgeting with my mouse and would soon be staring at a blank screen 😉
    1 point
  26. You're welcome. Perhaps you could add something like this: Variable Modify String: Replace ":\\" in %tFolder% with ":\"
    1 point
×
×
  • Create New...