roybullard Posted December 29, 2008 Report Share Posted December 29, 2008 All, I would like to send daily a PDF attachment that our inhouse ordering system generates. The only issue is that the file is generated from our systems spool output and the file name changes. The only thing in the name that remains static is the username. so here would be an example file name "username-job_name.time.jobnumber.pdf here would be an actual example royb_b-palm.20081228.145505.1335.pdf. The same user will run this file everyday so if there is a way to use that as an identifier that would work great please help. I need to get this project done as soon as possible. Thanks, Quote Link to comment Share on other sites More sharing options...
stevecasper Posted December 29, 2008 Report Share Posted December 29, 2008 All, I would like to send daily a PDF attachment that our inhouse ordering system generates. The only issue is that the file is generated from our systems spool output and the file name changes. The only thing in the name that remains static is the username. so here would be an example file name "username-job_name.time.jobnumber.pdf here would be an actual example royb_b-palm.20081228.145505.1335.pdf. The same user will run this file everyday so if there is a way to use that as an identifier that would work great please help. I need to get this project done as soon as possible. Thanks, Assuming I understand your system correctly, and what it is you are trying to do, I believe I have a solution for you. Since the username never changes, you can establish that as part of your basic macro code, requiring no prompts. Assuming the date that the job was run is today's date, you simply create a Date/Time command in the same format that your file will use in the file name, from your description that format is yyyymmdd. (If the date the job was run is not "today" but is consistently "yesterday" you can establish the Date/ Time command to remove 1 day from today, or if it is not consistent, you can even have the Date/Time command prompt the user for the correct date.) Now you append all this information in the order that it is placed in the file name. Now you simply need to have your macro Program Launch and use the file path to the location where this file will be (the Program Launch command doesn't let you brows to a folder, you will need to either enter the path to the folder, or browse to a file within the folder, then remove the file name - leaving just the folder path). Your macro will then open the folder so it's now just a matter of doing a search for the particular file you're after. Once it has been found, the macro can use commands for File -> Send -> Mail Recipient, or whatever process you need. Clearly the example macro I am posting below will need some expansion to suit your specific needs, but it should help you get the ball rolling. Date/Time: Save "yyyymmdd" into %T1% Variable Set String %T2% "royb" Variable Set String %T3% "b-palm" Multiple Choice Menu: Job Variable Modify String: Append "_%T3%.%T1%" to %T2% Program Launch: "" Text Type: <CONTROL>f Delay 0.5 Seconds Text Type: %T2%<ENTER> Delay 0.5 Seconds Text Type: <CONTROL>f Text Type: <ARROW DOWN> Text Type: <ALT>f Text Type: n <DT:yyyymmddT:01:1:><TVAR2:02:01:royb><TVAR2:03:01:b-palm><MENU2:1:T:03:CenterCenter:JobWhich Job?b-palm job2 job3><TMVAR2:07:02:00:000:000:_%T3%.%T1%><LAUNCHDEL2:0:01C:\IDInfo\><TEXTTYPE:<CONTROL>f><DELAY:.5><TEXTTYPE:%T2%<ENTER>><DELAY:.5><TEXTTYPE:<CONTROL>f><TEXTTYPE:<ARROW DOWN>><TEXTTYPE:<ALT>f><TEXTTYPE:n> Quote Link to comment Share on other sites More sharing options...
kevin Posted December 29, 2008 Report Share Posted December 29, 2008 I would like to send daily a PDF attachment that our inhouse ordering system generates ... and the file name changes You could use SCasper's macro to create a variable containing the filename and then use Macro Express's E-Mail Send: macro command to send the email. In the E-Mail Send dialog Under the 'Attachments' tab there is an 'Add' button you click to specify the attachment. When clicked, it asks if you are adding a filename or a variable. Choose variable. Quote Link to comment Share on other sites More sharing options...
roybullard Posted December 29, 2008 Author Report Share Posted December 29, 2008 Heys guys thanks for the help. I guess i am not following exactley what the variables do and how to set them up. If it helps our spool outputs these files to a network drive. Quote Link to comment Share on other sites More sharing options...
stevecasper Posted December 29, 2008 Report Share Posted December 29, 2008 Heys guys thanks for the help. I guess i am not following exactley what the variables do and how to set them up. If it helps our spool outputs these files to a network drive. A variable, when dealing with Macro Express, is a virtual "hook" that holds whatever information you assign to it. When executing various commands within a macro, the command will utilize the information contained in the variable. For example: Variable Set String %T1% "My name is " This simple command hangs "My name is " on the "hook" titled %T1% (ie. Inserts "My name is " into Text Variable 1) Variable Set String %T2% from Prompt This command prompts the user for his/her name, after which it assigns the person's response to %T2% Variable Modify String: Append %T2% to %T1% This third command adds the information from %T2% to the end of %T1%. Now, because %T1% contains the original information "My name is " as well as the name of the user, we could use the Text Type command to type out the variable %T1%. For this example, we want to make sure there a notepad is open to receive the text as it gets typed out, so we use a command to open notepad. Activate or Launch: "untitled - notepad" OR "notepad.exe" Wait For Window Title: "untitled - notepad" Finally, the text type command gets utilized. Text Type: %T1% When you're done, the macro will look like this (in the Scripting Editor): Variable Set String %T1% "My name is " Variable Set String %T2% from Prompt Variable Modify String: Append %T2% to %T1% Activate or Launch: "untitled - notepad" OR "notepad.exe" Wait For Window Title: "untitled - notepad" Text Type: %T1% If you want to copy this macro directly into your Macro Express Editor, use this code: <TVAR2:01:01:My name is ><TVAR2:02:02:FWhat is your name?FFCenter:Center><TMVAR2:08:01:02:000:000:><LAUNCHYES3:0:0112untitled - notepad<LAUNCH:notepad.exe><WAITWIN2:000010:000000:untitled - notepad><TEXTTYPE:%T1%> I highly recommend taking a little time to familiarize yourself with the tutorial as well as the sample macros that come with Macro Express. Analyze them, pick them apart, figure them out. The best way to learn how to write a macro in Macro Express is to experiment with the program. Look at other people's macros, and make changes to them to see how those changes affect the way the macro behaves. Once you have a solid understanding of the basics, the world of possibilities that Macro Express offers will begin to open itself up to you. On the forums, you'll rarely find a shortage of people willing and happy to help, but none of us can give the time and focus you can get from a thorough reading of the tutorials, practicing with sample macros, and playing around with the basics. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.