(MY) MAJOR BREAKTHROUGH: now, you can use Opera Mini as the system-level Web browser!

Search This thread

badbob001

Senior Member
Mar 28, 2005
320
17
badbob001, I think this time you did the motivating. You finally figured out how to get rid of the hard coded pauses, very cool! I tried messing with this concept a while ago but gave up after 20 minutes of no success, go figure. Hope you don't mind I snagged your concept also :) I decided to validate 2 pixels, to really make sure. I got it fully working in my script on all 3 browsers OM2, OM4 & OM4.1 but only in JBed, I should probably drop TAO Intent support, the blue softkeys at the bottom make it a pain to get color. I wonder what the market share is comparing TAO & JBed. Do most Windows Mobiles now use JBed or is TAO still in the game? Anybody?

Curious, where is the second pixel that you are checking? I initially wanted to check a row of pixels... specifically part of the scrollbar, which is always present, even in full screen. But I couldn't get mortscript to read the color of the pixels I wanted. I also couldn't get the color from the bottom opera bar. It's almost as if parts of the interface is off-limits to the mortscript function. Also be aware that if the opera font size is changed, the top bar changes size as well.
 
Last edited:

JZ SmartMort

Senior Member
Mar 24, 2008
784
16
Burbank
Curious, where is the second pixel that you are checking? I initially wanted to check a row of pixels... specifically part of the scrollbar, which is always present, even in full screen. But I couldn't get mortscript to read the color of the pixels I wanted. I also couldn't get the color from the bottom opera bar. It's almost as if parts of the interface is off-limits to the mortscript function. Also be aware that if the opera font size is changed, the top bar changes size as well.

Thanks for the suggestions, gotta watch the size, so I'll mess with that. Here's what I use for the two pixels. BTW you use RGB value, I use string, how did you convert to RGB?

CurrentColor1x = 115
CurrentColor1y = 6
OperaColor1 = 527492
CurrentColor2x = 115
CurrentColor2y = 7
OperaColor2 = 528524
 
Last edited:

JZ SmartMort

Senior Member
Mar 24, 2008
784
16
Burbank
I think you can safely drop TAO support. A lot of TAO users have continuously moving to Jbed, particularly after reading my articles telling them to do so.

Thanks Menneisyys... messed with it a bit further, found that it displaces Opera Mini 4 & 4.1 by 28 pixels, Opera Mini 2.xx by 30 pixels.

I believe TAO came pre-installed on all HTC's up to about a year or so ago, now they install JBed... maybe I'll stop supporting it soon, but I feel bad for n00bs who are too afraid to try JBed.
 
Last edited:

badbob001

Senior Member
Mar 28, 2005
320
17
Thanks for the suggestions, gotta watch the size, so I'll mess with that. Here's what I use for the two pixels. BTW you use RGB value, I use string, how did you convert to RGB?

Mortscript's colorat uses a color system I don't know how to visualize, but mortscript can convert it back to rgb.

Code:
color = colorat(x,y)
rgb = red(color) &",",& green(color) &",",& blue(color)
 
Last edited:

JZ SmartMort

Senior Member
Mar 24, 2008
784
16
Burbank
Mortscript's colorat uses a color system I don't know how to visualize, but mortscript can convert it back to rgb.

Code:
color = colorat(x,y)
rgb = red(color) &",",& green(color) &",",& blue(color)

Yep, tried that, but I messed with logic at the same time so I thought this way is no good, will re-do my code. Thanks!
 
Last edited:

JZ SmartMort

Senior Member
Mar 24, 2008
784
16
Burbank
Yep, tried that, but I messed with logic at the same time so I thought this way is no good, will re-do my code. Thanks!


badbob001 these seem to be the best pixels to test because I switched font size and they remained the same.

CurrColor1x = 1
CurrColor1y = 1
OperaColor1 = RGB(115,12,8)
CurrColor2x = 2
CurrColor2y = 1
OperaColor2 = RGB(115,12,8)

