Sign in to follow this  
Followers 0
jusjeremy

Selecting Desktop Icons

7 posts in this topic

Hey all, first let me say i'm sorry if this has been answered a thousand times, I looked and could not find the help I was looking for.

I've got a goofy issue, I use the RunAs command inside my script and it launches the application w/o issue, the application however, invokes another process that does not launch with the network credentials I started the initial process with and I get "no password stored" errors in the application. checking the application process in task manager, it is running under the local profile and not the network credentials I need it to. long story short, I am trying to find a way to run the shortcut from the desktop and invoke the RunAs manually (as in right click the desktop icon, send the appropriate keys to select run as, and then input the network credentials i need), - or - to automate the desktop shortcut to be modified to automatically open with a RunAs dialogue box (i.e. right click the icon, select properties, advanced, and check the box with the run as different credentials next to it.

I will take any and all help! Thank you in advance!

Also, if you can help me find a way to pass login credentials from one process to another, that would be a Bonus!

also, I can include samples scripts if requested.

Share this post


Link to post
Share on other sites



I'd like to add that this is something I will be doing with multiple PCs and the desktop icons will be all over the place and not necessarily in the same place. The program directories where the shortcuts point to are static however.

Share this post


Link to post
Share on other sites

Your going about this the wrong way.

The desktop has a directory and there is runas command and shellexecute command that can be used to do what you want.

Don't bother with clicking

Share this post


Link to post
Share on other sites

the problem is with the embedded RunAs command in the autoit script, I dont get the necessary permissions on the second process that is called automatically after calling the first program with the correct credentials. This is the reason I need to do a RunAs manually outside of the script.

Share this post


Link to post
Share on other sites

This should get you closer to your mark. It is looking for a directory called "temp", so you will need to tweak as needed. Once you get the context menu up there are other functions to manipulate that, if you need more help post back and someone else can help with that part.

#Include <GuiListView.au3>
selected()
Func selected()
    WinMinimizeAll()
        $hList = ControlGetHandle('', '', '[CLASS:SysListView32;INSTANCE:1]')
        for $i = 0 to _GUICtrlListView_GetItemCount($hList)
            $name=_GUICtrlListView_GetItemText($hList, $i)
            if $name= "temp" Then
                _GUICtrlListView_ClickItem($hList,$i,"right","true",2)
                ConsoleWrite($name)
            EndIf
        Next
EndFunc

Share this post


Link to post
Share on other sites

Thanks, I'll try that.

Share this post


Link to post
Share on other sites

Picea,

I was able to modify what you gave me to suit my needs, Thanks again for the help, great piece of code!!!

just curious here, do you have any clue why the RunAs inside the script would be different than manually invoking it in windows? Again, if the use the runas inside the script, it opens the app that I need just fine, but the second app that opens automatically runs under the local user and not the credentials i specified. Also, I have no control over the second app, it is called by the first app so I dont think I can add anything to the script regarding that process specifically.

When using runas from windows (i.e. right clicking an icon and selecting runas) the permissions/credentials carryover to that second process just fine.

thanks again! huge help!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0