Jump to content
Macro Express Forums

Cory

Members
  • Posts

    4,207
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by Cory

  1. What the heck are you doing? <g> In general I would avoid opening that many Word docs at a time. Bad mojo. Whatever it is you are doing can't you process them one at a time?

     

    To answer your question I don't know. In my book you've gone off the map and "Here there be monsters". My first impulse would be to figure a way to avoid opening an untold number of documents at once.

     

    Could you break your list up to do them in smaller batches?

     

    My interest is piqued. What are you doing there?

  2. I'm not 100% sure, Kevin would know better but here's my 2cents. If you disable the screensaver you are in effect disabling the inactivity counter in Windows. This works for many things, not just the screensaver. ME has an option to disable this for you. In this case no mater what is scheduled the system will never go into standby or however you have it configured.

     

    Now if a macro runs it appears as activity to the system so it will not go into standby. E.G.: if the macro runs every 5 minutes and the sleep is set to kick in after 10 minutes it will never go to sleep. If the macro doesn't fire, do to the scheduling, it will go into standby.

  3. It would depend on your criteria. If the idea was to run once simply define the schedule that way. Also with the scheduler you can have a macro that runs ever 5 minutes but limit it to be from 9AM to 9PM or whatever. But you can also disable a macro conditionally if you like. For instance you can test to see if a file exists and if it does run the Disable Macro command. Simple.

     

    Fair warning, this modifies the macro file and disables for all users! For instance my oft mentioned fax monitor macro can’t use it because if I disable it then it will be disabled for all users. Instead I test to see if the currently logged on user is the chosen one and bail out if it isn’t.

  4. For the batch file…

     

    I don’t know how much you know about batch files so forgive me if I cover something you already know. I assume you know what the command prompt is. And I assume you understand you can type commands in and do things there. Well along with being able to copy files and such you can also launch documents. Let’s say you have a file c:\test.doc. Well in the command prompt you could type just that and Word will launch with that file. Now a batch file is a way in Windows of saving a series of commands in a simple text file with a .bat extension. You can double click on it or run it like a program and it will open a command prompt and execute the commands just like you typed them in. So if you have a file that looks like this:

     

    C:\document1.doc

    C:\document2.doc

    C:\document3.doc

    C:\document4.doc

    C:\document5.doc

    C:\document6.doc

    C:\document7.doc

     

    And save it as test.bat it will launch the seven documents in Word.

     

    You can use the Variable Modify String command and Option 2 tab to write the file names and path to a temporary batch file called test.bat. Don’t forget to add a carriage return on each one. Once the bathc file is written use the Program Launch command to run it. Then write a command to delete the batch file.

     

    Does this help?

  5. I'll split this into two responses. First the last.

     

    If you have a file name in T1 for example all you need to do is to eliminate the ".doc". Now you could count the number of characters and copy part but that’s a lot of extra work. Check out the “Variable Set From File”. Here you can grab any part of a file’s name. So stick %T1% the top field and click on the “Get file path” section on the right. Check only the filename box and choose T1 as the var. This will grab just the name without extension and stick it back in the T1 var. If you still need the T1 var for something don’t recycle and use T2 or whatever.

     

     

    <VFFILE:1:F:1:F:1:T:1:F:1:%T1%>

  6. Yeah controls are useless in web windows.

     

    I have no idea about your problem, sorry. Even if you had a lame system that ran slow I wouldn't think it would change characters or move them around. You're not using and Shift Down are you? I was thinking one might have gotten stuck from a previous macro. I racked my brains on this one once. I had a macro I was debugging and sometimes it would work and sometimes not. Turns out sometimes I was bailing out before the corresponding Shift Up command and the Shift Down was sticking from the last time it ran. Drove me nuts! Still doesn't expan the bit about being out of order.

     

    BTW, we had some good discussions about a year ago about finding stuff in and moving around in web windows if you're interested. I've perfected some pretty good techniques I think.

  7. I think you're seeing yet another post. There is one that goes into detail about different methods of monitoring folders.

     

    My fax macro uses file manipulation to keep things straight. When a fax arrives the MFP pushes a PDF to the 'received' folder. Once every minute the macro fires and check to see if the domain user is the designated fax monitor. It then opens the first file in the folder with a Repeat with Folder > Break > End Repeat. Then it launches the PDF file directly using the Launch only command and since there is a file association to PDF one can simply use the file name with path. It's just like you typed it in the "Run" window. I wait for the widow to appear and become ready and once it does I give the user a series of prompts for things like who the recipient is, notes, of if they just want to delete it. Once they click OK an email is sent out to the selected users with a link to the file's final destination. Then I close the document (not Acrobat because it takes FOREVER to load on some machines) and wait for the file to become ready again. It's very useful to use the status of the system file locks in macro timing. In now minimizes Acrobat and moves the file to another folder called "Notified". Then the whole thing repeats until there are no more files.

     

    Repeat with Folder in cases like these is problematic. For instance if you want to rename a bunch of files you're going to have fun. ME revaluates the folder contents every time it runs so unless all of your renames are alphabetically later you will get some wild results. In the fax monitor I found it easier to push the file to anther folder. In other cases I needed to keep the files in the same folder so in that case I do a Repeat with Folder but write the folder listing to a variable. Then I do a repeat again and chew thru that variable until it's empty. You can do the same thing by using the Variable Text Modify - Append to File option with a carriage return and then use the Repeat with Text File. It's easier to understand but I have this thing about avoiding disk writes.

     

    If you can't move the files and need to monitor for any change things get a lot more difficult but not insurmountable. You need to create a list and save it somewhere for the subsequent time the macro runs. Then you create a new list and check each item to see if it exists in the old list. Then you need to compare the other way. It's not too hard but you need to get your logic down pat. This is why a file move is a lot easier!

     

    To directly answer your question I think opening one document at a time might not be the best way. It depends on what you're doing with them. If it requires user input I'd suggest doing it one at a time. If you just want to open them to marvel at the cascading windows or something I can think of another way.... When you search for new files or whatever and you have several candidates to launch there is a way to avoid all your timing issues I think. Simply write all the file names with path to a batch file. Then run the batch file and delete it! You could even wait for the window title of the last file since Word puts the file name in the title bar.

     

    Maybe if you describe more what it is you're doing I could give a better answer. There's a lot of 'it depends' in here.

  8. In the timing section check out the "Wait for Window Title". Also if you're interested look back thru the recent posts a I gave a guy my suggestions on monitoring folders. I have a large macro that monitors a folder for PDF files fro a fax machine and I think it will be about the same as what you are trying to do.

     

    Also if you use any Repeat with Folder commands it's better to make a file list for comparison as the folder contents might change before it is done opening all the Word windows.

  9. So you're saying when the texttype runs it will type "d;" instead of the "d:" you have in the command? That is strange. I do this sort of thing a lot and never had such a trouble. However if it's a field I will usually use the "Use Clipboard to Paste" option. I know it's not what you're looking for but if you need a workaround that might suffice for the time being. Also check out using controls to push text. It has saved me a lot of headaches.

  10. I'm finding the shared clipboard is a nightmare. The only solutin I've been able to find so far is to is to disable it but this has to be done in the Group Policy Editor and I don't have to have to reboot every time I make a change. I found that if I clear the clipboard every time I use it I don't have problems. Maybe I shoudl do a writeup on this an stick it on my website....

  11. I've seen the knowledgebase article and a few posts but most make vague reference to certain things not working. Does anyone have a categorical listing of functional limitations? I can experiment but it would be easier to read about it.

     

    I know as long as the TS session is displayed things work fine. I also know that if disconnected some things don’t work. I’m guessing TS doesn’t bother displaying things in effect if there is no audience which might indicate some things that don’t work. I also know that I have large macros that run programmatically, not using the GUI, and they all work fine even if disconnected. But I’m about to write a macro that needs to interact with a program over hours coping, pasting, and navigating and it would be nice if I didn’t have to have the TS window up the entire time to run it.

     

    Even if you don’t have such a list but know of some limitation running a macro in a TS session minimized or disconnected I’d love to hear it.

     

    Thanks!

  12. There is no sort function in ME. I' supprised that I don't see any in the PGMacros functions library either. Someone may have one though you could borrow. Beyond that you need to do it programmatically. http://en.wikipedia.org/wiki/Sorting_algorithm has some good algorithms you could emulate.

     

    You might also consider using the strength of another application. It’s a simple matter to have Excel sort your data so you might consider employing it. This is the cool think about ME. You can use other applications as subroutines. For instance calculation of the square root of something is difficult programmatically. But it’s a breeze to pop open the Windows Calculator and use it.

  13. Kevin: You can replace with "nothing" and avoid the trim.

     

    another1one: Isn't this a European postal code? I think you all do it opposite (and more sensibly if you ask me) from the way we plosition it in the US. If it is it's a fixed number of digits and you can simple delete the appropriate number of characters.

     

    Also when dealing with different text issues I've found Variable Set to ASCII Value" useful. This way I can do a mathematical comparison. So instead of having a line for each numeric character I can see if a character's ASCII integer value is within a range.

  14. Strathos approaches the problem as I would. He takes the clipboard into a string variable and gets the position of the firs space and saves that to an integer variable. He then decrements the integer once and grabs the text from character 1 to the integer value. And he simply plows on thru parsing the bits between spaces into text variables.

     

    But I see a problem here. How does anyone know what is first middle and last? Your rule of 5 versus 4 is the key and your going the right way. First trim the variable from the clipboard and strip CRLF (Carriage Return Line Feed). Many times users accidentally grab spaces or an "Enter" on the end. Then count how many characters there are. Now repeat that many times and grab each subsequent character and increment a counter if it’s a space. I do this in a couple of macros counting tabs so I can tell how many fields there are. Here, let me hack on out quick.

     

    Variable Set String %T1% from Clipboard

    Variable Modify String: Trim %T1%

    Variable Modify String: Strip CR/LF from %T1%

    Variable Set Integer %N1% from Length of Variable %T1%

    Repeat Start (Repeat %N1% times)

    Variable Modify String: Copy Part of %T1% to %T2%

    If Variable %T2% = " "

    Variable Modify Integer: Inc (%N3%)

    End If

    Repeat End

     

    <TVAR2:01:03:><TMVAR2:01:01:00:000:000:><TMVAR2:04:01:00:000:000:><IVAR2:01:12:1><REP3:01:000001:000001:%N1%:1:02:><TMVAR2:10:02:01:N02:001:><IFVAR2:1:02:1: ><NMVAR:08:03:0:0000001:0:0000000><ENDIF><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:%N3%>

     

    As you can see it's pretty simple. So now when you are parsing you can add a condition for the middle name part as weather you append the second middle name.

×
×
  • Create New...