Page 1 of 1

[Solved] Hotkey Script

Posted: 23 Apr 2017 22:42
by sajjansinghania
I am an old person from Dos age.
I have Windows 8.1 & Firefox (latest) & IE11 (Latest).
I frequently log into a Card Game Bridge site http://www.bridgebase.com/client/client.php to play Bridge.
There is a communication window to interact with other players where I type some repetitive messages which are long. They are about 15 in total.
Below I write a few as examples :

Examples :
!H!HJoker Card's Team Match!H!H Welcome all.This is a tensionfree fun table. FAIR PLAY EXPECTED. Zero tolerance for rude behaviour. !H!HPLEASE!H!H ACCEPT CLAIMS & UNDOS for MISCLICKS. Ty

!H!HJoker Card's Team Match!H!H Please check kibitzers on your table. If your friends kibitzing please advise them to stay away from table to protect privacy and FAIR PLAY. If not, they will be ignored in future TMs Ty

!H!HJoker Card's Team Match!H!H !H!HJoker Card!H!H needs to increase # of Boards If you have experience as TD & wish to help kindly Search !H!HJoker Card!H!H on bottom right of your screen & contact !H!HJoker Card!H!H. Ty


I may mention here that !H in above is local conversion to the Heart sign.

Requirement :
Instead of typing out whole text every time I need it, I wish the experts suggest a Cmd oe Vbs script (with hotkey assigned) which helps me to reproduce my messages on this site.

Thank you in advance Sir.

Re: Hotkey Scriot

Posted: 24 Apr 2017 15:42
by ShadowThief
Oh God, this entire site is made in Flash.

I was getting ready to write something in Javascript since batch doesn't really play nice with things outside of the command prompt, but there's really no way to interact with Flash programmatically.

Honestly, your best bet is to store the sentences you want in a regular text file and then copy and paste them into the textbox whenever you want to use them.

Re: Hotkey Scriot

