BoBo
while i could have went for a COM approach it was easier to fix the file as such
Code:
/*
AutoHotkey Version: 1.0.47.06
Language: English
Platform: WIN_XP
Author: BoBo
Script Function: Create a script based on a copy from the AutoHotkey-Forum.
Handling: Pressing the ALT-key while left-clicking a Forum-posts (mini) icon ...
will detect its assigned PostID. If you'll copy a posts script (within 30 seconds time, ...
using the forums 'script copy' function, a local copy of the script will be created.
For reference reasons the created file contains the PostID and a timestamp within its filename.
Additionaly the PostID (its origin path) and an advise regarding an added Hotkey is given in the header section of the created file.
The added hotkey (ALT+W) should give direct access to the origin post at the forum.
That might make sense if you wanna respond after testing.
*/
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, Force
SetTitleMatchMode, 2
SetTimer, DetectCopyActivity, 500
SetTimer, DetectCopyActivity, Off
!LButton::
MouseGetPos,,, hwnd
WinGetTitle,title, ahk_id %hwnd%
StatusBarGetText, PostURI, 1,ahk_id %hwnd% ; get the posts ID
SoundBeep
If InStr(PostURI,"http://de.autoHotkey.com") ; identify if working at the US/UK or the German AHK-forum
Msg := "Code wurde in Zwischenablage kopiert."
If InStr(PostURI,"http://www.autoHotkey.com")
Msg := "Code copied to clipboard."
msg1:="Do you want to allow this webpage to access your Clipboard?"
ClipBoard =
SetTimer, DetectCopyActivity, On
Return
DetectCopyActivity:
NonActivityCount++
IfWinExist, Internet Explorer, %Msg%
{
IfWinExist,Internet Explorer,%msg1%
{
SendInput,!a
ControlSend, Button2, {ENTER}, Internet Explorer, %Msg%
WinWaitClose, Internet Explorer,%msg1%
}
Sleep, 200
ControlSend, Button1, {ENTER}, Internet Explorer, %Msg%
WinWaitClose, Internet Explorer, %Msg%
SplitPath, PostURI,,, POSTID ; extract PostID from PostURI
StringSplit, PostID, PostURI,#
FileName := "AHKForumPost_" PostID2 "_" A_Now ".ahk" ; set the output name, here: AHKForumPost_<origin number of the post>_<timestamp>.ahk
FileAppend,
(LTrim
;
; This script was copied from here: %PostURI%
; A hotkey (ALT+W) to easily connect directly to that post is added at the bottom of this file.
;
%ClipBoard%
!w::Run, "%PostURI%",, Max
)
, %A_ScriptDir%\%FileName% ; create the file
Run, Edit %FileName%, %A_ScriptDir%, OutputVarPID ; run the file
SetTimer, DetectCopyActivity, Off
NonActivityCount = 0
Return
}
If NonActivityCount = 60
{
SoundBeep
ToolTip, Wait period expired! Bye.
Sleep, 2500
ToolTip
POSTURI =
SetTimer, DetectCopyActivity, Off
}
Return
!s::Run, "%A_AhkPath%" "%A_ScriptDir%\%FileName%",,, OutputVarPID ; ALT+S start the copied/created script
!x::Process, Close, %OutputVarPID% ; ALT+X exit the (created and afterwards) executed script
it will work in both ie6 and 7 which should solve the vista problem described earlier ie7 shows windows internet explorer not microsoft so i just toook out the microsoft and added a step to deal wtih the possible allow access prompt that comes
peice
_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
