Jump to content

File Association with script....


Recommended Posts

hey there,

I've read the FAQ and yet it remains a mystery to me... i can associate a file with my script and it works... as i click on the file twice it runs my script and sends the params to it as should... however, i want the associated file to work with my script also after it was ran....

Eg:

#A. I double click my file "toxins.bui" => compiled script is launched, it recognises the $CmdLine[$n] and it acts accordingly.

#B. As the compiled script is still runing i double click "toxins.bui" again and it runs a second instance of my compiled script.

*>> I want it not to run the script over and over again, but instead to send the parameters to the already active script, how do i do that ?

[line in WinAmp... when you double click a .mp3 file, it just adds it in the list instead of opening a new winamp instance...]

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

hey there,

I've read the FAQ and yet it remains a mystery to me... i can associate a file with my script and it works... as i click on the file twice it runs my script and sends the params to it as should... however, i want the associated file to work with my script also after it was ran....

Eg:

#A. I double click my file "toxins.bui" => compiled script is launched, it recognises the $CmdLine[$n] and it acts accordingly.

#B. As the compiled script is still runing i double click "toxins.bui" again and it runs a second instance of my compiled script.

*>> I want it not to run the script over and over again, but instead to send the parameters to the already active script, how do i do that ?

[line in WinAmp... when you double click a .mp3 file, it just adds it in the list instead of opening a new winamp instance...]

I think you would have to detect the condition with _Singleton(), pass the new file to the first instance via interprocess comms (WM_COPYDATA message, write to a hidden control, etc.), and then exit the second instance.

It sounds like fun! If I get a moment this evening I'll code a demo.

muttley

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
Link to comment
Share on other sites

If ProcessExists("program.exe") Then OpenInSameWindow()

The problem with that is the first instance will see itself with ProcessExists(), so that doesn't tell you if there is more than one running.

You could use

$avProcList = ProcessList("program.exe")
If $avProcList[0] > 1 Then ...
But that will change behavior based on compiled/uncompiled script.

That's why _Singleton() make sense for this.

muttley

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
Link to comment
Share on other sites

Oky, Fixed.... Sorry for Bump....

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...