Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Fix for Opera 12 - Ctrl/Left Click puts web link on desktop


  • Please log in to reply
7 replies to this topic
DAT
  • Members
  • 58 posts
  • Last active: Jul 17 2014 08:55 AM
  • Joined: 01 Dec 2008
Opera is my favourite web browser but the recent update to Version 12 took away a feature that I use all the time. Now you can no longer make shortcuts by dragging and dropping the URL of a web page to the desk top :(

Apparently it's a known issue and there will be an official fix eventually, but meanwhile the AHK script below provides a quick alternative solution. With the script running, hold down the left Control key and left-click anywhere in an active Opera window. A tool tip briefly indicates that it's working, and a link to the current webpage appears on the desktop.
; ;;;;;;;;;;;	
;  URLtoLink2.ahk
;  By DAT, 23-06-2012

;  In Version 12 of Opera you can no longer drag and drop the URL
;  to the desktop to make a link, so until it's sorted out this
;  script lets you do it by holding the left control key and left-clicking
;  anywhere in the Opera window.

;  Description
;  With Opera as the active window and displaying a website, hold down
;  the LeftControl key and left-click anywhere in the Opera window. 
;  The script then puts a shortcut to the currently selected website
;  onto the desktop.

#NoEnv
#SingleInstance 
SetWorkingDir %A_ScriptDir% 

~LControl & ~LButton::		; Define the activation hotkeys.

WinGetTitle, Title, A
If Title contains  - Opera		; Ensures it works only with an Opera window
{
	Send , {F8}		; set focus to URL window in Opera
	sleep , 100
	Address := Get_Selected_Text()		; Get the URL
	StringTrimRight , Title, Title, 8	; Discard the " - Opera" section.
	Send , {F9}		; set focus back to web page in Opera
}
Else 
	Return

Tooltip, Placing Link on Desktop	; gives useful feedback
SetTimer, RemoveToolTip, 1000

; Remove any invalid characters (as described
; at http://www.autohotkey.com/community/viewtopic.php?t=66683)
; and make the shortcut

Title := RegExReplace(Title,"[\\/:*?""<>|]")
IniWrite , %Address% , %A_Desktop%\%Title%.url , InternetShortcut, URL
Return

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

;;;;;;;;;;;;;;;;;;
; Function puts selected text into output variable: eg Text := Get_Search_Term()
;
Get_Selected_Text()
{
	ClipSaved := ClipboardAll	; Save clipboard content for later restore
	sleep , 60		;  These delays seem to be required else it can be unreliable
	Clipboard =		;Flush clipboard
	Sleep, 100
	SendEvent, ^c	;Save highlighted text to clipboard. 
	sleep , 100
	STerm := Clipboard
	Sleep, 100
	Clipboard := ClipSaved	;Restore Clipboard content  
	ClipSaved =				;and free the memory
	Return , STerm		; Search term now stored and ready
}
;;;;;;;;;;;;;;;;;;;;


  • Guests
  • Last active:
  • Joined: --
Thank you, your script works like a charm! :) Good to know that others have been using this OPERA's functionality as well.

Thank you for your time spent on writing this script!
1Rosomak

DAT
  • Members
  • 58 posts
  • Last active: Jul 17 2014 08:55 AM
  • Joined: 01 Dec 2008
No need for this script any more. Opera version 12.01 just came out and the bug in 12.00 has been fixed. You can now drag and drop a URL to the desktop directly from the address box.

UberNoob
  • Guests
  • Last active:
  • Joined: --
Hi DAT,

Opera is my favorite browser, too, but I dislike Opera's bookmarks and I don't want the desktop cluttered with shortcuts, so I came up with this ...

;-------------------------------
;Creates IE url shortcut while browsing with Opera
;-------------------------------
^!k::
Sleep 1000
clipboard = ;Empty the clipboard
Send, ^l
Sleep 200
Send, ^c
ClipWait, 2
if ErrorLevel
{
    MsgBox, The attempt to copy text onto the clipboard failed.
    return
}
var1 = %clipboard%

InputBox, var2, Add To Favorites, Name of URL

IniWrite, %var1%, C:\Documents and Settings\Owner\Favorites\Links\%var2%.url, InternetShortcut, URL
Return

Also, I'm wondering if you have a script for Opera that toggles High Contrast on and off? I have one, but it incorporates a lot of MouseMove, Sleep, and Click commands. It works, but it's easily broken, i.e., change font, font size, or font style, and it's history.

DAT
  • Members
  • 58 posts
  • Last active: Jul 17 2014 08:55 AM
  • Joined: 01 Dec 2008
I've never needed to do that but this link seems to offer some clues, although I've not tried reading it in any depth: http://my.opera.com/...r-mouse-gesture.

"... Quickly enable or disable a style using keyboard shortcut/mouse gesture
Author mode and user mode styles can be switched quickly using the default keyboard shortcut, Shift+G but there is no shortcut to enable or disable other styles except View > Style menu.
Any style can be enabled or disabled quickly by using action codes Select user CSS file and Deselect user CSS file respectively. Create a new keyboard shortcut or mouse gesture in Document Window section with the following action code... "

UberNoob
  • Guests
  • Last active:
  • Joined: --
Thanks, DAT. I'll check it out.

Here's where I'm trying to get to without all the MouseMove, Sleep, and Click commands.
Posted Image

I tried WinMenuSelectItem, but I couldn't get it to work. I didn't try PostMessage.

abazh
  • Members
  • 1 posts
  • Last active: Sep 08 2012 05:23 AM
  • Joined: 08 Sep 2012
Sorry, I know very little about ahk but you script is very useful for me.
Tell me pleasse, how can I change saving directory?
I understand it is here:
IniWrite , %Address% , %A_Desktop%\%Title%.url , InternetShortcut, URL
But when I insert smth like D:\bookmark instead of A_Desktop it doesn't work.
Can you help?

DAT
  • Members
  • 58 posts
  • Last active: Jul 17 2014 08:55 AM
  • Joined: 01 Dec 2008

...when I insert smth like D:\bookmark instead of A_Desktop it doesn't work.
Can you help?

Hi abazh,

Well, it works OK here (in Windows XP). I made a new folder called D:\bookmark and replaced the line
IniWrite , %Address% , %A_Desktop%\%Title%.url , InternetShortcut, URL
with this one
IniWrite , %Address% , D:\bookmark\%Title%.url , InternetShortcut, URL
When I run it the web link duly appears in the folder D:\bookmark\. I wonder if, when you tried it, you used %D:\bookmark% instead of just D:\bookmark? As explained here, %<variable>% means 'get the value stored in this variable' whereas D:\bookmark is not a variable storing a value, it's the actual value so you don't need the percent signs round it.

Regards,
DAT