mcgill Posted September 5, 2006 Posted September 5, 2006 How can I run explorer on a windows xp box, this line of code works fine on a win 2000 box. run("explorer") and run("explorer.exe")
xcal Posted September 5, 2006 Posted September 5, 2006 That works perfectly fine on my XP. If not on your's, try Run(@WindowsDir & "\explorer.exe") How To Ask Questions The Smart Way
mcgill Posted September 5, 2006 Author Posted September 5, 2006 Tried with Run(@WindowsDir & "\explorer.exe") , application still failing. $ret = _GUICtrlListViewGetItemText ($listview1, -1, 0) ; Set the RunAs parameters to use local adminstrator account ;$USERNAME = "***********" ;$PASSWORD = "**********" $DOMAIN = @LogonDomain ;"domain.com" $RUN = 0 ; run indicator ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($username, $DOMAIN, $password) ;Run(@WindowsDir & "\explorer.exe") - line fails here on winxp service pack 2 ;run("explorer") - also this line of code does too, both examples don't work WinWaitActive("My Documents") Send("!d") $x = StringFormat("%s", $ret) ;msgbox(0,"", $x) Send($x & "{ENTER}") RunAsSet() endif
Developers Jos Posted September 5, 2006 Developers Posted September 5, 2006 (edited) Tried with Run(@WindowsDir & "\explorer.exe") , application still failing. $ret = _GUICtrlListViewGetItemText ($listview1, -1, 0) ; Set the RunAs parameters to use local adminstrator account ;$USERNAME = "***********" ;$PASSWORD = "**********" $DOMAIN = @LogonDomain ;"domain.com" $RUN = 0 ; run indicator ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($username, $DOMAIN, $password) ;Run(@WindowsDir & "\explorer.exe") - line fails here on winxp service pack 2 ;run("explorer") - also this line of code does too, both examples don't work WinWaitActive("My Documents") Send("!d") $x = StringFormat("%s", $ret) ;msgbox(0,"", $x) Send($x & "{ENTER}") RunAsSet() endif Where are you running this script from ? (server?) Try added the Workdir on the Run command.. something like @tempdir should do... Edited September 5, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Danny35d Posted September 5, 2006 Posted September 5, 2006 This should work on Win2k and WinXp, I don't have a Win2k machine but, works on WinXp.Run(@ComSpec & " /c start explorer.exe", @WorkingDir, @SW_HIDE) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
mcgill Posted September 5, 2006 Author Posted September 5, 2006 The line of code works fine on win2k but when i run the line of code on win xp, it hangs the application Run(@ComSpec & " /c start explorer.exe", @WorkingDir, @SW_HIDE)
DaveF Posted September 5, 2006 Posted September 5, 2006 It's the RunAsSet that's causing your trouble, there are measures to prevent EXPLORER.EXE from running with different credentails in Win XP. I've worked around this in the past by calling the Internet Explorer EXE instead. I typically do this by hand, I don't know if IE would accept a starting address of "My Documents" on the command-line, but you could try... Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.
lod3n Posted September 5, 2006 Posted September 5, 2006 Try this: filecreateshortcut(@WindowsDir&"\explorer.exe",@scriptdir&"\explorer.lnk") Run(@ComSpec & ' /c start "explorer" explorer.lnk', @scriptdir, @SW_HIDE) filedelete(@scriptdir&"\explorer.lnk") [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
GaryFrost Posted September 5, 2006 Posted September 5, 2006 RunAs with Explorer doesn't work on XP SP2, we've tried that also at work SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
lod3n Posted September 5, 2006 Posted September 5, 2006 But, why are you running explorer hidden? Can a hidden window be active? [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
GaryFrost Posted September 5, 2006 Posted September 5, 2006 (edited) But, why are you running explorer hidden? Can a hidden window be active?They aren't running explorer hidden, the command window that they are calling explorer from is hidden Edited September 5, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
lod3n Posted September 6, 2006 Posted September 6, 2006 http://blogs.msdn.com/aaron_margosis/archi.../07/175488.aspxOption 2. Set the flag that allows explorer.exe to work with RunAsIts actually very simple. The trick is to set the folder option to Launch folder windows in a separate process. This is a per-user option, off by default, that needs to be set for the target user account. That is, if you want to use RunAs to start explorer.exe as MyAdminAccount, then MyAdminAccount needs to have the separate process option set. Once this flag has been set, you can start explorer.exe with RunAs, or from your admin cmd shell. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
GaryFrost Posted September 6, 2006 Posted September 6, 2006 http://blogs.msdn.com/aaron_margosis/archi.../07/175488.aspxI'll have to give it a try tomorrow at work, see if the gpo let's it stick SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
acastle Posted September 6, 2006 Posted September 6, 2006 I have a similar problem. I'm trying to download the latest java runtime environment and then run it silently. I already have an autoit script to run it silently and I just want to dl it first. I'm just having trouble hitting the target url. I went the @ComSpec route prior but couldn't seem to get the syntax to hit the iexplore.exe and the url at the same time. I got it to work with send comands but I'm wanting to do this more reliably than that. Here's what I've got now: $ie = "C:\Program Files\Internet Explorer\iexplore.exe" $jre = "http://jdl.sun.com/webapps/download/AutoDL?BundleId=10433" ;offline win install If FileExists(@ProgramFilesDir & "\Java\jre1.5.0_06") Then MsgBox ( 0, "Java", "JRE 1.5.0.06 already installed.", 5 ) Exit Else Run($ie & $jre) EndIf Exit My last @ComSpec line was: Run(@ComSpec & " /c " & "C:\Program Files\Internet Explorer\iexplore.exe" 'http://jdl.sun.com/webapps/download/AutoDL?BundleId=10433', "") I took out the hide to keep my sanity. Any help/suggestions would be greatly appreciated.
Helge Posted September 6, 2006 Posted September 6, 2006 (edited) @acastle : 1. You're trying to run "iexplore" with a link. Try adding a space between it and the link, or elseit will try to run file with this strange name : "iexplore.exehttp://jdl.sun.com/webapps/downl..."2. You're sure that "Java\jre1.5.0_06" doesn't have an extension ? Like ".exe" ?3. Back to your download-thingie again. Why don't you just use INetGet() ?Edit : 4. You're using Run() to start @ComSpec which again starts "iexplore.exe".That's not needed as Run() is very able to run it "iexplore.exe" directly. Edited September 6, 2006 by Helge
acastle Posted September 6, 2006 Posted September 6, 2006 @Helge :"Java\jre1.5.0_06" is a folder and in it is the \bin\java.exe. Each version of the jre installs to a seperate folder inside the main Java folder. I overlooked the InetGet() and will try that out. I'm sure it will work just fine. Thanks,
mcgill Posted September 6, 2006 Author Posted September 6, 2006 Alright so RUNAS does not work with WIN XP sp2 with explorer but can I use it with iexplore.exe? I changed my code with this and works fine with win 2000, but when running on win xp it won't open iexplore.exe even though it is pointing to the correct path, any ideas? $ret = _GUICtrlListViewGetItemText ($listview1, -1, 0) ; Set the RunAs parameters to use local adminstrator account $USERNAME = "*********" $PASSWORD = "********" $DOMAIN = @LogonDomain ;"domain.com" $RUN = 0 ; run indicator ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($username, $DOMAIN, $password) Run("C:\Program Files\Internet Explorer\iexplore.exe") WinWaitActive("Ceridian's Intranet") Send("!d") $x = StringFormat("%s", $ret) Send($x & "{ENTER}") RunAsSet() endif
MHz Posted September 6, 2006 Posted September 6, 2006 Did you try the advice mentioned back at post #4?
mcgill Posted September 6, 2006 Author Posted September 6, 2006 Tried with and got the same error on win xp: " unable to execute the external program " Run("C:\Program Files\Internet Explorer\iexplore.exe", @WorkingDir)
MHz Posted September 6, 2006 Posted September 6, 2006 Small change to try. $ret = _GUICtrlListViewGetItemText ($listview1, -1, 0) ; Set the RunAs parameters to use local adminstrator account $USERNAME = "*********" $PASSWORD = "********" $DOMAIN = @LogonDomain ;"domain.com" $RUN = 0 ; run indicator ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($username, $DOMAIN, $password) $workingdir = @WorkingDir If FileChangeDir("C:\Program Files\Internet Explorer") Then Run("iexplore.exe") WinWaitActive("Ceridian's Intranet") Send("!d") $x = StringFormat("%s", $ret) Send($x & "{ENTER}") FileChangeDir($workingdir) Else MsgBox(0, 'Debug', 'Could not change directory'); debug EndIf RunAsSet() endif An option to troubleshoot could be to run @ComSpec from this script and see what working dir your in and whether "C:\Program Files\Internet Explorer..." is visible by command CD to it.
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