Intent is also working for me but Opera Mini 2.06 is a pain because it's really full-screen so everything is white, and that's not a good test. Intent support is probably staying but Opera Mini 2 support is getting dropped from my scripts.

Thanks again badbob001! The concept is really holding up!
 
Last edited:

Tyman07

Member
Jul 13, 2007
5
0
so ur saying with this breakthrough i can now stream
online music?

hhhmmmmm
quite shallow and pandetic if u ask me...
but yes i will try on my phone....
if ur lucky
 

badbob001

Senior Member
Mar 28, 2005
320
17
NOTE: This post has been updated many times since the original posting.

Here's a new version that runs much faster since it only does the opera mini / jbed detection routines the first time it's run and then stores the results in an ini file. The only time it will run the detection routines again is if:
1) the ini file is missing or deleted
2) the ini file contains missing values
3) it fails to detect opera mini after trying to run it
4) it fails to detect the address input window

The ini file is created in the same location as the script.

The script also tries to do away any manual editing of parameters in the script. During the detection routine, if more than one version of Opera mini is found, it will ask you which version to run. If version 4.1 is the final choice, then it will ask if Direct Address Input is enabled. Then these choices are stored in the ini file. There are parameters in the script that you can tweak, but I hope the defaults work for most people.

This is a *mess* of loops and logic conditions! I didn't want to use the 'exit' command to quit a loop/condition, but it's SO MUCH EASIER. :)

Interesting fact: If you disable Direct Address Input in Opera Mini but leave it enabled in the script, it will still work. May be a useful optimization...

Code:
wait_time_for_opera = 10     #seconds allowed for opera to start
wait_time_between_keys = 100 #milliseconds between key commands
check_for_text_window = True #check if address text window appears
operaRed = rgb(107, 12, 8)
checkPixelx = 0
checkPixely = 0


ini_file = SystemPath("ScriptPath") &"\"& SystemPath("ScriptName") &".ini"

if (substr(url,1,1) eq " ")
	url = substr(url,2)
EndIf

If (url ne "")
	If (Find("file://", ToLower(url)))
		Run("\Windows\iexplore.exe", url)
		exit
	EndIf
EndIf

main_loop_done = False
while(main_loop_done eq False)
	ini_ok = False
	call validate_ini
	if ( (ini_ok eq True) AND (main_loop_done = False) )
		call startOM
	EndIf
	if ( (ini_ok eq False) AND (main_loop_done = False) )
		kill("jbed.exe")
		call create_ini
	EndIf
EndWhile


Sub validate_ini
	if FileExists ( ini_file )
		split(ReadFile(ini_file),"|", True, opera_version_ini, jbed_exe_ini, jbed_params_ini, direct_address_input)
		if ( (opera_version_ini eq "") OR (jbed_exe_ini eq "") OR (jbed_params_ini eq "") OR (direct_address_input eq "") )
			error_msg = ini_file &" is invalid.^NL^^NL^"
			error_msg = error_msg & "Re-detect Opera Mini settings?"
			if (question(error_msg, "ERROR", "YesNo") eq No)
				exit
				#main_loop_done = True
			EndIf
		else
			ini_ok = True
		EndIf
	EndIf
EndSub

