Using "Open with" on windows applications - windows

Let's say I'm making my own programming language, and it has its own scripting file extension.
Then the user, let's say, drags their script file of whatever program they made onto the .exe of the programming language
How, programmatically, could the programming language figure out how to use the fact that they "opened the script" by dragging it on the .exe, as a means to run the script?

Related

Batch to Bash/Shell Script Converter

I have recently purchased a Mac and have found out that it does not have any support for Batch (.bat) files at all. All I want is a website that will convert a Batch file program, to a Bash file program so I don't have to learn a whole new programming language, since I am so used to the Batch programming. Is there an online converter or possibly an app/program that could be found on a website or on the Mac App Store. If so, could you please tell me the name of the program, where I can find it, and a link to it. Thanks!
There is no possible way to do this. Why? Because not only are both the source and destination languages Turing complete, both are hideous piles of accumulated hacks from decades upon decades of maintenance programmers. And not only that, let's say you map all the syntax from Windows Batch to Bash (careful: version 3.2 only, Mac doesn't have newer!). Then what will you do when the original script invokes an external program? Will you know to map Windows Movie Maker to iMovie? Microsoft Office to iWork? Internet Explorer to Safari?
What about the fact that the two different systems have different rules about what constitutes a valid filename? If the source script mentions C:\Windows, what does that mean on a Mac?
There is a never ending amount of work required to do what you're asking. Perhaps you can narrow the scope (a lot).
This website here claims to have a way to manually do it. But, i do not have any Mac OS X computers to test if its true. Wish i could be more help.

Run bash files in Cocoa Applescript (ApplScriptObjC) (Xcode)

I'm trying to make a program consisting of an AppleScript interfacing with bash files (so that I get the fancy Cocoa GUI). I assume this is a simple task, because one of the file types in the new file-menu (cmd+n) is shell scripts (.sh).
I've done a few half-assed tries to get it working (do shell script "sh file.sh"), but I can't figure out how to run those files.
Are there any gurus out there who can help me? :3
If anything is unclear, feel free to ask questions.
If you just want to launch shell scripts from the Cocoa gui, you don't need the AppleScriptObjC bridge, make a Cocoa program in Objective-C and use the NSTask class: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTask_Class/Reference/Reference.html.

How does software (either compiled or interpreted) reach the end user? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
An executable Python app
So I have taken a little online python course and I now have an understanding of simple programming. We made our own scrabble game, for example. However what i dont understand is how these .py .c .class or whatever get to an exe form?
I never as an end user have to open .py files ever, with windows it is always .exe, but how are these made? Are they batch files that merely execute the file? But what about dlls?
I guess my question is in any language how is the finished code executed on the machine. When i run a java program i dont have to fiddle with class files i just click an exe.
EDIT......
What i mean isnt how to make python an exe, but how does software get to thatstage full stop. I know interpreted languages go to the interpreter, i guess you use an intermediate language to make an exe which runs the code.
Generally the code would be compiled into an executable, which may or may not internally contain everything it needs to run. (If it doesn't, then it could come packaged in an installer which distributes what it needs.)
Specific to Python, a quick Google search turned up this. For interpreted languages, since there is really no "compile" step, you'd need some tool to "convert [language] to windows exe" to accomplish what you're asking.
Most software you run on Windows is not written in an interpreted language like Python, and comes with an installer ('setup.exe') which was generated by some software that creates installers for your code. The purpose of the installer is to both install your program and all the files it may depend on that you have installed as a developer but your end users don't.
See these related questions:
How can I create a directly-executable cross-platform GUI app using Python?
py2exe - generate single executable file
very simply and speaking generically, you would either compile or interpret you source code. An exe or dll would be the result of compilation (JITs as another item to learn about).
You should also learn about "server side" and "client side" code. A web based application would run server side code which may generate html (and perhaps javascript) and send that down to the client side browser.
There are many ways to deploy exe's, dlls etc - simply copy them to the target machine, or use an installer or via a browser plug in environment.
When you use a compiled language that generates native code, the compiler is responsible to generate an executable file based on your source code.
If the language is interpreted, running the program usually means launching the interpreter and passing it the main file of the program. Some languages offer tools to package the interpreter and the sources into an executable.
If the language is compiled but generates intermediate code, you need to run the virtual machine, like an interpreted language. However, if you use .NET on Windows, the compiler generates an executable that loads the virtual machine automatically.

Setting the screen position of a program

How do I set the position of a third party program,using vbscript,to always display at a specific position on the screen?
VBScript and Windows Script Host don't have this functionality out of the box, so the short answer is "You can't".
The long answer is: If you really need to do this, you can use a third-party tool for this purpose, such as AutoIt. You could also write a custom utility (in C++, C# with PInvoke etc) that will utilize the appropriate Windows API functions (FindWindow, SetWindowPos etc) and call it from your script.
I don't think it will be possible using VBScript. As Helen mentioned, it could be done with AutoIt or in C++, C#, etc.
Using AutoIt, you could either write a script that always ran, and checked to see if the Window of the third party app exists, and then move it to the location you desire... Or better, create a launcher script to start the third party application and place it at the exact location. If you can't install AutoIt on all the pc's this will be running on, you can also compile the script to a stand alone exe.

quick way to scripting or creating programs on Windows?

what's a good way to scripting or creating programs unders windows?
How about python?
You will need Notepad, and to learn JScript (not Javascript... JScript), VBScript or Batch. Then you can easily create small scripts, somewhat equivalent to bash shell scripts on Linux.
For the first two, you can read the Windows Script Host documentation.
Windows Powershell is becoming the new Windows scripting language. Being a full .NET language, it is inevitably much more powerful that the horrible old batch scripts one used to have to write (and still retains much of the syntactic sugar of scripting/shell languages).
You can do VBScript without the need to install anything.
Open notepad and enter the following text:
MsgBox "Hello"
Save it as filename.vbs
Double click the file you just created, congratulations - you just created and ran a VBScript.
I'd like to plug AutoIt. It's a free download and comes with it's own editor that can be quickly/easily installed anywhere. The language is very rich and comes with a large library of user defined functions. Integrated context-sensitive help with syntax display. There's even a GUI editor. A final plus is that it compiles to .exe so will run on any win2k/xp/vista/2k3/2k8/7 PC.
I always use Python for scripting on Windows.
A vague question usually gets a vague response.
Download a compiler or interpreter and find a tutorial.
With more information we can better point you in the right direction
I would say there are three clever choices here:
Scripting: Use JSCRIPT because much of what you learn about JSCRIPT can be used in Javascript. You can either graduate to Javascript/AJAX in the browser, or Microsoft .HTA apps.
Or, you could use Python because it has standard modules to do just about anything a sysadmin would do plus addons to access Windows .COM objects and WMI. You can then either graduate to Python on a UNIX platform, Jython (which is Python in the JVM) or IronPython which opens up the entire world of .NET for you.
And there is of course, the non-scripting choice which is about creating programs under Windows. If you choose this you probably have an end-game in mind that is beyond scripting, so start with SharpDevelop and IronPython. Then, as you gain confidence, start working with C# still using the same Sharpdevelop toolset. With this choice you can also graduate to UNIX applications using the MONO .NET environment although if you want to do GUI apps on UNIX you will need to use GTK# instead of Windows Forms.

Resources