So I want to include a .WAV file in my windows form.
I can get it to load and play, but when I open the application on another computer, there's an error.
I have been linking the .WAV file to a local folder (C:\Windows\Users and so on and so forth until I reach the file)
What changes need to be made so I can put the .WAV file in another place, and can you give some details on how to do so?
Thanks!
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
My.Computer.Audio.Play("C:\Users\RFair_000\Documents\Dropbox\School\Programs\Top Gun\Top Gun\Top Gun.wav")
End Sub
Embed the file then you never have worry. Follow these instructions.playing .wav file with C#
Related
I'm getting the following error:
"The file isn’t compatible with QuickTime Player."
When using this script:
tell application "Finder"
set random_file to some file of entire contents of folder "Movies" of home
open result
end tell
However, I am able to open the file from the finder manually and once I do the script works on just that file. The problem is I have thousands of files and don't want to open each one manually for the script to work again. Have not had this problem with the script in the past.
There are two ways I can think of to approach modifying your script:
Stick with Finder's open command but invoke it fully with its using parameter, which accepts an application file that informs Finder of the application that will be used to open the file. It may sound superfluous given it already tries to open it in QuickTime, and we're not trying to change that, but it's not unwise to see if it does confer a difference in behaviour:
tell application id "com.apple.finder"
tell the folder (path to movies folder) to tell (the ¬
a reference to entire contents) to tell (the ¬
some document file as alias) to set f to it
open f using application file id "com.apple.QuickTimePlayerX"
end tell
Grab the file as you like (really, you ought to be using System Events for this, not Finder, but I'll go with what you had), but then use the open handler of the specific application to open the file:
tell application id "com.apple.finder" to tell the folder (path to movies folder) ¬
to tell (a reference to the entire contents) to tell (some document file) ¬
as alias to set f to it
tell application id "com.apple.QuickTimePlayerX"
activate
open f
end tell
NB. I'm using Monterey, in which both of these two above propositions work appropriately. This doesn't necessarily infer that it will do so in Big Sur, but if they do not, it's worth checking the various app permissions under the different Security & Privacy headings of System Preferences.
In a WPF project this line is very simple to start mspaint with a given filename
Process.Start("mspaint.exe", filename)
While mspaint.exe will work with 'filename' in it's directory, if I try to open other files or do a 'SaveAs', mspaint.exe is looking at the Visual Studio \bin directory where the application was compiled to. Even if I move the .exe elsewhere, it keeps looking at the \bin location.
I tried the following:
Dim process1StartInfo As New ProcessStartInfo
process1StartInfo.WorkingDirectory = "C:\Users\theuser\Pictures"
process1StartInfo.FileName = "mspaint.exe"
process1StartInfo.Arguments = filename
process1StartInfo.UseShellExecute = False
Dim process1 = Process.Start(process1StartInfo)
I thought setting .WorkingDirectory would change the behavior but it does not.
Is it possible to and how do I change the directory that mspaint.exe is looking at when it is launched from within an application? Especially after the application is compiled and moved.
I am using file handles to write my datasets to file in spss, which worked fine the first time.
FILE HANDLE directoryPath /NAME='D:\XX\Dropbox\XX\' .
FILE HANDLE write_data /NAME='directoryPath/dataset_1.sav' .
SAVE OUTFILE='write_data '
Now I get the following error:
>Error # 5332 in column 26. Text: write_data
>The specified file or directory is read-only and cannot be written to. The
>file will not be saved. Save the file with another name or to a different
>location or change the access permissions first.
>Execution of this command stops.
If I specify the full path rather than the file handle:
SAVE OUTFILE='D:\XX\Dropbox\XX\dataset_1.sav'
/COMPRESSED.
It works fine. As you can see, i am writing to a dropbox folder. I am not sure if this interferes with the permissions. Is there anyone that knows how to make my file handle example work by changing overall permissions, or do I need to revert back to changing my syntax manually?
File handles are not cumulative. Only the first portion can be interpreted as a file handle.
I have done some search but nothing same up really.
I have got a visio file, and when I double click and open it up, it open 5 copies of the document in same window and names them as format of filename:1, filename:2 and so on. they seem identical.
any idea Why this happens?
thanks for the help.
Regards
Mesut
All the windows are showing the same file. When this file was saved there were multiple windows open. This workspace is saved with the file. When you reopen the file the same views are opened. To stop this close all but one window and then save the file.
I am trying to batch convert some .doc files to .pdf
I am pretty sure I've got the concept right, I just do not know how to reference the format to change the file format when I "Save As"
set F to choose folder
tell application "Finder"
set P to (files of entire contents of F)
repeat with I from 1 to number of items in P
set this_item to item I of P as alias
tell application "Microsoft Word"
activate
open this_item
save as active document file format format PDF
close window 1
end tell
end repeat
end tell
Thanks
A little google searching would have turned up this...
which is basically the whole script you're trying to write.