Sub create_ini
	ShowWaitCursor
	opera40_string = "Opera Mini,"
	opera41_string = "Opera Mini 4.1,"
	
	jbed_exe_ini = Part(RegRead("HKCR","jarfile\Shell\Open\Command",""),"""",2,1)
	utf_file = ReadFile(RegRead("HKCR","jarfile\Shell\Save\Save Location","") & "\selector.utf")
	
	linenum = 0
	opera_count = 0

	ForEach line in split (utf_file, "^LF^", 1)
		linenum = linenum + 1
		opera_version_found = "unknown"
		prog_id = ""
					
		If (Find(line,"suite=" & opera40_string) ne 0)
			opera_version_found = "4.0"
		ElseIf (Find(line,"suite=" & opera41_string) ne 0)
			opera_version_found = "4.1"
		EndIf
				
		prog_line = Part( utf_file,"^LF^",linenum+3,1)
		prog_line_position = find(prog_line,"root=")
		if (prog_line_position ne 0)
			prog_id = substr(prog_line, prog_line_position+5, 3)
			if (prog_id ne "")
				jbed_params_ini = "-run " & prog_id
				opera_count = opera_count + 1
				opera_array[opera_count] = opera_version_found &"|"& jbed_exe_ini &"|"& jbed_params_ini
			EndIf
		EndIf
	EndForEach
	HideWaitCursor

	opera_array_choice = 1
	
	If (opera_count = 0)
		message ("Opera Mini does not appear to be installed.", "ERROR")
		exit
		#main_loop_done = True
	ElseIf (opera_count = 1)
		opera_array_choice = opera_count
		ini_ok = True
	Else
		
		idx = choice("Question", "Which Opera Mini version do you want to run by default?", 0, 0, opera_array)
		if (idx = 0)
			exit
			#main_loop_done = True
		Else
			opera_array_choice = idx
			ini_ok = True
		EndIf
	EndIf
	
	direct_address_input = False
	If (ini_ok eq True)
		split(opera_array[opera_array_choice],"|", True, opera_version_ini, jbed_exe_ini, jbed_params_ini)
		if (opera_version_ini eq "4.1")
			if (question("In Opera Mini 4.1, do you have Direct Address Input enabled?^NL^(It's enabled by default.)", "", "YesNo") eq Yes)
				direct_address_input = True
			EndIf
		EndIf
		WriteFile (ini_file, opera_version_ini&"|"&jbed_exe_ini&"|"&jbed_params_ini&"|"&direct_address_input)
	EndIf
Endsub


Sub StartOM
	Run(jbed_exe_ini, jbed_params_ini)
	Call waitForOperaRed

	if ( (url ne "") AND (ini_ok eq True) )
		sleep(wait_time_between_keys)
		SendLeftSoft
		Sleep(wait_time_between_keys)
		SendLeftSoft
		Sleep(wait_time_between_keys)
		
		if (opera_version_ini = "4.1" AND direct_address_input eq True)
			sendup
			Sleep(wait_time_between_keys)
			sendup
			Sleep(wait_time_between_keys)
			sendcr
			Sleep(wait_time_between_keys)
		Endif

		checkColor = colorat(checkPixelx,checkPixely)
		if ( (checkColor = operaRed) AND (check_for_text_window eq True) )
			error_msg = "Did not find the address input window.^NL^^NL^Re-detect Opera Mini settings?"
			if (question(error_msg, "ERROR", "YesNo") eq No)
				exit
				#main_loop_done = True
			else
				main_loop_done = False
				ini_ok = False
			EndIf
		else	
			SetClipText(url)
		
			SendHome ("",1,0)
			sleep(wait_time_between_keys)
			SendEnd ("",1,1)
			sleep(wait_time_between_keys)
		
			SendCtrlKey("V")
			Sleep(wait_time_between_keys)
			SendLeftSoft
			sleep(wait_time_between_keys)
	
			if (opera_version_ini = "4.1" AND direct_address_input eq True)
				sendcr
			endif			
		endif
		
	endif
EndSub

sub waitForOperaRed
	loop_count = 0
	loop_done = False
	ShowWaitCursor
	while (loop_done = False)
		checkColor = colorat(checkPixelx,checkPixely)
		if (checkColor = operaRed)
			loop_done = True
			main_loop_done = True
			HideWaitCursor
		ElseIf (loop_count >= wait_time_for_opera * 2)
			HideWaitCursor
			error_msg = "Did not find Opera Mini running after " & wait_time_for_opera &" seconds. (I can't find Opera Mini if it's running in full-screen mode.^NL^^NL^"
			error_msg = error_msg & "Re-detect Opera Mini settings?"
			if (question(error_msg, "ERROR", "YesNo") eq No)
				exit
				#main_loop_done = True
			Else
				ini_ok = False
			EndIf
			loop_done = True
		Else
			sleep(500)
			loop_count = loop_count + 1
		EndIf
	endwhile
endsub
 
Last edited:

tmknight

Senior Member
Mar 27, 2007
424
32
Georgia
error: "operator expected"
line: 1

I simply replaced your script over Werner's orginal "OMInvokeAndPasteScript.mscr" which lives in the \program files\mortscript.

Don't recall the version of mortscript, but within the last 6 months...

Thoughts?
 

badbob001

Senior Member
Mar 28, 2005
320
17
error: "operator expected"
line: 1

I simply replaced your script over Werner's orginal "OMInvokeAndPasteScript.mscr" which lives in the \program files\mortscript.

Don't recall the version of mortscript, but within the last 6 months...

Thoughts?
There really isn't much happening in the first line that would be version specific.

Please verify the first line is exactly the same as this:
Code:
wait_time_for_opera = 10     #seconds allowed for opera to start

If yes, then on the first line, try deleting the spaces and comments after "10".
What text editor did you use to modify the original? Perhaps you saved it in a format that is not compatible with mortscript on your device. For example, if you opened it with notepad and do a Save As, you'll see serveral Encoding options. Try ANSI.

Also, I'm not sure if you copied my code from the post or got it in an email. If via email, then the formatting of long lines may be screwed up so grab it directly from the post.
 
Last edited:

tmknight

Senior Member
Mar 27, 2007
424
32
Georgia
I upgraded mortscript to 411b7 and got past the "operator" error. Nice concept in parsing browser versions and the sort, but for me I prefer to be able to choose whether IE or Opera and use full-screen (small Treo 750 screen so need all the real estate I can get).

Keep up the good work! I'll keep my eye on this as it continues to develop...
 
Last edited:

badbob001

Senior Member
Mar 28, 2005
320
17
Just tested with mortscript 4.1 and it does seem to not like inline comments. Looks like this bug was fixed in 4.11b4. I've moved those inline comments. I've also modified any dialog windows to display the version of mortscript running.

Code:
wait_time_for_opera = 10
 #default = 10 seconds
wait_time_between_keys = 100
 #default = 100 milliseconds
check_for_text_window = True
operaRed = rgb(107, 12, 8)
checkPixelx = 0
checkPixely = 0


ini_file = SystemPath("ScriptPath") &"\"& SystemPath("ScriptName") &".ini"

if (substr(url,1,1) eq " ")
	url = substr(url,2)
EndIf

If (url ne "")
	If (Find("file://", ToLower(url)))
		Run("\Windows\iexplore.exe", url)
		exit
	EndIf
EndIf

main_loop_done = False
while(main_loop_done eq False)
	ini_ok = False
	call validate_ini
	if ( (ini_ok eq True) AND (main_loop_done = False) )
		call startOM
	EndIf
	if ( (ini_ok eq False) AND (main_loop_done = False) )
		kill("jbed.exe")
		call create_ini
	EndIf
EndWhile


Sub validate_ini
	if FileExists ( ini_file )
		split(ReadFile(ini_file),"|", True, opera_version_ini, jbed_exe_ini, jbed_params_ini, direct_address_input)
		if ( (opera_version_ini eq "") OR (jbed_exe_ini eq "") OR (jbed_params_ini eq "") OR (direct_address_input eq "") )
			error_msg = ini_file &" is invalid.^NL^^NL^"
			error_msg = error_msg & "Re-detect Opera Mini settings?"
			if (question(error_msg, MortScriptVersion(), "YesNo") eq No)
				exit
			EndIf
		else
			ini_ok = True
		EndIf
	EndIf
EndSub

Sub create_ini
	ShowWaitCursor
	opera40_string = "Opera Mini,"
	opera41_string = "Opera Mini 4.1,"
	
	jbed_exe_ini = Part(RegRead("HKCR","jarfile\Shell\Open\Command",""),"""",2,1)
	utf_file = ReadFile(RegRead("HKCR","jarfile\Shell\Save\Save Location","") & "\selector.utf")
	
	linenum = 0
	opera_count = 0

	ForEach line in split (utf_file, "^LF^", 1)
		linenum = linenum + 1
		opera_version_found = "unknown"
		prog_id = ""
					
		If (Find(line,"suite=" & opera40_string) ne 0)
			opera_version_found = "4.0"
		ElseIf (Find(line,"suite=" & opera41_string) ne 0)
			opera_version_found = "4.1"
		EndIf
				
		prog_line = Part( utf_file,"^LF^",linenum+3,1)
		prog_line_position = find(prog_line,"root=")
		if (prog_line_position ne 0)
			prog_id = substr(prog_line, prog_line_position+5, 3)
			if (prog_id ne "")
				jbed_params_ini = "-run " & prog_id
				opera_count = opera_count + 1
				opera_array[opera_count] = opera_version_found &"|"& jbed_exe_ini &"|"& jbed_params_ini
			EndIf
		EndIf
	EndForEach
	HideWaitCursor

	opera_array_choice = 1
	
	If (opera_count = 0)
		message ("Opera Mini does not appear to be installed.", MortScriptVersion())
		exit
	ElseIf (opera_count = 1)
		opera_array_choice = opera_count
		ini_ok = True
	Else
		
		idx = choice(MortScriptVersion(), "Which Opera Mini version do you want to run by default?", 0, 0, opera_array)
		if (idx = 0)
			exit
		Else
			opera_array_choice = idx
			ini_ok = True
		EndIf
	EndIf
	
	direct_address_input = False
	If (ini_ok eq True)
		split(opera_array[opera_array_choice],"|", True, opera_version_ini, jbed_exe_ini, jbed_params_ini)
		if (opera_version_ini eq "4.1")
			if (question("In Opera Mini 4.1, do you have Direct Address Input enabled?^NL^(It's enabled by default.)", MortScriptVersion(), "YesNo") eq Yes)
				direct_address_input = True
			EndIf
		EndIf
		WriteFile (ini_file, opera_version_ini&"|"&jbed_exe_ini&"|"&jbed_params_ini&"|"&direct_address_input)
	EndIf
Endsub


Sub StartOM
	Run(jbed_exe_ini, jbed_params_ini)
	Call waitForOperaRed

	if ( (url ne "") AND (ini_ok eq True) )
		sleep(wait_time_between_keys)
		SendLeftSoft
		Sleep(wait_time_between_keys)
		SendLeftSoft
		Sleep(wait_time_between_keys)
		
		if (opera_version_ini = "4.1" AND direct_address_input eq True)
			sendup
			Sleep(wait_time_between_keys)
			sendup
			Sleep(wait_time_between_keys)
			sendcr
			Sleep(wait_time_between_keys)
		Endif

		checkColor = colorat(checkPixelx,checkPixely)
		if ( (checkColor = operaRed) AND (check_for_text_window eq True) )
			error_msg = "Did not find the address input window.^NL^^NL^Re-detect Opera Mini settings?"
			if (question(error_msg, MortScriptVersion(), "YesNo") eq No)
				exit
			else
				main_loop_done = False
				ini_ok = False
			EndIf
		else	
			SetClipText(url)
		
			SendHome ("",1,0)
			sleep(wait_time_between_keys)
			SendEnd ("",1,1)
			sleep(wait_time_between_keys)
		
			SendCtrlKey("V")
			Sleep(wait_time_between_keys)
			SendLeftSoft
			sleep(wait_time_between_keys)
	
			if (opera_version_ini = "4.1" AND direct_address_input eq True)
				sendcr
			endif			
		endif
		
	endif
EndSub

sub waitForOperaRed
	loop_count = 0
	loop_done = False
	ShowWaitCursor
	while (loop_done = False)
		checkColor = colorat(checkPixelx,checkPixely)
		if (checkColor = operaRed)
			loop_done = True
			main_loop_done = True
			HideWaitCursor
		ElseIf (loop_count >= wait_time_for_opera * 2)
			HideWaitCursor
			error_msg = "Did not find Opera Mini running after " & wait_time_for_opera &" seconds. (I can't find Opera Mini if it's running in full-screen mode.^NL^^NL^"
			error_msg = error_msg & "Re-detect Opera Mini settings?"
			if (question(error_msg, MortScriptVersion(), "YesNo") eq No)
				exit
			Else
				ini_ok = False
			EndIf
			loop_done = True
		Else
			sleep(500)
			loop_count = loop_count + 1
		EndIf
	endwhile
endsub
 
Last edited:

badbob001

Senior Member
Mar 28, 2005
320
17
Nice concept in parsing browser versions and the sort, but for me I prefer to be able to choose whether IE or Opera and use full-screen (small Treo 750 screen so need all the real estate I can get).

Keep up the good work! I'll keep my eye on this as it continues to develop...

Perhaps JZ's package will have what you need. My motivation is to make opera mini "just work" on my wife's phone, so the less questions for her, the less questions for me. :)
 
