AppTux Posted March 11, 2011 Share Posted March 11, 2011 Is it possible to make or is there already a ShellExecuteAs function??? Thanks in advance, AppTux PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Zer0Velocity Posted March 11, 2011 Share Posted March 11, 2011 Might want to take alook at RunAs Link to comment Share on other sites More sharing options...
AppTux Posted March 11, 2011 Author Share Posted March 11, 2011 I already did that, but if I want to open the site (like www.autoitscript.com) it's impossible for RunAs. I was thinking about a ShellExecuteAs() function made by myself. But that's really hard I think, but it's possible, but you need a lot of time to make such a good function as ShellExecute(). Maybe if I don't have anything else to do, can I try to make a ShellExecuteAs() but not now.... Not interested and I have other things to do. PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
JohnOne Posted March 11, 2011 Share Posted March 11, 2011 Eh ! you seemed interested in the first post. whats changed? I'm pretty certain its possible do such a thing with runas, but I have other things to do. 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...
iamtheky Posted March 11, 2011 Share Posted March 11, 2011 (edited) open the site (like www.autoitscript.com) it's impossible for RunAs.did you try as using the URL as an argument to the browser you want to open it with? Edited March 11, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
AppTux Posted March 11, 2011 Author Share Posted March 11, 2011 That's possible, I also was thinking about that, but I'm working on a more advanced run for Windows, with functions like a logfile, abbreviations and search on the internet using search engines, so it's a bit more complicated than you suggested PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
iamtheky Posted March 11, 2011 Share Posted March 11, 2011 so it's a bit more complicated than you suggested explained ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Carlo84 Posted March 11, 2011 Share Posted March 11, 2011 did you try as using the URL as an argument to the browser you want to open it with?that kinda kills the purpose Shellexecute has, cause it wont use the users default browser.Although i suppose default browser could be checked in the registry. _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
Tvern Posted March 11, 2011 Share Posted March 11, 2011 This might be a retarded way to do it, but assuming that ShellExecute inherits it's credentials from the calling script you may be able to do the following: Create a function that uses RunAs to run another instance of itsself, passing a filename in the command line. (in quotes). Then add a line to the top of your script that checks the command line when the script starts and ShellExecutes it if a file is specified, then exits. This should allow you to run the script, as User1, which launches the same script as User2, but with an CmdLine argument, which then ShellExecutes a file as User2 and exits. I'm having trouble explaining it clearly. I hope you understand. Link to comment Share on other sites More sharing options...
Carlo84 Posted March 11, 2011 Share Posted March 11, 2011 (edited) got it use runas with the value obtained from HKEY_CURRENT_USER\Software\Classes\http\shell\open\command if not found (current user) then read HKEY_CLASSES_ROOT\http\shell\open\command stringreplace "%1" with your url in quotes This way the url will still be launched in its default browser. [Edit-1] concidering you run it as a diffrent user you should probably just need HKEY_CLASSES_ROOT\http\shell\open\command [Edit-2] check post below Edited March 11, 2011 by Djarlo _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
guinness Posted March 11, 2011 Share Posted March 11, 2011 (edited) I think I got this Function from a Script by wakillon. Func _GetDefaultBrowser() Local $sRegRead = RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", "") $sRegRead = StringRegExpReplace($sRegRead, '\A[^"]*"([^"]+)".*\Z', '\1') If FileExists($sRegRead) Then Return $sRegRead EndIf Return SetError(1, 0, "") EndFunc ;==>_GetDefaultBrowser Edited August 29, 2011 by guinness UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Carlo84 Posted March 12, 2011 Share Posted March 12, 2011 I think I got this Function from a Script by wakillon.Func _GetDefaultBrowser() Local $gb_RegRead = RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", "") $gb_RegRead = StringRegExpReplace($gb_RegRead, '\A[^"]*"([^"]+)".*\Z', '\1') If FileExists($gb_RegRead) Then Return $gb_RegRead Return SetError(1, 0, 0) EndFunc ;==>_GetDefaultBrowserI like how it checks if its a valid string and if the path exists.i changed it a lil that after doing that check it returns it with the syntax specified in the registry instead of just the exe path :-)$i = _GetDefaultBrowserString('http://google.com') ConsoleWrite($i & @LF) Func _GetDefaultBrowserString($url) Local $gb_RegRead = RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", "") Local $path = StringRegExpReplace($gb_RegRead, '\A[^"]*"([^"]+)".*\Z', '\1') If Not FileExists($path) Then Return SetError(1, 0, 0) $path = StringReplace($gb_RegRead, '%1', $url) If @extended = 0 Then Return SetError(2, 0, 0) Return $path EndFunc ;==>_GetDefaultBrowserStringreturns in my case:"D:\Program Files\Mozilla Firefox\firefox.exe" -requestPending -osint -url "http://google.com" _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
guinness Posted March 12, 2011 Share Posted March 12, 2011 Nice update Djarlo UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
AppTux Posted March 12, 2011 Author Share Posted March 12, 2011 (edited) Thanks for all your replies, I'll try soon, but how about images or whatever, do I have to replace Local $gb_RegRead = RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", "") with this: ($extension is the extension of the file, like .au3, .png, .jpg, .bat) Local $gb_RegRead = RegRead("HKEY_CLASSES_ROOT\" & $extension & "\shell\open\command", "") Edit: edited syntax above Edited March 12, 2011 by AppTux PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
AppTux Posted March 12, 2011 Author Share Posted March 12, 2011 Did some research in the registry, and in the .png folder in the registry there isn't a shell subfolder, but:OpenWithListOpenWithProgIdsPersistentHandlerAnd in the OpenWithList folder are 2 subfolders called:ois.exePictureViewer.exeAnd in the folder OpenWithProgIds are 3 REG_NONE values, and 1 REG_SZ value.REG_NONE keys:Opera.imagepngfileQuickTime.pngAnd these means to the same called folders in the HKEY_CLASSES_ROOT folder.And in those is a folder named shell.Now I have to find out where is written which one is used (Opera.image, pngfile or QuickTime.png). Anyone a idea?P.S. : registry is so confusing... PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Carlo84 Posted March 12, 2011 Share Posted March 12, 2011 the extentions in the registry can also refer to a diffrent registry string. "HKEY_CLASSES_ROOT\.png" should say "pngfile" so check "HKEY_CLASSES_ROOT\pngfile\shell\open\command" ;-) same for the others _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
AppTux Posted March 12, 2011 Author Share Posted March 12, 2011 I'll try tomorrow, I don't have time today PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
Varian Posted March 13, 2011 Share Posted March 13, 2011 (edited) You can also use RunAs for urls like so: Local $AdminAccount = 'YourAdmintratorAccount' Local $Domain = 'YourDomain_or_ComputerName' Local $Password = 'YourPassword' Local $URL = 'http://www.google.com' $Return = RunAs($AdminAccount, $Domain, $Password, 4, @Comspec & ' /c start ' & $URL, @SystemDir, @SW_HIDE) MsgBox(262208, 'Result', $Return) Edited March 13, 2011 by Varian 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