aVen9er Posted May 24, 2020 Share Posted May 24, 2020 I would like my script to do something different depending on whether my * .au3 file was launched from Visual Studio Code (by pressing F5) or by double-clicking in Windows Explorer. How to detect if *.au3 file was launched from Visual Studio Code? Link to comment Share on other sites More sharing options...
Danyfirex Posted May 24, 2020 Share Posted May 24, 2020 I think you can check parent process of your process. Something like _WinAPI_GetProcessName(_WinAPI_GetParentProcess()) PD: sorry for don't using sintaxis highlight I'm by phone. I'll update later. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Nine Posted May 24, 2020 Share Posted May 24, 2020 I think you would need to use 2 get parent process. With Scite at least it is working... MsgBox ($MB_SYSTEMMODAL,"",_WinAPI_GetProcessName(_WinAPI_GetParentProcess(_WinAPI_GetParentProcess()))) Danyfirex 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
aVen9er Posted May 24, 2020 Author Share Posted May 24, 2020 This is it! Thank you for a such a quick reply! Link to comment Share on other sites More sharing options...
argumentum Posted May 24, 2020 Share Posted May 24, 2020 #include <Debug.au3> #include <WinAPIProc.au3> _DebugArrayDisplay(WhereAreMyParents(), "WhereAreMyParents") Func WhereAreMyParents($iPID = @AutoItPID) Local $s, $a[11][3] = [[0, "", ""]] $a[1][0] = $iPID $a[1][1] = _WinAPI_GetProcessName($iPID) $a[1][2] = _WinAPI_GetProcessCommandLine($iPID) For $n = 2 To 10 $iPID = _WinAPI_GetParentProcess($iPID) If $iPID = 0 Then ExitLoop $a[0][0] = $n $a[$n][0] = $iPID $a[$n][1] = _WinAPI_GetProcessName($iPID) $a[$n][2] = _WinAPI_GetProcessCommandLine($iPID) Next ReDim $a[$a[0][0] + 1][3] Return $a EndFunc ;==>WhereAreMyParents ..I know I'm late but I type with 2 fingers and I was quite invested so, there ! Danyfirex and TheDcoder 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
TheDcoder Posted May 24, 2020 Share Posted May 24, 2020 @argumentum Kudos for the effort! @aVen9er You might also want to consider an alternative method of detection, maybe you can pass custom command line parameters, or maybe even use the @Compiled macro. All of my suggestions of course are generic, it is not possible to suggest the best method without knowing the use case EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Popular Post Nine Posted May 24, 2020 Popular Post Share Posted May 24, 2020 1 hour ago, argumentum said: but I type with 2 fingers Sorry to hear you have lost 8 fingers... Exit, bs27975, argumentum and 2 others 5 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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