Last edited:

badbob001

Senior Member
Mar 28, 2005
320
17
Couldn't help it. This version will work in fullscreen mode as well. To get a consistent starting state, I resorted to killing and restarting jbed.exe everytime if an url is specified. Otherwise, you're just running the script to launch opera mini and not expecting an url to be pasted in. So in non-fullscreen mode, the corner pixel is the red of the titlebar. In fullscreen mode, the corner pixel is the blueish selection box around the address input box. I hope this works on other devices.

Killing jbed does also solve the issue of Opera Mini being left in a state where the default key sequence to access the address bar doesn't work, such as when it already is in address input mode or on some other screen.

This version will also do a little wait for the address input window to appear before complaining.

Code:
wait_time_for_opera = 10
 #default = 10 seconds

wait_time_for_address = 2
 #default = 2 seconds

wait_time_between_keys = 100
 #default = 100 milliseconds

operaRed =  rgb(107, 12, 8)
operaBlue = rgb(247, 243, 247)
checkPixelx = 0
checkPixely = 0
ini_file = SystemPath("ScriptPath") &"\"& SystemPath("ScriptName") &".ini"

if (substr(url,1,1) eq " ")
	url = substr(url,2)
EndIf

If (url ne "")
	If (Find("file://", ToLower(url)))
		Run("\Windows\iexplore.exe", url)
		exit
	EndIf
