Carm01 Posted March 27, 2014 Share Posted March 27, 2014 Hello, I am trying to create a way to drop and drag a file path using some examples in the help and then take that variable and pass it on to a runaswait so i can run whatever program i want with specified user rights. This problem i cant seem to get around is the fact that the variable $file is retained when drop and drag is preformed, however the runaswait command does not seem to recognize it, as a result no program is ran , but the message box shows that the variable retains the path ( message box used used for testing of script ). I spend a few hours trying various things to try to resolve this including trying to include quotes in the variable path, changing passing the $file to another variable, and several more. Odd enough if I set the variable it works, but defeats the purpose of being able to choose any program to run with a specified account ( this is for a domain environment, however should function the same on local account ) Any assistance is appreciated expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "username" Local $sPassword = "password" Local $file, $btn, $msg GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, $WS_EX_ACCEPTFILES) $qwerty = GUICtrlCreateInput("", 10, 5, 300, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) ;GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState(@SW_SHOW) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn ExitLoop EndSelect WEnd RunAsWait($sUserName, @ComputerName, $sPassword, 0, $file, "", @SW_SHOWMAXIMIZED) MsgBox($MB_SYSTEMMODAL, "drag drop file", GUICtrlRead($file)) EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Solution jguinch Posted March 27, 2014 Solution Share Posted March 27, 2014 Try this : RunAsWait($sUserName, @ComputerName, $sPassword, 0, GUICtrlRead($qwerty), "", @SW_SHOWMAXIMIZED) MsgBox($MB_SYSTEMMODAL, "drag drop file", GUICtrlRead($qwerty)) instead Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Carm01 Posted March 27, 2014 Author Share Posted March 27, 2014 Try this : RunAsWait($sUserName, @ComputerName, $sPassword, 0, GUICtrlRead($qwerty), "", @SW_SHOWMAXIMIZED) MsgBox($MB_SYSTEMMODAL, "drag drop file", GUICtrlRead($qwerty)) instead So simple it was right in from of my face lolz thank you 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