PDowning Posted June 27, 2013 Posted June 27, 2013 Shouldn't this just work? Run("wmplayer.exe 'I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u'") I've been coding things all day and the simplest of scripts is eluding me. Why? I'm not sure. I also tried: ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") That also does not work. Yes, the file exists. Yes, permissions are correct. Yes I can navigate to the file and double-click to run and it opens media player.
bogQ Posted June 27, 2013 Posted June 27, 2013 >#5 TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
PDowning Posted June 27, 2013 Author Posted June 27, 2013 Thanks for the link, but damned if it won't work. I even shortened it to : ShellExecute("C:Program FilesWindows Media Playerwmplayer.exe") It just refuses to open. Thanks again. I'll dive back into this Monday. It's time for the weekend.
guinness Posted June 28, 2013 Posted June 28, 2013 Did you try Run? Does the path exist? What version of AutoIt are you using? Your system? e.g. 64-bit? 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
MHz Posted June 28, 2013 Posted June 28, 2013 A CMD prompt is quite verbal so it can help to troubleshoot a path issue. Try your attempt at wmplayer.exe C:\>wmplayer.exe 'wmplayer.exe' is not recognized as an internal or external command, operable program or batch file. Lets try C:Program FilesWindows Media Playerwmplayer.exe C:\>C:\Program Files\Windows Media Player\wmplayer.exe 'C:\Program' is not recognized as an internal or external command, operable program or batch file. 1st attempt is that Windows does not know where wmplayer.exe is. It is not in the current directory or in the PATH variable. 2nd attempt is 3 parameters as whitespace is known as a parameter terminator and is thus a delimiter for parameters. You may see C:\Program Files\Windows Media Player\wmplayer.exe Windows may see up to 4 separate parameters C:\Program Files\Windows Media Player\wmplayer.exe Using quotes can be vital to success. The use of possible quotes in the 1st parameter of Run() and the 1st 2 parameters of ShellExecute() can be of concern with possibly needing quotes. Give this example a try which may help to show the quote issue with the 1st parameter of Run #include <WinAPI.au3> _Run('wmplayer.exe') _Run("C:\Program Files\Windows Media Player\wmplayer.exe") _Run('"C:\Program Files\Windows Media Player\wmplayer.exe"') Func _Run($parameter) Local $expect_failure, $last_error_msg, $pid ; Check if unquoted string which has whitespace $expect_failure = 'No' ; check if string is not quoted If Not StringRegExp($parameter, '[''"]') Then ; check if string has whitespace If StringReplace($parameter, ' ', '') And @extended Then $expect_failure = 'Perhaps as ' & $parameter & ' is whitespace delimited ' & _ 'so it could be considered as ' & @extended + 1 & ' parameters' ElseIf Not FileExists($parameter) Then $expect_failure = 'Perhaps as ' & $parameter & ' does not exist in current path' EndIf EndIf ; run the command $pid = Run($parameter) ; get last error message $last_error_msg = _WinAPI_GetLastErrorMessage() ; wait for process to be closed ProcessWaitClose($pid) ; show the result MsgBox(0x40000, 'Result', _ '$parameter:' & @CRLF & _ $parameter & @CRLF & @CRLF & _ '$expect_failure:' & @CRLF & _ $expect_failure & @CRLF & @CRLF & _ '$last_error_msg:' & @CRLF & _ $last_error_msg _ ) EndFunc Expect the last Run function to succeed as it has double quotes around the path which has whitespace in it.
PDowning Posted July 1, 2013 Author Posted July 1, 2013 Ok that tidbit of code works just fine. But if I try to duplicate that, it just sits there, never running wmplayer. Someone asked previously about other factors. Did you try Run? Does the path exist? What version of AutoIt are you using? Your system? e.g. 64-bit? Run? Yes I tried, won't open wmplayer. Path Exist? Yep. Works perfectly fine any other time. AutoIt version) SciTE Version 3.3.0 & AutoIt v3.3.8.1 System) Win7 Pro 32-bit if I open a command window, and navigate to the root c:, and use "c:program fileswindows media playerwmplayer.exe", it runs. If I navigate to the directory where the .m3u resides,I:TreasuresTreasures Listening LibrarySupplemental Readers>, and type "Grade 1.m3u" and hit enter, wmplayer pops up and begins to play the file. That's why I tried a ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") and it still won't open. The console window that shows the script functioning says "Exit Code: 1 Time 0.409" so it's doing something, just NOT opening the damn wmplayer
PDowning Posted July 1, 2013 Author Posted July 1, 2013 (edited) Now I had the thought of trying to force a path to wmplayer using _PathMake(). I can assign all the parameters, and msgbox() it, but it still refuses to run. ARRRGGGHHHH!!!!! ETA: WTF?!?!? It just started working for no good reason. Using only ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") What the hell changed? to be sure I even rebooted the machine and it still works. Edited July 1, 2013 by PDowning
jacQues Posted July 1, 2013 Posted July 1, 2013 Now I had the thought of trying to force a path to wmplayer using _PathMake(). I can assign all the parameters, and msgbox() it, but it still refuses to run. ARRRGGGHHHH!!!!! Copy and rename a working MP3 file to X:Test.mp3. Here, X: is the drive letter (J:, K etc.) of an USB stick formatted in either FAT32 or exFAT. From a DOS prompt, type the following: X: start Test.mp3 If the assigned music player doesn't starts, then it won't from AutoIt either. Fix this via your music player (file extension associations). Assuming this works, we can try the same via an AutoIt script: ShellExecute("X:Test.mp3") I bet this will work for you. If not, then your antivirus software is keeping AutoIt in a sandbox or something. In such cases, it could even be that a compiled script works whereas an .AU3 doesn't, or the other way around. In any case, add AutoIt3.exe and/or your compiled .exe file to the trused file list. If everything works like expected, move the file to "C:Test.mp3" and then try: ShellExecute("C:Test.mp3") If if works, then it seems that there's no problem and you probably made a typo in your script. If this doesn't work, you now know that the problem is somehow NTFS-related.
Blue_Drache Posted July 1, 2013 Posted July 1, 2013 ETA: WTF?!?!? It just started working for no good reason. Using only ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") What the hell changed? to be sure I even rebooted the machine and it still works. Computers are ... in essence ... female. They do what they bloody well please. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
MHz Posted July 3, 2013 Posted July 3, 2013 I am late on my reply on this but I was hoping that my last post explained the issue. It is about how to use quotes. If you can not get it to work on the command line then you may have little hope with Run() or ShellExecute(). And the comment about If computers are female, then perhaps they just need caressing. I like computers and females so the comment may be true . Whitespace terminates a parameter. So ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") can fail as the execution may see I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u as 5 parameters. To make it show as 1 parameter then you may need to include quotes to tell the system to handle it as one parameter. Example: ShellExecute('"I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u"') may see "I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u" The single quotes wrap the double quotes so the double quotes remain as part of the string. Thus it is treated as one parameter. Example of a command line using Run() Run('"path\to\program.exe" "parameter 1" "parameter 2" "parameter 3"') would see "path\to\program.exe" "parameter 1" "parameter 2" "parameter 3" The use of quotes ensures that whitespace within the quotes are treated as part of the parameter and whitespace outside of the quotes is treated as the terminator of the parameters. If you have no whitespace in any of the parameters the quotes are optional with those parameters.
PDowning Posted July 8, 2013 Author Posted July 8, 2013 Computers are ... in essence ... female. They do what they bloody well please. That is one thing that I do believe completely about PC's ...
PDowning Posted July 8, 2013 Author Posted July 8, 2013 I am late on my reply on this but I was hoping that my last post explained the issue. It is about how to use quotes. If you can not get it to work on the command line then you may have little hope with Run() or ShellExecute(). And the comment about If computers are female, then perhaps they just need caressing. I like computers and females so the comment may be true . Whitespace terminates a parameter. So ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") can fail as the execution may see I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u as 5 parameters. To make it show as 1 parameter then you may need to include quotes to tell the system to handle it as one parameter. Example: ShellExecute('"I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u"') may see "I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u" The single quotes wrap the double quotes so the double quotes remain as part of the string. Thus it is treated as one parameter. Example of a command line using Run() Run('"path\to\program.exe" "parameter 1" "parameter 2" "parameter 3"') would see "path\to\program.exe" "parameter 1" "parameter 2" "parameter 3" The use of quotes ensures that whitespace within the quotes are treated as part of the parameter and whitespace outside of the quotes is treated as the terminator of the parameters. If you have no whitespace in any of the parameters the quotes are optional with those parameters. I am late on my reply on this but I was hoping that my last post explained the issue. It is about how to use quotes. If you can not get it to work on the command line then you may have little hope with Run() or ShellExecute(). And the comment about If computers are female, then perhaps they just need caressing. I like computers and females so the comment may be true . Whitespace terminates a parameter. So ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") can fail as the execution may see I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u as 5 parameters. To make it show as 1 parameter then you may need to include quotes to tell the system to handle it as one parameter. Example: ShellExecute('"I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u"') may see "I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u" The single quotes wrap the double quotes so the double quotes remain as part of the string. Thus it is treated as one parameter. Example of a command line using Run() Run('"path\to\program.exe" "parameter 1" "parameter 2" "parameter 3"') would see "path\to\program.exe" "parameter 1" "parameter 2" "parameter 3" The use of quotes ensures that whitespace within the quotes are treated as part of the parameter and whitespace outside of the quotes is treated as the terminator of the parameters. If you have no whitespace in any of the parameters the quotes are optional with those parameters. The thing is, there are only double quotes on that line. No single quotes at all. Oh well, it's working.
Shaggi Posted July 8, 2013 Posted July 8, 2013 Run("wmplayer.exe 'I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u'") I don't think Windows recognizes ' as an alias to " the same way as autoit does it. Do like this: Run('wmplayer.exe "I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u"') Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG
Solution PDowning Posted July 8, 2013 Author Solution Posted July 8, 2013 For some unknown reason, this ShellExecute("I:\Treasures\Treasures Listening Library\Supplemental Readers\Grade 1.m3u") started working. Oh well, not gonna mess with it anymore. It works, leave it alone. Always been my motto
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