polps Posted December 17, 2010 Share Posted December 17, 2010 Hello people, in my script I want detect if the script is launched directly by windows explorer (double click on the file) or by scite menu (tools - go). Anyone know if it's possible? Thanks Link to comment Share on other sites More sharing options...
wakillon Posted December 17, 2010 Share Posted December 17, 2010 Hello people,in my script I want detect if the script is launched directly by windows explorer (double click on the file) or by scite menu (tools - go).Anyone know if it's possible?ThanksI don't think so, you can see if scite is running but that's all ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
JFX Posted December 17, 2010 Share Posted December 17, 2010 get the parent process and check if it's Scite or AutoIt3Wrapper. If not it's properly done by double click Link to comment Share on other sites More sharing options...
wakillon Posted December 17, 2010 Share Posted December 17, 2010 get the parent processand check if it's Scite or AutoIt3Wrapper. If not it's properly done by double clickHow do you get the pid of a no compiled script ?because _WinAPI_GetParentProcess works by pid... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
JFX Posted December 17, 2010 Share Posted December 17, 2010 How do you get the pid of a no compiled script ?because _WinAPI_GetParentProcess works by pid...@AutoItPID Link to comment Share on other sites More sharing options...
wakillon Posted December 17, 2010 Share Posted December 17, 2010 (edited) @AutoItPID @AutoItPID is the PID of the process running the script you're right !Edit : i have tried your solution and in scite it returns pid of autoitwrapper.exe and with contextual menu it return explore.exe pid !What genius this Yashied ! Edited December 17, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
JFX Posted December 17, 2010 Share Posted December 17, 2010 #Include <WinAPIEx.au3> $parent = _WinAPI_GetParentProcess(@AutoItPID) $parent = _WinAPI_GetProcessName($parent) IF $parent = "AutoIt3Wrapper.exe" or $parent = "SciTE.exe" Then MsgBox(0,'Info','Script run from Scite') Else MsgBox(0,'Info','Script run by DoubleClick') EndIf Seems to work fine, have always the full scite package. So added also SciTE.exe. Link to comment Share on other sites More sharing options...
polps Posted December 17, 2010 Author Share Posted December 17, 2010 #Include <WinAPIEx.au3> $parent = _WinAPI_GetParentProcess(@AutoItPID) $parent = _WinAPI_GetProcessName($parent) IF $parent = "AutoIt3Wrapper.exe" or $parent = "SciTE.exe" Then MsgBox(0,'Info','Script run from Scite') Else MsgBox(0,'Info','Script run by DoubleClick') EndIf Yes, it's works perfectly! Thanks all. Link to comment Share on other sites More sharing options...
Duijst Posted August 17, 2011 Share Posted August 17, 2011 Why so complicated? Just check the last three characters of @ScriptName. If exe then compiled, if au3 then uncompiled (AutoItWrapper).If StringRight( @ScriptName, 4 ) ....Jeez .... KISS!Cheers Henk-Sjoerd. Link to comment Share on other sites More sharing options...
hannes08 Posted August 17, 2011 Share Posted August 17, 2011 (edited) What about @Compiled ? Edit: Just saw ... very old thread Edited August 17, 2011 by Hannes123 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Duijst Posted August 17, 2011 Share Posted August 17, 2011 Hahahahaha! Even more elementary. Thanks Hannes, didn't know that one, though it being on top of the macro list in the help file . Cheers. Link to comment Share on other sites More sharing options...
Duijst Posted August 17, 2011 Share Posted August 17, 2011 Yes, I know, it's an old thread. But I stumbled in to it en couldn't resist enlightning people. You know, Google and so .... Cheers. Link to comment Share on other sites More sharing options...
JFX Posted August 17, 2011 Share Posted August 17, 2011 Yes, I know, it's an old thread. But I stumbled in to it en couldn't resist enlightning people. You know, Google and so ....Someone who is standing in the shadow can not enlightening anyone.Please read the topic again Link to comment Share on other sites More sharing options...
JohnOne Posted August 17, 2011 Share Posted August 17, 2011 That just tells if its compiled. Not how it was ran. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Duijst Posted August 17, 2011 Share Posted August 17, 2011 That's right, JohnOne. But a simple problem definition as "in my script I want detect if the script is launched directly by windows explorer (double click on the file) or by scite menu (tools - go)" can be interpreted in many ways, therefore answered in many ways. All the more since it's not at all clear what should be achieved and why.Someone who is standing in the shadow can not enlightening anyone."Hear yee! Hear yee! The judge enters the theatre." You must have good eyes, JFX, to see from there where I'm standing. Or have we met before?Anyways, that's all completely off topic, I'm sorry.Cheers. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now