EndIf

main_loop_done = False
while(main_loop_done eq False)
	ini_ok = False
	call validate_ini
	if ( (ini_ok eq True) AND (main_loop_done eq False) )
		#if (url ne "")
			kill("jbed.exe")
		#EndIf
		call startOM
	EndIf
	if ( (ini_ok eq False) AND (main_loop_done eq False) )
		kill("jbed.exe")
		call create_ini
	EndIf
EndWhile


Sub validate_ini
	if FileExists ( ini_file )
		split(ReadFile(ini_file),"|", True, opera_version_ini, jbed_exe_ini, jbed_params_ini, direct_address_input)
		if ( (opera_version_ini eq "") OR (jbed_exe_ini eq "") OR (jbed_params_ini eq "") OR (direct_address_input eq "") )
			error_msg = ini_file &" is invalid.^NL^^NL^"
			error_msg = error_msg & "Re-detect Opera Mini settings?"
			if (question(error_msg, MortScriptVersion(), "YesNo") eq No)
				exit
			else
				ini_ok = False
			EndIf
		else
			ini_ok = True
		EndIf
	EndIf
EndSub

Sub create_ini
	ShowWaitCursor
	opera40_string = "Opera Mini,"
	opera41_string = "Opera Mini 4.1,"
	
	jbed_exe_ini = Part(RegRead("HKCR","jarfile\Shell\Open\Command",""),"""",2,1)
	utf_file = ReadFile(RegRead("HKCR","jarfile\Shell\Save\Save Location","") & "\selector.utf")
	
	if (Find(jbed_exe_ini,"jbed") = 0)
		message ("This script only works with Jbed.", MortScriptVersion())
		exit
	EndIf
	
	linenum = 0
	opera_count = 0

	ForEach line in split (utf_file, "^LF^", 1)
		linenum = linenum + 1
		opera_version_found = "unknown"
		prog_id = ""
					
		If (Find(line,"suite=" & opera40_string) ne 0)
			opera_version_found = "4.0"
		ElseIf (Find(line,"suite=" & opera41_string) ne 0)
			opera_version_found = "4.1"
		EndIf
				
		prog_line = Part( utf_file,"^LF^",linenum+3,1)
		prog_line_position = find(prog_line,"root=")
		if (prog_line_position ne 0)
			prog_id = substr(prog_line, prog_line_position+5, 3)
			if (prog_id ne "")
				jbed_params_ini = "-run " & prog_id
				opera_count = opera_count + 1
				opera_array[opera_count] = opera_version_found &"|"& jbed_exe_ini &"|"& jbed_params_ini
			EndIf
		EndIf
	EndForEach
	HideWaitCursor

	opera_array_choice = 1
	
	If (opera_count = 0)
		message ("Opera Mini does not appear to be installed.", MortScriptVersion())
		exit
	ElseIf (opera_count = 1)
		opera_array_choice = opera_count
		ini_ok = True
	Else
		
		idx = choice(MortScriptVersion(), "Which Opera Mini version do you want to run by default?", 0, 0, opera_array)
		if (idx = 0)
			exit
		Else
			opera_array_choice = idx
			ini_ok = True
		EndIf
	EndIf
	
	direct_address_input = False
	If (ini_ok eq True)
		split(opera_array[opera_array_choice],"|", True, opera_version_ini, jbed_exe_ini, jbed_params_ini)
		if (opera_version_ini eq "4.1")
			if (question("In Opera Mini 4.1, do you have Direct Address Input enabled?^NL^(It's enabled by default.)", MortScriptVersion(), "YesNo") eq Yes)
				direct_address_input = True
			Else
				direct_address_input = False
			EndIf
		EndIf
		WriteFile (ini_file, opera_version_ini&"|"&jbed_exe_ini&"|"&jbed_params_ini&"|"&direct_address_input)
	EndIf
Endsub


Sub StartOM
	Run(jbed_exe_ini, jbed_params_ini)
	
	Call waitForColor

	if ( (url ne "") AND (ini_ok eq True) )
		sleep(wait_time_between_keys)
		SendLeftSoft
		Sleep(wait_time_between_keys)
		SendLeftSoft
		Sleep(wait_time_between_keys)
		
		if (opera_version_ini eq "4.1" AND direct_address_input eq True)
			sendup
			Sleep(wait_time_between_keys)
			sendup
			Sleep(wait_time_between_keys)
			sendcr
			Sleep(wait_time_between_keys)
		Endif

		Call waitForNotColor

		If (ini_ok eq True)
			SetClipText(url)
		
			SendHome ("",1,0)
			sleep(wait_time_between_keys)
			SendEnd ("",1,1)
			sleep(wait_time_between_keys)
		
			SendCtrlKey("V")
			Sleep(wait_time_between_keys)
			SendLeftSoft
			sleep(wait_time_between_keys)
	
			if (opera_version_ini eq "4.1" AND direct_address_input eq True)
				sendcr
			endif			
		endif
		
	endif
EndSub

sub waitForColor
	loop_count = 0
	loop_done = False
	ShowWaitCursor
	while (loop_done = False)
		checkColor = colorat(checkPixelx,checkPixely)
		if ( (checkColor eq operaRed) OR (checkColor eq operaBlue) )
			loop_done = True
			main_loop_done = True
			HideWaitCursor
		ElseIf (loop_count >= wait_time_for_opera * 2)
			HideWaitCursor
			error_msg = "Did not find Opera Mini running after " & wait_time_for_opera &" seconds.^NL^^NL^"
			error_msg = error_msg & "Re-detect Opera Mini settings and Retry?"
			if (question(error_msg, MortScriptVersion(), "YesNo") eq No)
				exit
			Else
				ini_ok = False
				loop_done = True
			EndIf
		Else
			sleep(500)
			loop_count = loop_count + 1
		EndIf
	endwhile
endsub

sub waitForNotColor
	loop_count = 0
	loop_done = False
	ShowWaitCursor
	while (loop_done = False)
		checkColor = colorat(checkPixelx,checkPixely)
		if ( (checkColor ne operaRed) AND (checkColor ne operaBlue) )
			loop_done = True
			main_loop_done = True
			HideWaitCursor
		ElseIf (loop_count >= wait_time_for_address * 2)
			HideWaitCursor
			error_msg = "Did not find the address input window after "& wait_time_for_address &" seconds.^NL^^NL^Re-detect Opera Mini settings and Retry?"
			if (question(error_msg, MortScriptVersion(), "YesNo") eq No)
				exit
			Else
				main_loop_done = False
				ini_ok = False
				loop_done = True
			EndIf
		Else
			sleep(500)
			loop_count = loop_count + 1
		EndIf
	endwhile
endsub
 
Last edited:

prscott1

Senior Member
Nov 5, 2007
807
23
Houston
Menneisyys,

Found this over on ppcgeeks, coded in C++. works the same as yours but does not need mortscript. might be worth adding to your first post as an alternative? to quote the developer (and with thanks to same)

"Attached is a beta app that will set opera mini as the default web browser and open links when clicked from email, etc. The app has been tested to work in wm6. It assumes that java is at /windows/jbed.exe and the Opera mini app is the first applet installed. This app is similar to the mortscript version, but, is coded in c+ and does not rely on delays."

I tried this app and even though the sdomlaunch.exe works well, at least with the OM mortscript, we give ourselves the selection to open in OM or in PIE. Thanks for the app - I like having the choice to use PIE sometimes so will stick with the mortscript OMinvoke. :)
 

badbob001

Senior Member
Mar 28, 2005
320
17
Found this over on ppcgeeks, coded in C++. works the same as yours but does not need mortscript. might be worth adding to your first post as an alternative? to quote the developer (and with thanks to same)

"Attached is a beta app that will set opera mini as the default web browser and open links when clicked from email, etc. The app has been tested to work in wm6. It assumes that java is at /windows/jbed.exe and the Opera mini app is the first applet installed. This app is similar to the mortscript version, but, is coded in c+ and does not rely on delays."

Very curious to know how this app operates without reliance on delays.
Here is the source: http://forum.ppcgeeks.com/showthread.php?p=227968
 
Last edited:

prscott1

Senior Member
Nov 5, 2007
807
23
Houston
After catching up on this thread, I just upgraded to OM 4.1 and am trying the updated scripts. (Thanks all).

I'm running a cooked ROM that has Esmertec Jbed, but I don't have this registry item so script failing so am a bit confused why not. Any information you can share with me? I'm a midlet NOOB. :eek:

Here's the snip from the script that is failing - and I don't have a jarfile key under HKCR.

Code:
ReadFile(RegRead("HKCR","jarfile\Shell\Save\Save Location","") & "\selector.utf")
 

JZ SmartMort

Senior Member
Mar 24, 2008
784
16
Burbank
Couldn't help it. This version will work in fullscreen mode as well. To get a consistent starting state, I resorted to killing and restarting jbed.exe everytime if an url is specified. Otherwise, you're just running the script to launch opera mini and not expecting an url to be pasted in. So in non-fullscreen mode, the corner pixel is the red of the titlebar. In fullscreen mode, the corner pixel is the blueish selection box around the address input box. I hope this works on other devices.

Killing jbed does also solve the issue of Opera Mini being left in a state where the default key sequence to access the address bar doesn't work, such as when it already is in address input mode or on some other screen.

This version will also do a little wait for the address input window to appear before complaining.

badbob001, I screwed up :) this affects users with over 9 java apps installed. Here's the line code that needs to check for end of line or comma rather than taking the next three chars.

prog_id = SubStr( prog_line , Find(line,"=") , 3 )

I changed it to this...

prog_id = SubStr( prog_line , Find(prog_line,"=")+1 , (Find(prog_line,"_")+1)-(Find(prog_line,"=")+1) )
 
Last edited: