View Single Post
  #95  
Old 6th April 2008, 09:13 AM
badbob001 badbob001 is offline
Senior Member
 
Join Date: Mar 2005
Posts: 164
Default

This updated script contains parts that is based on JZ's automatic detection of jbed's location and opera suite number. The script works with both Opera mini 4.0 and Opera mini 4.1.

You will need to edit the top part of the script to specify the opera mini version you are running: opera_version_to_run = "4.1" or opera_version_to_run = "4.0". While the script can detect if opera mini 4.0 or 4.1 is installed, it can't read your mind to figure out which Opera to run if you have both installed.

If you have 4.1 with direct address input turned off, then set direct_address_input = False. This is ignored if you have 4.0.

Adjust the delays as needed.

Tested with jbed 20080222.3.1 on a T-mobile shadow.

Much thanks to JZ for your great work and inspiration for me to dust off my old script.

Code:
direct_address_input = True
opera_version_to_run = "4.1" # Use 4.0 or 4.1
delay_if_jbed_running = 3000
delay_if_jbed_not_running = 8500

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

If ( Find( "file:///", ToLower(url) ) )
	Run("\Windows\iexplore.exe", url)
Else
	Call OpenOM
EndIf

Sub OpenOM
	opera40_string = "Opera Mini,"
	opera41_string = "Opera Mini 4.1,"

	utf_file = ReadFile(RegRead("HKCR","jarfile\Shell\Save\Save Location","") & "\selector.utf")
	counter = 0
	opera_found = 0
	ForEach line in split (utf_file, "^LF^", 1)
		If (opera_found = 0)
			counter = counter+1
			opera_version_found = "unknown"
			
			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
			
			if (opera_version_found eq opera_version_to_run)
				prog_line = Part( utf_file,"^LF^",counter+3,1 )
				prog_id = SubStr( prog_line , Find(line,"=") , 3 )
				if (prog_id ne "")
					jbed_params = "-run " & prog_id
					opera_found = 1
				EndIf
			EndIf
		EndIf
	EndForEach

	If (opera_found = 0)
		message ("ERROR: Unable to find Opera Mini " & opera_version_to_run)
	Else
		jbed_exe = Part(RegRead("HKCR","jarfile\Shell\Open\Command",""),"""",2,1)
		
		If (ProcExists("jbed.exe"))
		   Run(jbed_exe, jbed_params)
		   sleep(delay_if_jbed_running)
		Else
		   Run(jbed_exe, jbed_params)
		   sleep(delay_if_jbed_not_running)
		EndIf
	
		SendLeftSoft
		Sleep(100)
		SendLeftSoft
		Sleep(100)
		
		if (opera_version_to_run = "4.1" AND direct_address_input = True)
			sendup
			Sleep(100)
			sendup
			Sleep(100)
			sendcr
			Sleep(100)
		Endif
	
		SetClipText(url)
	
		SendHome ("",1,0)
		sleep(100)
		SendEnd ("",1,1)
		sleep(100)
	
		SendCtrlKey("V")
		Sleep(100)
		SendLeftSoft
		sleep(100)

		if (opera_version_to_run = "4.1" AND direct_address_input = True)
			sendcr
		endif
	EndIf
EndSub

Last edited by badbob001; 10th April 2008 at 01:29 PM..
Reply With Quote