Sign in to follow this  
Followers 0
Guest bhunt

How to close programs

11 posts in this topic

I am trying to write a script that closes Excel and opens a new Excel file and puts it in the old file's place. Since I am a trader, I have Excel running on four monitors at the same time and all of the titles of the Excel Windows say "Microsoft Excel." Does anyone have any suggestions on how I can specify which particular Excel to close? Is there a way to close a program based on its location? Thanks for any help.

Share this post


Link to post
Share on other sites



Are all the excel documents blank? If they arent then you can tell which one to close by what text is contained within it.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

wait so u wnat it to close an existing excell document and u want it to open a blank one?


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

I am trying to write a script that closes Excel and opens a new Excel file and puts it in the old file's place.  Since I am a trader, I have Excel running on four monitors at the same time and all of the titles of the Excel Windows say "Microsoft Excel."  Does anyone have any suggestions on how I can specify which particular Excel to close?  Is there a way to close a program based on its location?  Thanks for any help.

<{POST_SNAPBACK}>

what's unique about the excel windows, besides their location, do they all have files open? are they always the same? Excel on my computer shows the filename in the title bar...

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

I want to close three excel documents and open three different documents. I have four open windows that say "Microsoft Excel", so I cannot just close all three of the documetns at once. Is there a way to close each document individually? If so, I cannot figure out how to do it. This is my first attempt at a script, so any help would be appreciated, and sorry if this is a simple question. Thanks.

Share this post


Link to post
Share on other sites

Okay please tell us more about the Excel documents you are wanting to close. Is it just a blank document? Or is there something in there? If you let us know what we ask then we will be able to help. You have to explain your problem in a bit more detail.

I would be happy to help but I need my questions answered.

Thanks,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Okay please tell us more about the Excel documents you are wanting to close. Is it just a blank document? Or is there something in there? If you let us know what we ask then we will be able to help. You have to explain your problem in a bit more detail.

I would be happy to help but I need my questions answered.

Thanks,

JS

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

I want to close three excel documents and open three different documents.  I have four open windows that say "Microsoft Excel", so I cannot just close all three of the documetns at once.  Is  there a way to close each document individually?  If so, I cannot figure out how to do it.  This is my first attempt at a script, so any help would be appreciated, and sorry if this is a simple question.  Thanks.

<{POST_SNAPBACK}>

Ok, when I look at my Excel 2003 with AutoIt's Window spy, it shows me visible window text that includes the filename.

are the three excel windows that're open always the same files? If so, use the filename in the text part of the winclose command.

$FileToClose = "somefile.xls"
WinClose("Microsoft Excel", $FileToClose)

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

The documents have names, they are not blank documents. Basically, what I am dealing with here is four computer screeens and 6 different trading groups, each group has three excel documents associated with it. What I want to do is close the three excel documents from one trading group, and open the three excel documents of another trading group, and put those newly opened documents in the place vacated by the programs that were just closed. I cant have more than 4 trading groups open at any time because that would require more information from bloomberg than my computer can handle.

For example, trading group 3's files are named group_3_monitor_T.xls, group_3_monitor_Q.xls, and group3.xlw. All of the other groups have the same file names except the numbers are different. I hope this answers your question. Thanks again.

Share this post


Link to post
Share on other sites

WinSetTitle should be all that you need, use random to generate a new name, then close it accordingly...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

The documents have names, they are not blank documents. Basically, what I am dealing with here is four computer screeens and 6 different trading groups, each group has three excel documents associated with it.  What I want to do is close the three excel documents from one trading group, and open the three excel documents of another trading group, and put those newly opened documents in the place vacated by the programs that were just closed.  I cant have more than 4 trading groups open at any time because that would require more information from bloomberg than my computer can handle.

For example, trading group 3's files are named group_3_monitor_T.xls, group_3_monitor_Q.xls, and group3.xlw.  All of the other groups have the same file names except the numbers are different.  I hope this answers your question.  Thanks again.

<{POST_SNAPBACK}>

Ok, so the answer is yes, you can do that. Though, beyond that, get cracking on the helpfile, find some specific things to ask for help on, get started with a script... Use SciTE as an editor, with all JdeB's nifty addons it really helps...

"I'm not even supposed to be here today!" -Dante (Hicks)

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