Jump to content
Macro Express Forums

floyd

Members
  • Posts

    292
  • Joined

  • Last visited

Everything posted by floyd

  1. Sure, you can post an image. When the dialog has focus, can you type the first few characters of a folder name and the cursor will move down to it?
  2. Welcome to the forum crikeymate Without the ability to enter folder and file names in the application, in other words, only able to navigate visually with the mouse, a folder and file name list does not do you any good. There is no way to use it within the application. Yes, you know where you are supposed to go, and which files to select, but your application will not allow you to enter the information. I am not familiar with multi-page TIFF G4 image files. My assumption is that each page is in a different folder? Do you have any other options?
  3. I'm not sure. In looking at the XP help system, it says that programs continue to run when using fast user switching, which we use here. It also says that in order to use computer locking, fast user switching has to be off. I can only suggest that you try it. Create a macro that does something for a period of time, like slowly increment a variable, fire it up, then lock the computer.
  4. What do you mean by "lock keyboard and mouse"? How are you planning on doing this? And a Happy Easter to you too Bob!
  5. Welcome to the forum ... er, Obnoxious Going by your summary at the end, here is a sample macro that delays a random amount of time (between 1/1000th of a second and 7 seconds) then types the delayed time into Notepad. One millisecond = 1/1000th of a second, so this should satisfy your need for partial seconds. It loops 10 ten times. You can copy and paste the second part of the code directly into a macro and test it. Make sure that you do not mistakenly grab any CR/LF characters. The top half of the code is what it should look like in your macro. Activate or Launch: "Notepad" OR "notepad.exe" Wait For Window Title: "Notepad" Repeat Start (Repeat 10 times) Variable Set Integer %N1% with a Random Number Delay %N1% Milliseconds Text Type: %N1%<ENTER> Repeat End <LAUNCHYES3:0:0112Notepad<LAUNCH:notepad.exe><WAITWIN2:000000:000005:Notepad><REP3:01:000001:000001:00010:0:01:><IVAR2:01:06:7000><IMSD:%N1%><TEXTTYPE:%N1%<ENTER>><ENDREP> The following code demonstates how to grab a pixel color and then test it in a Switch/End Switch construct. Change the coordinates to anything you wish. You can use the built-in Mouse Locator tool to get the pixel color underneath the mouse pointer. Get Pixel: Screen Coords: 785,105 into %N1% Switch (N1) Case: 0 Variable Set String %T1% "BLACK" End Case Case: 16777215 Variable Set String %T1% "WHITE" End Case Case: 255 Variable Set String %T1% "RED" End Case Case: 32768 Variable Set String %T1% "GREEN" End Case Case: 16711680 Variable Set String %T1% "BLUE" End Case Case: 65535 Variable Set String %T1% "YELLOW" End Case Case: 8421504 Variable Set String %T1% "GREY" End Case Case: 26367 Variable Set String %T1% "ORANGE" End Case Default Case Variable Set String %T1% "UNDETERMINED" End Case End Switch Text Box Display: <GETPX:1:S:000785:000105><SWITCH:N1><CASE:0><TVAR2:01:01:BLACK><ENDCASE><CASE:16777215><TVAR2:01:01:WHITE ><ENDCASE><CASE:255><TVAR2:01:01:RED ><ENDCASE><CASE:32768><TVAR2:01:01:GREEN ><ENDCASE><CASE:16711680><TVAR2:01:01:BLUE ><ENDCASE><CASE:65535><TVAR2:01:01:YELLOW ><ENDCASE><CASE:8421504><TVAR2:01:01:GREY ><ENDCASE><CASE:26367><TVAR2:01:01:ORANGE ><ENDCASE><DEFCASE><TVAR2:01:01:UNDETERMINED ><ENDCASE><ENDSWITCH><TBOX4:T:4:CenterCenter000170000110:000: Color is %T1%>
  6. I am not having any problems with them on our computers. We have Break set to abort and Pause set to pause. They work as expected. I reversed them after reading your post, and they still worked as expected. What is not made clear in the docs is that the Break key is actually Ctrl+Break. From the Macro Express Explained book:
  7. Randall is referring to this Archives link. Prior to having the Macro Express forum here at www.pgmacros.com, it was a newsgroup accessible only through email clients like Outlook. These are the archived topics from there.
  8. Yes, your way is the way that I would have done it for myself with two changes:Use the ELSE command to avoid forcing Macro Express to parse through strings again once it found the answer. Avoid using spaces within the string. Something like this: "970~303~307~719~720". It means very little in this example, but can be a nightmare when parsing untrimmed data strings. There are limitations to the Switch/End Switch construct. The biggest is that each Case tests only for equality. It cannot, for example, be used for <, >, <>, or "contains". Just "=". Period. And if you are testing strings, they need to be the same length and case. Stacking the Case statements (like in the example) does for the Switch command what OR does for the If command. Also, there is a Default Case command that, if used, will always be TRUE. This means that the commands you place in it will fire only if all previous Case statements are FALSE. It does for the Switch command what ELSE does for the If command. If you are having problems with the boolean operators AND, OR, XOR then start another topic so you can get some help. They are very powerful and useful commands.
  9. Is this a DOS or Windows program that you are running?
  10. One way to make the code simpler is to use the Switch / End Switch command construct. There are a couple of things to point out. Notice how the target window title is placed in a variable T4. This allows the code to activate the window, delay, and paste from the clipboard to be moved outside the switch. Also, only the "unique" portion of each window title is needed. This is only one way out of many to solve the problem.
  11. For those really big sorting jobs that I keep reading about here in the forum ... This example macro is a companion to the original {Single Dimension Sort} macro, which sorts strings, or strings of numbers from a variable instead of a file. This script reads lines from text file and converts them into an array for sorting. Each element in the array is a line of text (or numbers) in the text file. A line ends with a CR/LF. Included is a file that contains 50,000 random lines of text and another containing 50,000 random numbers. But, feel free to create your own files for testing. My computer (2.4ghz) sorts the 50,000 word file in about 9 seconds, which includes reading the data from the input file and writing the sorted array back to the output file. Because this example generates a VBS script which does the sorting, you only need to import the attached playable (.mxe) file into any Macro Express library (.mex) file. Nothing else is required to use the sorting algorithm. There are no external files except, of course, the file that you want to sort! The attached macro is well documented. Please review the header section within it for information on the sorting options, which are: Sort all or only part of the file Sort using case or ignore case Sort in ascending or descending order SingleDimensionSort_File.zip
  12. Les - The sorting bogging down and Macro Express crashing are two separate issues. A replacement macro has been uploaded, which adds a Delay in the loop that follows the Progam Launch command. This will take care of the bogging down problem because the VBS script will have more time on the CPU to do its task. The QuickSort script is sorting 10,000 words in a 140k file in under 2 seconds. It seems pretty fast to me, however, the example macro itself takes quite a few seconds longer to prepare the string built from the file. The crash is occurring when the Load Macro Text File command fires to retrieve the sorted string. There may be a limit to the size of a playable MXE file. So, the problem is a limitation within the example macro and not the QuickSort itself. Randall - There is a 16k length limitation in the Windows Registry. If it were me, I would stay as far away as possible from using the Registry for any kind of sorting task.
  13. Bernhard - Can you explain further? I am not sure what you mean.
  14. It should repeat. Maybe another of those "Text Type" things happened to you. Which release of Macro Express are you using? The demo makes it look like there is a lot involved in using the QuickSort script. But 95% of the demo was created to show different features of the algorithm. There are only 7 variables that need to be set before calling the script A temporary file name The string of elements to sort A delimiter string The starting element to sort The ending element Case or no case Ascending or descending Eventually the script will be changed to use default values so that a person will only need the top two variables in the list.
  15. Les - It looks like your macro has screwed up somehow. None of those Text Type lines should be there. Instead, they should be Repeat Until %N1% <> %N1% and Clear Text Variables: From 1 To 2 commands.
  16. Interesting ... a sort routine using all native Macro Express code. Bet you learned a lot. These kinds of exercises are what I cut my teeth on when Joe first introduced me to Macro Express. Great way to learn. I spent hours on this and that until I got a feel for it. Most of the slow-down in your macro occurs because you are doing a lot of reading and writing to and from the environment space. It takes up most, if not all, the time. The same can be said for the vbs script in my original QuickSort macro, except that it generates, writes, and reads a single file. As to attaching pictures, they must be located within a URL somewhere. I do not know why.
  17. Thanks Randall Glad you like it, but as noted in the script itself, I cannot take credit for the original algorithm. It is a fast little bugger 'though, eh? I will change the macro to add your lines at some point when time allows. Thanks for looking at it and I hope it is useful to everybody!
  18. There is no difference between HTA and HTM or HTML files. You can generate an HTM file from a web page designer like those provided by Macromedia, Adobe, and Microsoft, and then rename it to have an HTA extension. If you do this, and if you double-click on it from say, Windows Explorer, it will be launched by the mshta.exe program. If, on the other hand, it remains as an HTM or HTML file, then it will be launched by your default browser. I suspect, but am far from sure, that an HTA file will run as programmed no matter which browser you use because it is being controlled by mshta.exe and (I assume) the built-in-to-Windows portion of Internet Explorer. There is a good chance that my assumption is wrong, which isn't the first time and will surely not be the last time.
  19. Okay, I will give it a try using your instructions. ------------ This is how it is meant to be. An HTA file is mostly nothing more than a renamed HTM file. So, if you launch it as an HTA, via Macro Express for example, then the Windows mshta.exe program will run it without all the baggage of a web page. And it should run as expected no matter which browser you use, or which is the default. Please let me know if it does not. If you rename it to an HTM or HTML file, then whichever browser you use will launch it as a web page, complete with all the nightmares of how different browsers parse the same HTML code.
  20. G'Day Randallc Thanks for the new macros. I like the concept of having a form generate a form, but I am confused as to the end result. If the form that I want generated just required text input fields, could I do that? My assumption from the instructions is that the VarMultipleField macro generates a form, or it generates the 2 text files contained within the Macro Express home folder, or both. But how do I actually use them? ----------- So, do you mean that the Submit button does not work at all in Opera and Firefox, or do you mean that it does not get enabled or disabled? To a larger question: are you running the HTA from within Firefox and Opera by renaming to HTM? Or are you running it using mshta.exe from the macro?
  21. randallc, Thanks for the feedback on IE 5.0. I ran the macros that you posted in order to determine an answer to your question "... can it be simplified or developed further for easier use?". I think so, although your idea of running a macro to develop field names has some uniqueness to it. I think a tool should be designed which allows developers to generate forms from the ground up. It will need to gather specific information about each Control. And the controls themselves might need to be limited to Text fields, Check boxes, and Radio buttons. Obviously I am thinking small to begin with. Data to be gathered would include positioning for all the controls in addition to Labels for Text boxes and fields. Once all the information is assembled the macro would generate the necessary Macro Express code and the required HTA code, combine both into an MXE, and as a final step, import it all into an MEX library. ... *poof* a self-generated macro. As to the "Can we call VBA Word macros directly like this too?" question ... the answer is, yes, and it is not something that requires an HTA. A VBScript will suffice. It would, in fact, replace the Word or Excel VBA macros, rather than just run it. VBScript (.vbs) files can be generated by Macro Express in the same manner that it generates HTA files. Again, thanks for your feedback. And thanks to jowensii and Nicolas, too.
  22. Getting input from a user in Macro Express is done through prompting or picking choices from a menu. It is a linear process. Ask a question. Get an answer. Ask the next question. Get the next answer. And so it goes. For example, if you want to get a user's first name, last name, and email address, you would prompt three different times, once for each bit of information. It would be nice if all three fields could be placed on a single form for the user to fill in but there is nothing in native Macro Express that will allow this. You can, however, use Macro Express to generate and power a multiple-field form built from a script. Here is an example. The form is actually an HTA file, which stands for HTML Application Host. It is essentially a web page without all the baggage and is a feature built directly into Windows. If you look in your system folder you will see a file named mshta.exe, which is used to run HTAs. The attached example macro is self-contained. It is all you need to run the example because it actually generates the HTA file, which in turn writes string variables back to the macro. You only need to import the attached playable (.mxe) file into any Macro Express library (.mex) file. Nothing else is required. There are no external files to deal with. And it cleans up after itself. Any temporary files that are created in your system temp folder are erased before the macro terminates. The example form contains: Text fields Radio buttons Check boxes A drop-down combo box A multiple-pick list Command buttons All of which return the user's choices to Macro Express in the form of string variables. A word about the script. Don't be shy. Take a look at it. It's just a standard HTML document. In fact, if you were to export it out of Macro Express and change the file extension to .htm, it would run in your browser. There is no doubt that you will need to know how to create an HTML document if you want to create a form like this. It isn't that hard to do if you stick with just the basics. That being said, this example goes beyond the basics by using accelerator keys, button handlers, special formatting, and so forth, but I tend to do that when programming. Our clients love it. But Joe ... well never mind. You are free to use this one as a starting point. A word about security. The advantage to using HTAs is that they are run as trusted scripts because they are local and carry none of the security baggage requirements of a web page. It is also the kind of thing that will make some anti-virus software scream and rant and rave and carry-on like nobody's business, about running a script file. If you are concerned that this example macro and script file might contain a virus (they do not), then feel free to scan the playable (.mxe) file before doing anything with it. Peace-of-mind is a wonderful thing. A word about testing. I tested this macro and script using Internet Explorer 6 under Win'XP, Win'2k, and Win'98. I believe (but am not sure) that it will also run under Win'ME and Win'95. If I had, or used, Netscape, Opera, or Firefox I would have tested those also. But I don't. So I didn't. So it goes. MultipleFieldForm.zip
  23. This macro generates and calls a VBS script to sort a single dimension array of words or numbers. The resulting sorted array is written back to Macro Express in the form of a string. It is meant to show the different features of the generated QuickSort algorithm, which converts a string of elements to be sorted into an array. Each element is separated by a delimiter character, or string of characters, that you specify. There are two sample strings built in to this example macro. A string of words and a string of numbers. But you may create your own test strings. Because this example generates a VBS script, which in turn writes a string variable back to the macro, you only need to import the attached playable (.mxe) file into any Macro Express library (.mex) file. Nothing else is required to use the sorting algorithm. There are no external files. Sort word strings or numbers You choose the delimiter to use Sort all string elements or just some of them Choose to sort by case or to ignore case Sort in ascending or descending order The attached macro is well documented. And there is an extensive explanation in the header section. Any temporary files created by the macro in your system temp folder are erased before the macro terminates. Jan-28-2005 Made some changes to the macro concerning the Repeat Loops that follow the Program Launch command. See internal comments for details. SingleDimensionSort.zip
  24. IceBox - Yep, I got it backwards, didn't I? Macro Express does pass the mouse click through to the underlying application. So, you are correct. Thanks for pointing it out. The answer to Nevada should have been the first part of his first question was the correct assumption:
  25. Macro Express does not have a built-in command to return the attributes of a file such as ReadOnly, Hidden, System, and Archive. So, you can use this macro to do it instead. It runs a VBScript script program. The script is generated by the macro, saved to a unique file name in your temp folder, and is then run using the Program Launch command. All temporary files are erased before the macro terminates. The name of the target file, the one that you want to get the attributes from, is saved to a Key in an INI file (saved in your temp folder), which is read by the script when called. The script gets the target file attributes and returns them as a comma delimited string back to the INI file under another Key. When the script is done the macro takes control back and reads the attributes string from the INI file. The macro does the following: Gets the name of your temp folder Generates a unique file name Prompts for the target file name and saves it to the INI file Generates the VBScript script and saves it to the temp folder Runs the script, getting the attributes and saving them to the INI file Reads the INI file and displays the results Erases the files generated by the macro. The attributes returned are: Normal ReadOnly Hidden System Archive If a file has more than one attribute then they are returned as a comma delimited string such as "Hidden,System,Archive". If an error occurs in the script then a blank string will be returned. Tested under Win'XP, Win'2k, and Win'98. Get_File_Attributes.zip
×
×
  • Create New...