Jump to content

Start exe as child of explorer.exe


Go to solution Solved by johnmcloud,

Recommended Posts

Posted

Try this :

#include <File.au3>

Func RunFromExplorer($exePath = "")
    If $exePath = "" Then Return

    Local $szDrive, $szDir, $szFName, $szExt
    $paths = _PathSplit($exePath, $szDrive, $szDir, $szFName, $szExt)
    $workingPath = $szDrive&$szDir
    ConsoleWrite($workingPath&@CR)

    $HotKey = "^!j" ; CTRL + ALT + U
    $shortcutPath = @DesktopDir & "\TmpLauncher.lnk"
    FileCreateShortcut($exePath, $shortcutPath, $workingPath, "", "", $exePath, $HotKey, "0", @SW_SHOWNORMAL); create a shortcut
    Send($HotKey) ; send the combination of key for open the software
    sleep(500)
    FileDelete($shortcutPath)
EndFunc


RunFromExplorer("C:\Windows\notepad.exe")
sleep(1000)
RunFromExplorer("C:\Program Files (x86)\Windows NT\Accessories\wordpad.exe")
Exit

Works only first time. then you need to close/reopen session ...

http://discuss.pcmag.com/forums/thread/1004433200.aspx

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Posted

true, it is not flexible, and considering the non-robustness of virtual keystrokes compared to direct calls, i'd advise against using this technique as a general all-purpose solution. that's why i suggested to use a shortcut keys combination that is unlikely to be in use (you can do that with FileCreateShortcut although not manually from the .lnk properties dialog). and in your scenario, you seem to need it on a regular basis, so no point in deleting or changing the shortcut or the keys combination.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Posted

well, I would need four or five such shortcut, so I could create them on the fly from logon startscript, and then just use them without creating/deleting them. Not a very nice way but should work.

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

  • Solution
Posted (edited)

My last shot on this:

;johnmcloud

_RunFromExplorer("notepad.exe")
Sleep(1000)
_RunFromExplorer("calc.exe")

Func _RunFromExplorer($ExePath = "")
    If $ExePath = "" Then SetError(1, 0, 0)
    $objShell = ObjCreate("Shell.Application")
    $objShell.FileRun
    WinWait("[CLASS:#32770]", "")
    ControlSetText("[CLASS:#32770]", "", "Edit1", $ExePath)
    ControlClick("[CLASS:#32770]", "", "Button2")
EndFunc   ;==>_RunFromExplorer

Tested on XP and CLASS maybe change on ther o.s. Pratically i'll open the Run Dialog Box and write the path of the software, so it start with explorer parent

Result:

test1.jpg

Edited by johnmcloud
Posted

WOW :blink:

Works perfectly on win7pro x64

Will test executing it from domain logon script (executed by system)

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Posted

johnmcloud, you win ! :thumbsup:

Works perfectly from admin netlogon !

Also works with python ;-)

Many thanks for your help !!!

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

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
  • Recently Browsing   0 members

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