ShellExecute fails to open VLC although music file exists - wait

I use ShellExecute from Delphi to open VLC media player to play songs.
Sometimes it works and sometimes it fails (For one song it works and for most doesn't).
When it fails it displays a few msgs (for each failure) - notifying that it failed to open the file (which exists for sure!).
Each msg shows a different file name it looks for. For each file that it fails it shows segments of the file name, which of course it not a proper name.
Looks as if it tries to open the file a few times, but each tine the file name is incorrect.
I read through other ShellExecute problems and none helped. But someone answered "Dont forget to wait with the file" (or something like that.)
I use ShellExecute to open youtube and it works fine.
Thanks a lot!!!!
Aviella Angel

Related

Programmatically access files in a device showing up in 'This PC'

I am on Windows 10. I want to write a function (in R) to copy the files stored in a camera (actually in the SD of the camera, but I cannot just read the memory card in the PC), to a different storage unit (say, the pc or an external HDD).
The camera is connected to the PC via an USB cable.
The problem I am facing is that, when opening the File Explorer, the camera is showing up as a link under "This PC" with no letter to indicate the drive (e.g., 'G:/').
While I can see the files using the file explorer window, I cannot find a way to get to those file from a cli type of interface (e.g., the command prompt, or the R console).
Googling, I found that 'This PC' is not a folder but rather a link to something in the registry called CLSID for which the identifier should be {20D04FE0-3AEA-1069-A2D8-08002B30309D}. However this is very confusing to me and I cannot figure out how to use this information.
Is there a way to do it? And if so: how?
Please consider I do not know much of commands from prompt (way better off in R).
A CLSID is just a GUID. My computer is a implementation of IShellFolder.
My Computer is part of the shell namespace. Several entries in the shell namespace are virtual (Control panel, scheduled tasks etc.) and cannot be accessed with low-level file functions nor cmd.exe.
While it would be possible to develop a tool that does something like shellcopy Computer\MyCamera\*.jpg x:\backup, I'm not aware of any existing tools that do this. You might have to code it yourself.
In the old days you would call SHGetDesktopFolder to get the root and then use the returned IShellFolder to navigate but these days it is simpler to use IShellItem instead.
To do this it is crucial to understand how IShellFolder and PIDLs work. See Introduction to the Shell Namespace for more information...

Unix - Tail Utility would open the file or not

Can anybody help me to sort this out.
What is the logic of Tail -f utility in Unix.
Is it open the log file to check the updated content or is there any other way to get this information. All the implimentation of Tail utility says that it will open the fileenter link description here
As per the source code of tail utility, it is opening the file in read mode not in write mode.
So the answer is, I would say TAIL is opening the file for checks. But along with that i would like to answer one more question, since it is opening in read mode the other process that tries to open the same file will not face any issues.

How to import audio into R on a mac?

I have recently changed from a PC to a mac, and have trouble trying to input my recorded audio into R.
On the PC the audio needed to be in 'My Documents' for the tuneR package to find my audio using:
readWave('audio.wav')
However I am having trouble finding the right directory that the audio needs to be on the mac for R to find it.
So far I have my audio file copied into every folder, but still no luck.
The audio can be in whatever directory you like, you just have to tell R exactly where it is. Try writing out the full path to the file, e.g. readWave('/Users/EmmaL/audiofiles/audio.wav'). To find out the path, look up the file in Finder, right click, select Get Info, and check out General -> Where:

XCode open file at error line for custom build script

I Apologize if this question has already been asked. i can't seem to find it anywhere if it has.
I have a custom build script use to syntax check some php files and upload them to a server, and this is executed as a part of the build process. since this script is used to parse inline php statements (embedded in objective c blocks using macros) it's fairly critical this script happens on each build. the actual execution is working fine, i'd just also like to be able to open a particular file when there is an error, and locate the cursor in the approximate location.
i have found that since xcode is configured on my system to open .php files by default (not sure if that's the norm or if i did it manually at some point), using
open filename.php
in a shell script opens the file.
i'd like to be able to specify the line number too.
eg something along the lines of
open filename.php --args --jump-to-line 1234
(--args is a switch for "open" meaning pass the arguments on to Xcode)
any ideas?
You can use the xed command. Only works for Xcode 3 though, not other editors. For Xcode 4, try this
See man xed

open with default editor and wait to be closed

we're developing an app that should be able to open specified file with default editor application. (so if it is .doc - it suppose to be opened by MSWord or openOffice)
But I also need to wait until user will close the editor, check if it was changed (by size and date), and upload it to the server.
So the following steps:
1) find def editor
2) open file
3) wait it be closed
4) do smth after that with the file.
now results of my research:
-> opening by def editor is simple: file.openWithDefaultApplication();
but there is no way to know that editor is closed (maybe by checking that file is not locked in timer???)
-> i can start the native process and pass file as parameter BUT looks like the code
NativeApplication.nativeApplication.getDefaultApplication(file.extension);
does not work for any extension :( - it doesnt work for "rtf", "doc" but works for "pdf"... and [file.openWithDefaultApplication()] works fine with any file!
any suggestions?
thx in advance!
but there is no way to know that
editor is closed
Correct. I do not believe what you want to do is possible with AIR. How would AIR be able to tell whether the file is open or not? You might want to look into using NativeProcess; but that would be reliant on the underlying OS/default program exposing APIs to let you know when the program was open and/or closed.
My only suggestion is that you don't have the Air application watch the file, but instead show a popup that say 'click okay when done editing file' and then upload it based on that.
The only other way I can think of this working is if you create both a .bat and a .sh file
(for both windows and macs/linux; select one or the other depending on the os) which open the file you want through NativeProcess (and of course, put 'wait') and then listen for the close event.

Resources