utf8, busy process, and website scrolling

Hi,

#1
i want an alternative way to write xml-files who respect umlauts (utf 8) too.

#2
i want also a construct, to block user input for 1 second before and after a save process.

#3
how to scroll up and down using javascript in safari?

#1 Sorry, but alternative to what? Have you tried XMLLib osax?

#2 From an application, html form?

#3 use the window.scrollBy function

Hi DJ,

#1
usually, i wrote simple xml content with:

on write_note(inputFile, to_write)
	#as «class utf8» == for umlauts
	set accessRef to (open for access file the inputFile with write permission)
	try
		write to_write to accessRef #as «class utf8»
	end try
	close access accessRef
end write_note

.but in several cases i had to include ‘as «class utf8»’, to write for example, smart folders. Osax? i thought they aren’t more in use today, or outdated. I’ll google for your tip.

#2
i meant scriptable applications, like an Applescript Applications and applications who support Applescript.

#3
thanks for the tip. Java isn’t really my area, but i will try it.

Hi Joy,

This site has a lot of examples of javascript. Here’s the page with browser scrolling examples:

http://www.w3schools.com/js/js_ex_browser.asp

gl,
kel

Hi Joy,

Just got back and here’s an example if you didn’t solve the scrolling yet:

tell application "Safari"
	activate
	delay 1
	do JavaScript "window.scrollBy(0,100)" in document 1
end tell

Safari needs to be open to a page that scrolls. Here’s the page with the method from the last link I posted:

http://www.w3schools.com/jsref/met_win_scrollby.asp

Edited: there are other ways to scroll also (instead of pixels).

gl,
kel

It seems that xml may require different ways.
In the index.xml file created by iWork applications, the characters with umlaut (like every non ASCII characters) are stored as entities.

Here are three examples :

      <sf:p sf:style="paragraph-style-32">kônig<sf:br/></sf:p>
      <sf:p sf:style="paragraph-style-32">naïf<sf:br/></sf:p>
      <sf:p sf:style="paragraph-style-32">aiguë</sf:p>

They describe :
könig
naïf
aiguë

Here the entities are of the form : &#xHH; were HH is a the hexadecimal value for a single byte number.

entities may also be : &#xHHHH; were HHHH is an hexadecimal value for a two bytes number.

I recall (but my memory may fool me) that we may have entities with hexadecimal values for three bytes number.

KOENIG Yvan (VALLAURIS, France) mardi 9 juillet 2013 18:26:40

Hi Yvan,
yes, i meant such artificial things like hexadecimal values. Not sure how to approach these; i really like to do little math calculations, because i need these every day, but nothing more.

#2)
important! somebody out there knowing a viable method? (see question in my 1st post)

#3)
thanks, kel.

Hi
sorry for resurrecting this older thread, but i’ve yet an open question:

Hello.

There aren’t any really good ways to block user input, but maybe using Stefan’s progress bar that you’ll find in Code Exchange may do the trick, not by providing you with a key window, but by showing progress.

To avoid input, you could launch a litte applet, that activated itself every second it doesn’t have the focus, that you’d kill from your script, and reactivate it, when you are done. That way, at least most of the keyboard input, would be centered towards that app.

I hope this helps, but controlling user input, is very tricky.

Hi,
McUsrII, thanks for the explanation. :slight_smile:
I always thought that a simple method to stop user input could be a repeat-loop but i have no idea what i should run for n-seconds. Suggestions ?