I was working on adjusting the PHP validation AppleScript that has been 
floating around (I found a copy on StackOverflow 
- 
http://stackoverflow.com/questions/10560142/php-validation-in-bbedit-10-with-applescript).
 
I wanted to make a few small changes to it to make it more useful for me. I 
wanted to simply beep on successful validation (no need for a dialog box), 
jump the cursor to the line with the error and to use the front window's 
text instead of the text of the file so I would not have to save the file 
to validate. I got the first two items working but I could not figure out 
how to simply use the text of the document for validation (which is 
probably insanely simple). Here is my altered script:

*property* phpref : "/usr/bin/php -l "

*try*

*tell* *application* "BBEdit" *to* *get* *file* *of* *first* *text window*

*do shell script* phpref & quoted form *of* POSIX path *of* result

*beep*

*on* *error* msg

*set* line_num *to* *last* *word* *of* msg

*tell* *application* "BBEdit" *to* *tell* *window* 1

 *select* *insertion point* *before* *line* (line_num *as* *integer*)

*end* *tell*

*display dialog* msg buttons {"Finished Checking"} default button 1

*end* *try*

I was trying to alter the line "*tell* *application* "BBEdit" *to* *get* *
file* *of* *first* *text window" *to get the document's content instead but 
I suspect I need to adjust the shell script line as well. Would anyone be 
able to help me with the proper syntax of changing this script to use the 
window's contents instead of the saved file's contents?

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to