I'm making a script where the variable is set to a folder path. I am telling finder to make an alias of the folder, but I'm getting an error.
tell application "Finder"
make alias of art to desktop
end tell
Error: Can’t get alias of "PATH:TO:FILE"
try this one:
set originalFIle to (choose file)
tell application "Finder" to make new alias file to originalFIle at desktop
Related
I am trying to add a path, in PATH variable. I run cmd.exe as administrator and used
setx PATH "%PATH%;C:\MinGW\bin"
setx PATH "%PATH%;C:\MinGW\msys\1.0\bin"
I then restarted my computer, but if I type path I don't see the paths that I set there. Note that with the exact same way I was able to set some other directories on PATH.
Any idea on what might be wrong?
you should use
"My Computer" > "Properties" > "Advanced" > "Environment Variables" > "Path".
setx PATH "%PATH%;C:\MinGW\bin"
setx PATH "%PATH%;C:\MinGW\msys\1.0\bin"
Should first set PATH to "%PATH%;C:\MinGW\bin" and then to "%PATH%;C:\MinGW\msys\1.0\bin", so the second setx overrides the first because setx does not set the variable in the current or existing CMD sessions - only new ones.
setx PATH "%PATH%;C:\MinGW\bin;C:\MinGW\msys\1.0\bin"
theoretically should set PATH with those two directories appended - for future sessions.
You can check by simply starting a new session and executing a
path
command.
If the change doesn't survive a reboot, then some other process is resetting it.
If the change doesn't occur at all, then there's something mighty fishy going on. Possibly a typo...
I'd try setting some other variable as a test, say mypath.
You can delete a variable using
setx mypath ""
Googling for PATH EDITOR may be useful...
i have created a batch file and have added it to the project using add items. Basically what i am aiming at is to execute this file on a button click action.
I am using System.Diagnostics.Process.Start("hello.bat") command to run this file
i have changed the build action to resource for this batch file.
But when i run this program, it is not able to locate the batch file.
I am required to give a relative path as the path my vary from machine to machine. how can i make this file accessable using a relative path?
Resource puts it inside of your EXE as data. You can google how to write a vb.net resource to a file, use the io tempfilename function to get a tempfile and use that (appending .bat), then run the batchfile from the name you gave it.
If you can ship the .bat with your EXE, this is convenient for debugging and production:
* Put the batchfile in the BIN subdir (debug or release) with your exe. May have to click 'show all files' in project explorer to see these dirs. Right click the .bat and pick 'include in project'. Don't make it a resource.
Run it using application.startuppath & "\" & batfilename. (application.startuppath is only in winforms. You can google 'how to get exe path in vb.net console app' etc. if you need another way).
Is it possible to access the user directory "~/" in an Xcode build script phase?
Right now I am trying to directly use "~/" but on compilation it complains the directory doesn't exist. Is there another way to get the user directory (or the name of the user folder)?
I would just use the $HOME environmental variable.
So for the Application Support folder, you would do:
"$HOME/Library/Application Support"
I figured it out I just used this "$HOME/"
How do you register a name for a program in the windows run dialog?
For instance typing in "notepad" and pressing enter runs notpad.exe
"photoshop" in my case runs Photoshop CS3
I'm using vb2005.net
Besides the system path, there's also the App Paths in the registry. Visual Studio, for example, doesn't have its main app (devenv.exe) in the PATH, but you can still launch it from the Run dialog.
Available names are enumerated under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths, with corresponding launch paths as values under each name.
See http://www.tweakxp.com/article36684.aspx for an example of how to add an exe to your App Paths.
This works because those applications have added the directory containing their executable to Window's PATH variable. This variable is used to resolve the locations of any files entered into the run dialog (among other things).
Please see How to set the path in Windows 2000 / Windows XP.
There is no registration, your program .bat, .exe must be within the system path.
If you right-click on "My Computer" ->"Properties"-> "Advanced" then go to the "System Variable". You can edit the "Path" variable to include the location of your executable.
This has nothing to do with "registering" a program. Windows uses the current value of your PATH environment variable, and any executables found in those directories can be executed by simply typing the name into the Windows "Run" box (or command prompt, or anything else that launches executables).
Some programs add their directories to the PATH, others drop an executable (or even a batch file) into a well-known directory that is already part of the PATH, such as the Windows directory.
Add the program's path to your PATH variable.
If you want to do it programmaticly, you can edit (append, not just set) this registry location (in, say, your installer):
HLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path
This AppleScript code gives the name of files that have been dropped onto the script. How do I do the same in an Objective-C app? Would an application written in Objective-C be able to boot the JAR file using the file name as an argument to JAR?
on open of theFiles -- Executed when files are dropped on the script
set fileCount to (get count of items in theFiles)
repeat with thisFile from 1 to fileCount
set theFile to item thisFile of theFiles
set theFileAlias to theFile as alias
tell application "Finder"
set fileInfo to info for theFileAlias
set fileName to name of fileInfo
-- something to this effect, but now that you have the file name,
-- do what you will...
do shell script "cd /Desktop/RunJar/; java -jar " & fileName
end tell
end repeat
end open
We need to replace this AppleScript with a compiled app that can run a JAR that has been dropped onto the compiled app.
To get the path to the JAR file, your app must first implement Drag-and-Drop. See Drag and Drop Programing Topics for Cocoa (or as PDF)
As for actually running the jar:
do shell script "cd /Desktop/RunJar/; java -jar " & fileName
Use NSTask. The difference is that NSTask does not run a shell script; it runs the program (in this case, java) directly. You will need to set the task's working directory before running it.