Sign in to follow this  
Followers 0
JJordan

Help Selecting a File

9 posts in this topic

I need assistance selecting one file from a Insert File Dialog Control from Microsoft Outlook 2003

I already have the script pointing to the folder that i want. There will only be one file in that folder and the file name always changes.

I downloaded AutoIT yesterday and i hit a minor roadblock with this Insert File Dialog. Great Application!

Thanks in advance for the help.

Jim

Share this post


Link to post
Share on other sites



I need assistance selecting one file from a Insert File Dialog Control from Microsoft Outlook 2003

I already have the script pointing to the folder that i want. There will only be one file in that folder and the file name always changes.

I downloaded AutoIT yesterday and i hit a minor roadblock with this Insert File Dialog. Great Application!

Thanks in advance for the help.

Jim

Welcome to AutoIt!

What were you using to get to that point. Are you scripting the GUI with Mouse/Keyboard commands, or using COM?

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Welcome to AutoIt!

What were you using to get to that point. Are you scripting the GUI with Mouse/Keyboard commands, or using COM?

:whistle:

Goal: Open Outlook, Create a new Email message, Attach one file, Send that email to someone. I think i have the other half of the code down to send it out, I'll stumble through it i think.

Microsoft has a very interesting way of labeling Controls, Class, IDs etc... Makes it a bit frustrating..

I send a RUN command to open outlook Then

WinActivate("Inbox - Microsoft Outlook", "")

Send("Outlook.exe ^n") ;Open a new email message. This is a bad way of doing this because if they have the calendar, notes etc open then it would open a new window in for that item. Any different way to open a new email message. I tried a bunch different classes, but the button nested within a menu bar control

WinActive("Untitled Message", "")

;Send("Outlook.exe !i & l") ;Opens the insert command and file option from the insert menu

;ControlClick ( "Insert File", "", "[Class:RichEdit20W; INSTANCE:2]") ;I think this puts the focus on the open box where i type the file path

;Send( "C:\Audit\Data") ; Send the Path to the open file dialog box

;Send("{ENTER}")

Share this post


Link to post
Share on other sites

Suggestion: ^N opens a new item in the current outlook category. To always open a new e-mail no matter what category you are in, outlook has another shortcut: ^!M (ctrl-shift-M) :whistle:

And I was able to easily manipulate the Insert File window ("Bestand Invoegen" in Dutch) by using:

While Not WinActive("Bestand invoegen")
    Sleep(10)
WEnd

Send("c:\boot.ini{ENTER}")

Exit

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Suggestion: ^N opens a new item in the current outlook category. To always open a new e-mail no matter what category you are in, outlook has another shortcut: ^!M (ctrl-shift-M) :whistle:

And I was able to easily manipulate the Insert File window ("Bestand Invoegen" in Dutch) by using:

While Not WinActive("Bestand invoegen")
    Sleep(10)
WEnd

Send("c:\boot.ini{ENTER}")

Exit

Thanks for the shortcut!

I didn't think i could send the text and a command on the same line. How can i do what you did above, but with random file name.

I have a program that audits a machine and it spits out an XML file with numbers in the file name. Example 843392.xml

I will not know the name of the XML file until the the audit program is finished. Unless i grab the name of the XML file in a variable during the audit program execution. The wheels are turning....

Share this post


Link to post
Share on other sites

Thanks for the shortcut!

I didn't think i could send the text and a command on the same line. How can i do what you did above, but with random file name.

I have a program that audits a machine and it spits out an XML file with numbers in the file name. Example 843392.xml

I will not know the name of the XML file until the the audit program is finished. Unless i grab the name of the XML file in a variable during the audit program execution. The wheels are turning....

If you have the name in $filename, you can Send($filename & "{ENTER}"). That what you mean?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

If you have the name in $filename, you can Send($filename & "{ENTER}"). That what you mean?

That is part of the probelm. I don't know the name file because the file is generated with a random name, but it comes in the form of 999999.xml (The 9's represent digits between 0 and 9).

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

That is part of the probelm. I don't know the name file because the file is generated with a random name, but it comes in the form of 999999.xml (The 9's represent digits between 0 and 9).

Maybe: looking for *.xml with FileFindFirstFile and FileFindNextFile. Get the list of xml files, then get all file times with FileGetTime, then look for the latest file, and use that.

/edit: _DateDiff() can help you look for the latest file.

/edit2: or, get a list of xml files before you run the audit program, then run the audit program, then get a new list of xml files, then use the one that wasn't there before?

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Maybe: looking for *.xml with FileFindFirstFile and FileFindNextFile. Get the list of xml files, then get all file times with FileGetTime, then look for the latest file, and use that.

/edit: _DateDiff() can help you look for the latest file.

/edit2: or, get a list of xml files before you run the audit program, then run the audit program, then get a new list of xml files, then use the one that wasn't there before?

I took a different route instead. I choose to rename the file to the computer name. Is this a good way of doing it?

Filemove("C:\Audit\Data\*.xml", "C:\Audit\Data\"& @ComputerName & ".xml")

I have another issues though. When i send the command to insert a file Send( "Outlook.exe !i & l") it appears to send the text "Outlook.exe" to the "To" field in the New email window? What am i doing wrong in the Send command for this to happen?

JJordan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0