ssamko Posted December 28, 2015 Share Posted December 28, 2015 (edited) Hello ! I am quite new in autoit but I think that this udf can be useful for some of you becuse I couldn't find something similar. It includes 2 functions: 1) _GetPath - this function can get full path from name of file 2) _RunIn - function for opening URL in non-default browser expandcollapse popup#include-once #include <Constants.au3> ;======================================================================================= ; Function Name _GetPath ; ; Description: Gets a full path from name of file ; ; Parameter(s): name of file ; ; Return Value(s): 0 if the file is not found. ; path if the file was found successfully ; ; Author: ssamko ;======================================================================================= Func _GetPath($name="") Local $DOS, $Message = '',$path $DOS = Run(@ComSpec & " /C cd \ & dir /s /b "&$name, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Path = StdoutRead($DOS) If $Path="" Then Return 0 Return $path EndFunc ;==>_GetPath ;======================================================================================= ; Function Name _RunIn ; ; Description: Run url in non default browser ; ; Parameter(s): name or path to browser ; url ; window: 0 for opening in actual window ; 1 for opening in new window ; ; Return Value(s): 0 if parameters ísn't found ; ; Author: ssamko ;======================================================================================= Func _RunIn($name="", $url="", $window=0) If $name<>"" And $url<>"" Then $url=" "&$url If Not FileExists ( $name ) Then $name= _GetPath($name) If $window=1 Then $window=" --new-window" Run($name&$url&$window) Return "" Else MsgBox(0,"Error","Make sure you if you filled both parameters.") Return 0 EndIf EndFunc ;==>_RunIn If you have some questions or tips just write. PS: Please can you rate my english level from 1-10 ? Edited March 29, 2016 by ssamko Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2015 Share Posted December 28, 2015 (edited) Probably need to be an exe which was installed via some compliant package.Definitely does not work on stand alone packages.EDIT: Your English 9/10 Edited December 28, 2015 by JohnOne 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...
ssamko Posted December 28, 2015 Author Share Posted December 28, 2015 Probably need to be an exe which was installed via some compliant package.Definitely does not work on stand alone packages.EDIT: Your English 9/10Yes...it is in description. Maybe later I will try to improve it for all exe files. Link to comment Share on other sites More sharing options...
ssamko Posted March 29, 2016 Author Share Posted March 29, 2016 On 27. 12. 2015 at 5:00 PM, JohnOne said: Probably need to be an exe which was installed via some compliant package. Definitely does not work on stand alone packages. EDIT: Your English 9/10 UDF updated ! Now _GetPath searches not only for installed exe but also for other files. 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