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

    • BlazerV60
      By BlazerV60
      Hello all,
      I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods:
      ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried:
      ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried:
      RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir)  
      But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? 
      Bonus points if you know how to make it launch chrome hidden and make it go to https://www.autoitscript.com
       
      Thank you,
      Brian
    • XinYoung
      By XinYoung
      Hello all,
      I've been working on 4 standalone scripts. They each have their own GUI and are now independent .exe's. But instead of having 4 separate icons on my computer, is it possible to put them all together into one .exe?
      What I want is one interface with tabs. Each script's GUI would be on their own respective tab. Is this possible?
      The different scripts don't need to communicate with one another. I just want them all in one .exe.
      I can't find this anywhere... Any help would be greatly appreciated. Thank you!
    • Miloud
      By Miloud
      How to get the result of the command?
      My code :
      Local $iRc = ShellExecute ( "G:\ffmpeg\bin\ffmpeg.exe" , "-version" , "G:\ffmpeg\bin\") ProcessWaitClose($iRc) $Message = StdoutRead($iRc)
    • breakbadsp
      By breakbadsp
      I want to run a python script from autoit. 
      I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments.
      How to pass them from autoit script?
      I tried many ways.
      Following solution also not working 
      e.g. 
      RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution:
      RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path')  
      PFB description:
      https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
       
    • rootx
      By rootx
      I need help to understand why the run function does not work, but if i use it directly inside cmd shell the command works. $where is the name of the jpg file
      ShellExecute(@ComSpec ," /k C:\Users\root\Desktop\test\exiftool.exe -p $FileName "&'"'&$where&'"'&" > "&'"'&@ScriptDir&"\out.txt"&'"',@ScriptDir);<----- work Run("C:\Users\root\Desktop\test\exiftool.exe -p $FileName "&$where&" > "&@ScriptDir&"\out.txt",@ScriptDir);<--- doesn't work I would use the run command!
      Thx