HockeyFan Posted January 11, 2007 Share Posted January 11, 2007 Can someone help me with why I get an error message when I try to run an EXE from a mapped drive location? The drive mapping is successful, and I've even successfully tested to see if the file exists...but when I attempt to run it, I get the following error message: : ==> Unable to execute the external program. Here is the code: $username = 'Useranme' $password = '***********' ;$domain = 'domain' $server = '\\172.29.10.29\ldlogon' ;Check to see what drive letter is availavle. $drive = StringSplit("c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",", 1) For $i = 1 To $drive[0] Step + 1 $var = DriveStatus($drive[$i] & ":") If $var = "INVALID" Then ;MsgBox(1,"Free:","The first free letter: " & $drive[$i]) $AvailDrive = $drive[$i] & ":" ;MsgBox(0,""," Available drive is: " & $AvailDrive) EndIf Next ;DriveMapAdd($AvailDrive, $server, 0, $username, $password) ;MsgBox(0, "Drive X: is mapped to", DriveMapGet($AvailDrive)) If FileExists($AvailDrive & "\HATScanner.exe") Then MsgBox(4096, "", "HATScanner exists.") Else MsgBox(4096,"", "HATScanner does not exist.") EndIf Run($AvailDrive & "\HATScanner.exe", $AvailDrive & ":\") PLEASE HELP!! Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 Even if I assign a drive letter, it still doesn't work! DriveMapDel("W:") DriveMapAdd("W:", $server, 0, $username, $password) If FileExists("W:\HATScanner.exe") Then MsgBox(4096, "", "HATScanner exists.") Else MsgBox(4096,"", "HATScanner does not exist.") EndIf Run("HATScanner.exe", "W:\") : ==> Unable to execute the external program. Link to comment Share on other sites More sharing options...
Joon Posted January 11, 2007 Share Posted January 11, 2007 Permission problem??? Can you run it manually? Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 Permission problem???Can you run it manually?AHHH!!! I think I see the problem now. :"> I was testing this on a test machine and it was running fine manually, but today I am running it from a different machine. Running manually on this machine, I am prompted with a "Open file - Security Warning" message...but YES it does run. Could this be the reason it's not working? Why doesn't the warning message come up when I run it from the script?? Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 oooops!!!! I forgot that when we were running it on the test machine we were using a "net use" command in the script instead of the DriveMapAdd. It doesn't prompt you with the "Security Waring" message when run from the command line. Any ideas on how to get around the security warning message...if that in deed is the problem?? Link to comment Share on other sites More sharing options...
Joon Posted January 11, 2007 Share Posted January 11, 2007 (edited) From what I read, Security Warning won't appears if you run from DOS Shell... Run(@ComSpec & ' /c HATScanner.exe', 'W:\') Edited January 11, 2007 by Joon Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 From what I read, Security Warning won't appears if you run from DOS Shell... Run(@ComSpec & ' /c HATScanner.exe', 'W:\')oÝ÷ Ûú®¢×¢Å¢¼!jׯzºÞjÊ'¶¬Ë-Yg¢Ü(®H§ú+â!j÷½éæj{²È çmçk÷¦jbhßÕ·õ©Ý!Ƨ`zÛaz趦¶î«¢+Ø(ÀÌØíÕÍɹµôÌäíUÍɹµÌäì(ÀÌØíÁÍÍݽÉôÌä쨨¨¨¨¨¨¨¨¨¨Ìäì(ìÀÌØí½µ¥¸ôÌäí½µ¥¸Ìäì(ÀÌØíÍÉÙÈôÌäìÀäÈìÀäÈìÄÜȸÈä¸ÄÀ¸ÈäÀäÈí±±½½¸Ìäì(í ¡¬Ñ¼ÍÝ¡ÐÉ¥Ù±ÑÑÈ¥ÌÙ¥±Ù±¸(ÀÌØíÉ¥ÙôMÑÉ¥¹MÁ±¥Ð ÅÕ½Ðí±±±±± ±¤±¨±¬±°±´±¸±¼±À±Ä±È±Ì±Ð±Ô±Ø±Ü±à±ä±èÅÕ½Ðì°ÅÕ½Ðì°ÅÕ½Ðì°Ä¤()½ÈÀÌØí¤ôÄQ¼ÀÌØíÉ¥ÙlÁtMÑÀ¬Ä(ÀÌØíÙÈôÉ¥ÙMÑÑÕÌ ÀÌØíÉ¥ÙlÀÌØí¥tµÀìÅÕ½ÐìèÅÕ½Ðì¤)%ÀÌØíÙÈôÅÕ½Ðí%9Y1%ÅÕ½ÐìQ¡¸(í5Í ½à Ä°ÅÕ½ÐíÉèÅÕ½Ðì°ÅÕ½ÐíQ¡¥ÉÍÐɱÑÑÈèÅÕ½ÐìµÀìÀÌØíÉ¥ÙlÀÌØí¥t¤(ÀÌØíÙ¥±É¥ÙôÀÌØíÉ¥ÙlÀÌØí¥tµÀìÅÕ½ÐìèÅÕ½Ðì(í5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÙ¥±±É¥Ù¥ÌèÅÕ½ÐìµÀìÀÌØíÙ¥±É¥Ù¤)¹%)9áÐ($)É¥Ù5Á° ÅÕ½ÐíèÅÕ½Ðì¤)M±À ÄÀÀÀ¤)É¥Ù5Á ÅÕ½ÐíèÅÕ½Ðì°ÀÌØíÍÉÙÈ°À°ÀÌØíÕÍɹµ°ÀÌØíÁÍÍݽɤ)IÕ¸¡ ½µMÁµÀìÌäì½!QM¹¹È¹áÌäì°ÌäíèÀäÈìÌäì¤( Link to comment Share on other sites More sharing options...
Joon Posted January 11, 2007 Share Posted January 11, 2007 See if you get Security Warning if you run it from DOS Prompt. Link to comment Share on other sites More sharing options...
nitekram Posted January 11, 2007 Share Posted January 11, 2007 Joon, For what ever reason, this is still not working for me. I have even manually assigned the drive mapping to 'W' and I cannot get the program to run. $username = 'Useranme' $password = '***********' ;$domain = 'domain' $server = '\\172.29.10.29\ldlogon' ;Check to see what drive letter is availavle. $drive = StringSplit("c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",", 1) For $i = 1 To $drive[0] Step + 1 $var = DriveStatus($drive[$i] & ":") If $var = "INVALID" Then ;MsgBox(1,"Free:","The first free letter: " & $drive[$i]) $AvailDrive = $drive[$i] & ":" ;MsgBox(0,""," Available drive is: " & $AvailDrive) EndIf Next DriveMapDel("W:") Sleep(1000) DriveMapAdd("W:", $server, 0, $username, $password) Run(@ComSpec & ' /c HATScanner.exe', 'W:\') RunAsSet() ? Have you tried it? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 Nope...Security Warning does not come up when run from a DOS prompt. Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 RunAsSet() ? Have you tried it?Yes...RunAsSet() is used at the very beginning of the script...(not shown in provided example)...to run the program with elevated rights, same credentials used with $username & $password. Link to comment Share on other sites More sharing options...
Joon Posted January 11, 2007 Share Posted January 11, 2007 Well... not sure what's going for you. Try this DriveMapDel("W:") Sleep(1000) DriveMapAdd("W:", $server, 0, $username, $password) EnvSet("SEE_MASK_NOZONECHECKS", "1") RunWait("W:\HATScanner.exe") Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 Well... not sure what's going for you. Try this DriveMapDel("W:") Sleep(1000) DriveMapAdd("W:", $server, 0, $username, $password) EnvSet("SEE_MASK_NOZONECHECKS", "1") RunWait("W:\HATScanner.exe") Sorry That did nothing. Link to comment Share on other sites More sharing options...
HockeyFan Posted January 11, 2007 Author Share Posted January 11, 2007 OK... I've even done this: DriveMapDel("W:") Sleep(1000) DriveMapAdd("W:", $server, 0, $username, $password) Run(@ComSpec & " /c " & 'cmd.exe', "", @SW_MAXIMIZE) Sleep(1000) Send("cd ") Send("C:\") Send("{ENTER}") Send("W:\") Send("{ENTER}") Send("HATScanner.exe") Send("{ENTER}") Send("EXIT") ;Send("{ENTER}") ...and still nothing. All I get is the error message on the command window "The system could not find the file specified". This may be a silly question, but why can't the command window see or recognize the newly added drive mapping?? When I run a command window and type everything manually, it works without a hitch. Why is there a promblem when I script it this way???? Link to comment Share on other sites More sharing options...
Joon Posted January 11, 2007 Share Posted January 11, 2007 Sorry That did nothing.Not even a security warning? Link to comment Share on other sites More sharing options...
nitekram Posted January 12, 2007 Share Posted January 12, 2007 Not even a security warning?How about trying to write a file to the location where the program resides and see if you can then open the file and read the contents. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
HockeyFan Posted January 12, 2007 Author Share Posted January 12, 2007 Not even a security warning?Nope...nothing at all!! Link to comment Share on other sites More sharing options...
HockeyFan Posted January 12, 2007 Author Share Posted January 12, 2007 How about trying to write a file to the location where the program resides and see if you can then open the file and read the contents. Yes...I am able to write to that location! DriveMapDel("W:") Sleep(1000) DriveMapAdd("W:", $server, 0, $username, $password) $TestFile = FileOpen("W:\TestFile.txt", 9) FileWrite($TestFile, "This is a test to see if I can write to a file on Drive Map W:") FileClose($TestFile) Link to comment Share on other sites More sharing options...
Joon Posted January 12, 2007 Share Posted January 12, 2007 (edited) It could be problem with your program. Copy some other program on mapped drive and test... something like notepad.exe or calc.exe Edited January 12, 2007 by Joon Link to comment Share on other sites More sharing options...
HockeyFan Posted January 12, 2007 Author Share Posted January 12, 2007 It could be problem with your program. Copy some other program on mapped drive and test... something like notepad.exe or calc.exe Same result...different file. I copied "notepad.exe" to the folder location and run it from the script. If I manually run it from the mapped drive location, I get the Security Warning. If I run it from the script...nothing happens. If I run it from a DOS prompt, it runs without any problem. DriveMapDel("W:") Sleep(1000) DriveMapAdd("W:", $server, 0, $username, $password) ;RunWait("W:\HATScanner.exe") RunWait("W:\notepad.exe") 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