1-the command “write” seems changed. Usually “write” used to erase a file prior to re-write an existing text-file. Now, in Lion, only n-characters become overwritten.
trying:
set to_write to ""
seems not to help, probably because we have to process every paragraph to clean our original text-file.
2-there is a uncommon delay when launching apps from applescript Applications opening file lists when:
(i tried to put everything in a “script” -handler, but got the same delay results)
do shell script "open -a '" & my_app & "' " & files_ls
3-sometimes i want to get the name of parent folders of a item via shell. I tried something, but got no solution. Using applescript’s text item delimiters works not always, if filenames use slash in their names.
do shell script "cd '" & Posix path of mypath & "'../"
4-the first time i saw a modern ebook reader was in Emmerich’s film 2012: a sheik holding a kind of iPad in his hands. The reader had an autoscrolling feature. A Very nice, and a simple thing thereto. Exists such a bin who permits autoscrolling?
Number 3 : I really think you should check if it has a slash first, but my second should work with a slash as well, and adds a slash at the end, so that you know it ends with one.
echo $(dirname $PWD)
or echo $PWD |sed -n 's_\(.*\)\(/[^/][^/]*[/]*\)$_\1/_p'
Number 4: There is a commandline utility called readslow, which you could make move smooth if you find the code for it on the net. This below gives you output in a terminal window, maybe not what you were after.
[code]#!/bin/bash
Readslow: usage : cat whateverfile |Readslow
while read a ; do
echo $a ;
sleep 0.5 ;
done[/code]
The “write” shell script sends text to another user’s terminal, not to a file (according to the man page).
If you mean the StandardAdditions ‘write’ command, that has always only (over)written the number of bytes it’s given. If you want to empty the file first, use the ‘set eof’ command with a value of 0.
set accessRef to (open for access myFile with write permission)
try
set eof accessRef to 0
write myText to accessRef
end try
close access accessRef
singing “thats the way, i liiike it, aha.”
thanks to both. Nigel, you’re right. i meant the Standard Additions “write” command. Your’s a cool tip, good to know it.
McUsr, too, cool tips. I never used “sed”, nice to see it in action.
About “Readslow”: interesting. I wanted an autoscroll feature to update a ebook reader i wrote for Preview, in combination with UI scripts.
Because i’m not fan of UI scripting, i searched for a smarter and more solid solution. I searched for a while now, but hadn’t success to find anything suitable as autoscroll feature. Uff.
If the main objective, is to avoid having to scroll by hands, then maybe you can make a speakable command, that is executed, when you tell Preview to “page down”. It is not the same as auto scrolling, but it may make you get the page turned, without touching the keyboard.