Posted: 24 Apr 2017 18:08
by penpen
You could insert scancodes to the actual frame (using an background KeyHandler), but i fear that requires c#, c++ or similar:
If i remember right, then JScript/VBS should not be able to create a Keyhandler.
Maybe it is possible in (pure) powershell (without c#) - but i don't know.

The best i can see using batch here is not much more than ShadowThief proposed, just create 15 files (similar to this):

Code: Select all

@echo off
setlocal enableExtensions disableDelayedExpansion
call ^
:text "| clip && rem "
@(
   echo(Hello
   echo(world!
) %~1 & pause
goto :eof

If you don't want the 'verbose' output, you could use:

Code: Select all

@echo off
setlocal enableExtensions disableDelayedExpansion
@(
   echo(Hello
   echo(world!
) | clip
goto :eof


penpen

Re: Hotkey Scriot

Posted: 24 Apr 2017 19:18
by sajjansinghania
@ShadowThief Sir. As I posted in my topic I am zero on computer systems. But I think Sir, I can assist you as follows :
1. Copy paste your program in a .vbs file.
2. If provided a JavaScript, I suggest some instructions be explained by you Sir, on how to run JavaScript.
I look forward to your guidance on this. Ty Sir.

@penpen Sir,
What you suggested Sir, does not help me but thank you for taking interest and suggest.

Re: Hotkey Scriot

Posted: 12 May 2017 15:26
by sajjansinghania
OK. All that I can understand is that there is no apparent solution in DOS.
Can some expert suggest a help forum handling Flash matters to create a simple code as per my need.
I shall be obliged for rest of my life Tx.

Re: Hotkey Script

Posted: 12 May 2017 15:41
by ShadowThief
I feel like if you could guarantee the position of the web browser on the monitor, you could throw together some powershell code that clicks in the text box and then types the message. I needed something like that once for a video game I was playing, but I could never figure out how to get the position of the cursor relative to the game window so I could only play in Windowed mode.

You're going to want to play around with the SetCursorPos parameters, because I can pretty much guarantee that you won't be clicking at 2150x900.

Code: Select all

# Using code from http://www.daveamenta.com/2013-08/use-powershell-to-automatically-click-a-point-on-the-screen-reapeatedly-auto-clicker/

[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
$csharp_code = @"
    [DllImport("user32.dll")]
    public static extern bool SetCursorPos(int X, int Y);
    [DllImport("user32.dll")]
    public static extern bool GetCursorPos(out System.Drawing.Point pt);
   
    [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
    public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
   
    private const int MOUSEEVENTF_LEFTDOWN = 0x02;
    private const int MOUSEEVENTF_LEFTUP = 0x04;
    private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
    private const int MOUSEEVENTF_RIGHTUP = 0x10;
   
    public static void LeftClick(){
        mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
    }
   
    public static void RightClick(){
        mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
    }
"@
Add-Type -MemberDefinition $csharp_code -Namespace SpotClicker -Name Click -ReferencedAssemblies System.Drawing

$old_position_point = New-Object System.Drawing.Point
[SpotClicker.Click]::GetCursorPos([ref]$old_position_point) | Out-Null
[SpotClicker.Click]::SetCursorPos(2150,900) | Out-Null
[SpotClicker.Click]::LeftClick()
[spotClicker.Click]::SetCursorPos($old_position_point.X, $old_position_point.Y) | Out-Null

Re: Hotkey Script

Posted: 12 May 2017 16:23
by sajjansinghania
ShadowThief Sir,
I wrote at very outset that I have zero knowledge of commuter technology and am a below average user Sir. However, I am a easy learner and am prepared to do whatever you suggest Sir. Therefore, I expect you to explain how to handle the code above.

I frequently log into a Card Game Bridge site http://www.bridgebase.com/client/client.php to play Bridge.
There is a communication window to interact with other players where I type some repetitive messages which are long. They are about 15 in total.
Below I write a few as examples :
Examples :
!H!HJoker Card's Team Match!H!H Welcome all.This is a tensionfree fun table. FAIR PLAY EXPECTED. Zero tolerance for rude behaviour. !H!HPLEASE!H!H ACCEPT CLAIMS & UNDOS for MISCLICKS. Ty
!H!HJoker Card's Team Match!H!H Please check kibitzers on your table. If your friends kibitzing please advise them to stay away from table to protect privacy and FAIR PLAY. If not, they will be ignored in future TMs Ty
!H!HJoker Card's Team Match!H!H !H!HJoker Card!H!H needs to increase # of Boards If you have experience as TD & wish to help kindly Search !H!HJoker Card!H!H on bottom right of your screen & contact !H!HJoker Card!H!H. Ty
I may mention here that !H in above is local conversion to the Heart sign.
Requirement :
Instead of typing out whole text every time I need it, I wish the experts suggest a Cmd oe Vbs script (with hotkey assigned) which helps me to reproduce my messages on this site.

Re: Hotkey Script

Posted: 14 May 2017 19:51
by ShadowThief
Before I start writing something extravagant, are you aware that there is a Chat Manager in the chat box's Option menu where you can store multiple messages that you can send with a single click?

Image
Image
Image

Re: Hotkey Script

Posted: 14 May 2017 22:28
by sajjansinghania
ShadowThief Sir,
I knew from very beginning that dostips.com is a wonderful site for dummies like me, but could never realize I would find such a wonderful and most easy solution for my problem.
I have a feeling you did great homework before you came out with such easy solution finally. I must add, you not only helped me immensely Sir, but proved 1. You are best. 2. Dos still has relevance in this modern world. Experts in Dos still have worth.
Thanks tons once again Sir.

Re: [Solved] Hotkey Script

Posted: 15 May 2017 10:11
by sajjansinghania
Out of my extreme satisafaction, just want to add one.
I am doing as sugested which is 95% of my need but the best part is, before i got thit tip it was 0% now 95%. SHall try t tweak it slowly.
Cheers
:):)