Hi,
How to access the first 10 lines of the same applescript which is in execution itself?
Hello.
if you can find its path, you can use osa decompile from Satimage, extract the text, then pipe the text through the unix command head, and write it to a file, which you then read back into your script.
But you could store the script in a variable in the script, itself? (Not inlcluding the variable itself of course.)
Hi.
Good idea. But “osadecompile” is part of the Mac OS “Unix” installation and it writes to standard output, so the process is simply:
do shell script "osadecompile " & quoted form of POSIX path of (path to me)
-- Then get the paragraphs you need from the result.
Obviously this only works with the saved version of the script.
Hello!
How nice, that osadecompile is a part of Os X!
Apropos saved versions of scripts:
You can run snippets of Applescript from stickies, if you have the run script service installed, and this is more of a tip, than making a silly argument that the Stickie is saved, but that you can’t get the path of it.
It is great for small scripts, that you want to edit a little, and use in different contexts, as it would be to many of them, if you were to save them all. :
And while I am talking about Satimage: Smile is great in that you have those worksheets, where you can execute blocks of code. Well Smile is out of my range for that functionality, but recently, I have started to mark blocks in the Other editors I use, and I run the Run script service, to avoid all the small snippets with AppleScript, it works great really!
And speaking of snippets, while I am into this digression, often used snippets, like a “logit handler” have I put onto the shelf in Quicksilver, so I have it ready to just paste in, whenever I want to watch some state of a script, while it executes outside the editor.
Hi and thanks to both,
i got it, i love hot shells… :lol:
another little question: whats the difference between ‘the’ and ‘get’ ?
‘the’ doesn’t perform like ‘get’
‘the’ seems to improve the human readability of applescript code only.