Edit an applescript file from a linux computer [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Though applescript appears to be a scripting language like any other (wikipedia/applescript), for reasons I don't understand it seems these scripts are often saved as binaries. It seems like this isn't an issue for someone working on a Mac with a mac-based text editor that can open these scripts into a plain-text format where they can be edited and read, but for the rest of us, we just see gibberish. For instance, Github has many examples of .scpt files committed to repositories instead of/without the plain-text equivalent (a bit of Googling suggests this would be a .applescript file instead)
Question: Is there an open-source tool that can parse and serialize these binaries so that they can be viewed/edited in a standard plain text editor and saved back as .scpt?
(My context: I'd like to provide a user-friendly, os native button-click way to launch my application on a mac, rather than tell users to open a bash terminal and type stuff.)
Edit I only have access to a linux machine, I don't own a mac.

Instead of trying to create an AppleScript on a non-Mac, what you can do is simply name your shell script file with a .command suffix and make sure that it has execute POSIX permissions for the user. The user can then double-click the file in the Finder to execute your script instead of having to enter Terminal commands.
If you would like to take advantage of AppleScript commands within your shell script file to add some simple GUI functionality, you can use the osascript command.
BTW, for reference: on a Mac the application "Script Editor" (or "AppleScript Editor" on older systems) is generally used to create AppleScripts. It provides several save options - the .scpt binary and .applescript plain text files you noted as well as .scptd script bundles and .app standard, double-clickable applications.

Related

Overwriting "Print Screen" actions in linux without administrative rights [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Disclaimer:
I am a bit of a Linux noob :(
Problem:
I have an interesting problem that I could use some help with. Essentially, I want to overwrite the default actions for the "Print Screen" button in Linux. My reasons for doing so are that I have a homemade graphics card running attached to the computer and I'm trying to make a utility where I can capture what it is outputting to a separate monitor and send it back to the "host" computer. For purposes here, I only want to know: How can I execute a script upon pressing the Print Screen button? Note that I cannot install xbindkeys or any other software. Ideally I would like to be able to run a script to enable this behavior.
Current work-around:
Currently, I have a .bashrc script:
#!/bin/bash
export PATH=/home/username/bin:$PATH
In the /home/username/bin folder I have a script "gnome-screenshot" that, for now, just performs some arbitrary task (it actually does this: "cat /usr/share/icons// > /dev/dsp" -- try it! It's fun!).
I am working on school computers, so I first CTRL-ALT-F5 to open a terminal login, login, then source .bashrc. I then startx -- :1 to start a new X session. Now, if I hit the PrintScreen button, it uses my gnome-screenshot, not the default screencapture program.
Is there anyway to do this without all of the restarting X? In short, is there a way to source my .bashrc script, or otherwise modify my PATH variable, before or while I login?
Another Approach:
I also tried, briefly, to xmodmap and the keycode to execute a script, but couldn't figure out how to tie them together. I know the keycode (111) but can't figure out how to run a script on press. I believe it might be possible to make a sort of binding using this but can't figure out how.
Help!
I'd really appreciate some help or comments!
(Edit): Added Details About Distribution:
cat /etc/redhat-release tells me:
Red Hat Enterprise Linux Client release 5.8 (Tikanga)
xmodmap is not the tool you want; it cannot bind keys to programs, it binds physical keycodes to logical keysyms. XGrabKey(3) is what you're looking for.
Reading your shell dotfiles while starting the X session depends on the exact OS and desktop environment you're using (including version; there are 4 or 5 different ways you might need to use even considering only different Ubuntu versions with their stock desktops).

editor in Cygwin [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I had just installed cygwin on my win XP machine, new to unix & learning things...
How can I know which editor had been installed with cygwin installation on my system? none of the editors out of vi, vim, nano, ted, jow etc working...tried using 'notepad' but it saves the file as .txt ....
Also another confusion which I have is, even the files which I have created without shebang line as well as without .sh extension , I am able to execute them when given permission to do so...how can a script be run when I have not added shebang line in that?
I had trouble with this and a few other things in Cygwin. Vim, Emacs, (and many other standard Unix programs) are not installed by default in Cygwin.
You need to run the setup program again (no need to uninstall first), and explicitly add what you want.
I wrote a blog post about this: http://wilsonericn.wordpress.com/2011/08/15/cygwin-setup-gotchas/
The shebang line is not needed if your $SHELL can interpret the script. i.e., if you write a bash script and invoke it through bash, you don't need the shebang line.
To know which editors are installed, run the cygwin setup.exe file again and go through the package list (under the group editors), you may pick additional editors to install too.
If you have other scripts, you should be able to launch most scripts without sheband line in this way:
bash script.sh
tcsh script.csh
python script.py
perl script.pl
etc...
By the way, if you are new to unix, I recommend you get used to an advanced text editor.
I don't want to troll, but using XEmacs or Vim could help you a lot (syntax highlighting, snippet usage for ex.). I have been using Vim for years now, and I would probably not be able to go back to a basic editor...
If you have the disk space I recommend just letting the Cygwin installer have at it and deploy everything .... I am glancing at it every now and then while watching the F1 race. I use a 750GB hybrid flash / spinning disc drive so storage isn't an issue. It is much like the old Red Hat "Kitchen Sink" option with the DVD9 format.
It would be helpful if the Cygwin installer would show the fact it intends to install only 50/2100 packages by default, or if there was a wizard with some useful premix choices (minimal, server, GUI, everything)

Is there an easy way to View, Edit & Locally store a .txt file through Chrome [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
This isn't necessarily a coding problem, but users here would be the perfect people to ask.
Is there an easy way to view and edit a simple text file (.txt seems the most obvious) on a browser (I use Chrome). I'd like this file to be stored locally as well, preferably in my dropbox folder so it's backed-up at all times.
I tried looking for a chrome extension that does this, but after 3 failed attempts I thought there might be a manual way to do this.
I don't care about the format as long as it's common and can be opened on other computers if need be.
Paste the following into your browser address field to get a ready browser notepad:
data:text/html, <html contenteditable>
You can type or paste your text here, edit and then save as page or copy somewhere. Suggested by Jose in his blog.
HTML5 has a File API: http://www.html5rocks.com/tutorials/file/filesystem/
Once you read that you will realize that you can use a blob builder to write to a file, then post that file back to your browser which will automatically download it.
var bb = new BlobBuilder();
bb.append(message.value);
var blob = bb.getBlob();
location.href = window.webkitURL.createObjectURL(blob);
This is an old question, but I've wanted this ability for a long time and finally found a solution that works for me. In Chrome, set up a Workspace folder as described here.
I wanted to edit a markdown file, so I created an empty file called editable.md in my workspace folder. With Chrome developer tools open, in the Sources pane, I can double click this file to edit it. Even better, I have the MarkView plugin installed, so I see a nicely rendered version of the markdown in the main view.
I think there's a reason why web browsers and text editors are called the way they are. Why would you wan't a functionallity like that? There are other tools for that.
Maybe your answer is a server which handles this kind of requests - allows information to be added, and stores it in it's own dropbox folder which is shared with other users.
The main problem is that browser can't that easily access files on your computer if those aren't cookies, tmp files.

Can I embed an exe payload in a pdf, doc, ppt or any other file format? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is there any way that I can embed a .exe file in a .pdf, .doc, .xls, or .ppt file in such a way that upon opening the containing file, the document processor will run the .exe automatically without the user intentionally executing it?
Yes, this is totally possible and pretty easy to accomplish - so long as you have an active exploit in the PDF viewer. Check out one of the many Adobe Acrobat Exploits in the Metasploit framework. Next you can use a download+exec shellcode to download and execute your payload, err I mean ".exe".
You can embed files with EXE or any other format. However, the ability to have the EXE run automatically depends on the viewer application and its security settings. This PDF feature has been exploited by many malware. So, there is no guarantee that it will work on all end-user systems. Be warned that if you make this feature a part of some commercial application, then security software will soon flag it as a malware, which can adversly affect your company's reputation.
Yes. Besides using an exploit, you can just paste the file in using Acrobat Professional. Acrobat allows you to add arbitrary attachments these days.
If you make your PDF files with pdflatex, you can embed any file using the embedfile package. I use this frequently to add all kinds of files to PDF files. They show up as attachments.
\usepackage{embedfile}
\embedfile{my-wonderful-file.exe}
You can also use the Acrobat GUI to do it.
In short, no. These file formats have no provision for embedding a Win32 PE executable inside of them.
For the Office files, you could use VBA to write a script that runs when the document is opened.

Convert Microsoft Office documents to Text [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking for a library (or command line tool) to turn MS Office documents into either plaintext or HTML (for conversion to text).
It must run on Linux (not via Wine!).
I found antiword, but the last release was 2005, so it won't read the new Office 2007 formats.
I need it to read Word, Excel and Powerpoint documents
The new office 2007 format is just (ZIP) compressed XML.
All the text (in at least the .docx format) is located (once you decompress the file) in the word folder, document.xml file. Strip it from all the XML tags and you'll get the text. You'll lose the formatting no doubt, but if you want to do text indexing or something like it format isn't relevant anyway. The order is preserved.
I haven't analyzed Excel and Powerpoint but the approach should be similar. Excel might be trickier, depending on how are the cells stored in the XML file.
The Apache POI library can extract text from office formats. This is used by Tika in Lucene. Tika can be executed as a command line tool:
curl http://.../document.doc \
| java -jar tika-app-x.y.jar --text \
| grep -q keyword
PyODConverter for automating OpenOffice. Use it to do the conversions.
OONinja example converting Doc to PDF but any OpenOffice supported imports or exports should work. Also has the advantage of working Headless if required.
other options include,
Abiword
or you really just want to deal with command line WvWare but I don't think it supports Docx,
You can use Autonomy Keyview with the appropriate licence to use in your application. It seems to be extremely powerful and can extract text from almost everything; we use it to identify text within arbitrary format files.
I've no idea what the licensing terms are, but they're available from your account manager :)

Resources