bobbyab9987

How to open multiple files in only one instance of the corresponding program?

5 posts in this topic

Hi friends,

Suppose MyProgram is a tabbed program, meaning that it allows for opening multiple files in the same instance.

I want to open File1, File2 and File3 in one instance of MyProgram from an AutoIT script. How can I do this?

I have read the AutoIT Help File about "ShellExecute" and "Run", but I have found nothing helpful.

Thanks for reading my question. Any answer would be very appreciated.

 

 

Share this post


Link to post
Share on other sites



Hi bobby,

What do you mean by "tabbed program"?

What kind of files do you want to open?

For best results post code that is representative of the question\problem you have.

Kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

This thread has some approaches you can see using AutoIt.

 

Generally the pattern sounds like the tabbed application that would display a file per tab would be considered the Primary Instance of the application.  Other copies of the program that just pass the command line on to the Primary are considered Secondary instances.  They pass on the command line params, then exit.

 

The are many forms of Interprocess Communication or IPC that can be used on Windows.  The thread I linked has some done in AutoIt.  But you could roll your own using Windows API calls via the DllCall function.

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi Kylomas, pls see MilesAhead's post to understand my question more clearly. Thank you.

Hi MilesAhead, thank you for your answer. This seems to be complicated if we use just AutoIT to accomplish this task. I decided to combine AutoIT and a Windows batch file to achieve the same task, but with a simpler programming skill required.

Edited by bobbyab9987

Share this post


Link to post
Share on other sites

How are you getting your list of files?

How are you opening the files? Command-line or browsing etc.

If browsing, then look at the options for FileOpenDialog command in the 4th (Options) parameter - Multiselect.

Command-line is possibly even simpler, providing you supply all the elements correctly (quotes etc).

Other than that, I suggest you search for exactly what you want or provide some basic code that we can work with, especially so that we can get a clearer understanding of what you need.

It shouldn't be that complicated, providing you understand a few basics. In fact, it seems to me that adding a batch file is only adding complexity ... but then I'm not entirely sure of what you are wanting to do.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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

  • Similar Content

    • e45678mail
      By e45678mail
      Hi~
      I have some question about how to enable the test mode via "Run" or "shellexecute" of command,
      was to tried :
      -----
      Run("bcdedit.exe /-set testsinging on", "C:\Windows\System32")
      and
      shellexecute("bcdedit.exe /-set testsinging on", "C:\Windows\System32")
      -----
      since this command must to run through administrator competence,
      have any method can accomplish it?
       
       
    • ur
      By ur
      Is there anyway to check whether the script is launched already and wait till the other instance is closed and continue after that.
       
    • Miliardsto
      By Miliardsto
      Im creating a tab
      Global $Tab1 = GUICtrlCreateTab(30, 30, 600, 420, $TCS_BUTTONS, -1) And what we see in the function reference:
      https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateTab.htm
      GUICtrlCreateTab ( left, top [, width [, height [, style = -1 [, exStyle = -1]]]] ) ok in 5 arg I got $TCS_BUTTONS
      But How can I use multiple args like this below
      Global $Tab1 = GUICtrlCreateTab(30, 30, 600, 420, [$TCS_BUTTONS, $TCS_MULTILINE], -1)  
    • BlazerV60
      By BlazerV60
      Hello all,
      I've written the code below which launches chrome in incognito mode and then proceeds to go to the autoit website.
      From my understanding, the Run() command is also supposed to output the PID number related to the application that got launched from the Run command.
      However when I run the below lines, it outputs a PID number that is different from the newly launched chrome browser's PID number, does anyone know why and possibly explain how I could retrieve the accurate PID number associated with the newly launched browser?
      Global $iPid = Run(@ComSpec & ' /c start chrome.exe https://www.autoitscript.com/forum/ -incognito' ,"", "") msgbox(0,"",$iPid) Thank you,
      Brian