Jump to content

Recommended Posts

Posted

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

Posted

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

I don't think so, you can see if scite is running but that's all !

AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0WIN 11 24H2 X64 - Other Examples Scripts

Posted

get the parent process

and check if it's Scite or AutoIt3Wrapper. If not it's properly done by double click

How do you get the pid of a no compiled script ?

because _WinAPI_GetParentProcess works by pid...

AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0WIN 11 24H2 X64 - Other Examples Scripts

Posted (edited)

@AutoItPID :x

@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 ! Posted Image

Edited by wakillon

AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0WIN 11 24H2 X64 - Other Examples Scripts

Posted

#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.

Posted

#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.

  • 7 months later...
Posted (edited)

What about @Compiled ? :)

Edit: Just saw ... very old thread :mellow:

Edited by Hannes123
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted

Hahahahaha! Even more elementary.

Thanks Hannes, didn't know that one, though it being on top of the macro list in the help file :mellow:.

Cheers.

Posted

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.

Posted

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 :mellow:

Posted

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.

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
×
×
  • Create New...