/*
AutoHotkey Version: 1.0.47.06
Language: English
Platform: WIN_XP
Author: BoBo/tank
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%
MsgBox,% title
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."
ClipBoard =
SetTimer, DetectCopyActivity, On
Return
DetectCopyActivity:
NonActivityCount++
IfWinExist, Internet Explorer, %Msg%
{
Sleep, 200
ControlSend, Button1, a, Internet Explorer, %Msg%
Sleep, 200
ControlSend, Button1, {ENTER}, 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 scriptHope that makes sense to you. 8)If you can' t stand such a noobish attempt, feel free to impress us with a RegEx-, DllCall()-, HttpQuery()-, <your magic command here>-release.
Have fun. 8)
06/09/2008: script has been edited for [that] reason. Thx tank
[BoBoPromo]
To promote your AHK-DIY-GUIs at the forum ...
To support your favourite noob with an image instead of confusing rocket science statements ...
Why not draw a picture? Or even better use [FSB] ? :lol:
[/BoBoPromo]
Keywords: Forum - BoBo - BoBo² - test - test script - script reference - BB Code - phpBB




