Jump to content

Stack Overflow move 4 spaces


Go to solution Solved by Docfxit,

Recommended Posts

Posted

I have a script to move text over 4 spaces.  I would like it to work no matter what the title is.

The title changes depending on what you are doing.  The only thing that is the same in all of the pages is "Mozilla Firefox".

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("Edit - Stack Overflow — Mozilla Firefox","")
If Not WinActive("Edit - Stack Overflow — Mozilla Firefox","") Then WinActivate("Edit - Stack Overflow — Mozilla Firefox","")
WinWaitActive("Edit - Stack Overflow — Mozilla Firefox","")
Send("{SPACE}{SPACE}{SPACE}{SPACE}{HOME}{DOWN}{SPACE}{SPACE}{SPACE}{SPACE}{HOME}{DOWN}{SPACE}{SPACE}{SPACE}{SPACE}{HOME}{DOWN}")

 

Posted (edited)

you can make a hotkey for Firefox  when this page is active e.g when you press shift + alt + space to send 4 * space (or whatever else you want)

Edited by ioa747

I know that I know nothing

Posted (edited)

Do you have a link that shows how to make a hotkey?  Or an explanation on how to do it? I can't find it.

Maybe you have an addon like Shortkeys?

Edited by Docfxit
Posted (edited)

simple example

While 1
    If WinActive("Stack Overflow") Then
        HotKeySet("+!{SPACE}", "SpecialSpace") ; Shift-Alt-SPACE
    Else
        HotKeySet("+!{SPACE}") ; unregister
    EndIf

    Sleep(100)
WEnd

Func SpecialSpace()
    Send("{SPACE 4}")
EndFunc   ;==>SpecialSpace

edit:
if the page does not have a fixed title, replace the
If WinActive("Stack Overflow") Then with  If WinActive("CLASS:MozillaWindowClass") Then

Edited by ioa747

I know that I know nothing

Posted

I have tried many different iterations of your code.

I can't get it to work in Firefox.  Have you actually tried it in Firefox?

This is my latest test:

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
HotKeySet('{ESC}', '_Terminate')

While 1
    If WinActive("CLASS:MozillaWindowClass") Then
        HotKeySet("!M", "SpecialSpace") ; Alt+Shift+m
    Else
        HotKeySet("!M") ; unregister
    EndIf

    Sleep(100)
WEnd

Func SpecialSpace()
    Send("{SPACE 4}")
EndFunc   ;==>SpecialSpace

Func _Terminate()
        Exit
EndFunc   ;==>Terminate

 

  • Solution
Posted (edited)

I was able to get it to work with this code:

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
HotKeySet('{ESC}', '_Terminate')

While 1
    If WinActive('[CLASS:MozillaWindowClass]') Then
        HotKeySet("!M", "SpecialSpace") ; Alt+Shift+m
    Else
        HotKeySet("!M") ; unregister
    EndIf

    Sleep(100)
WEnd

Func SpecialSpace()
    Send("{SPACE 4}{HOME}{DOWN}")
EndFunc   ;==>SpecialSpace

Func _Terminate()
        Exit
EndFunc   ;==>Terminate

Thank you,

Edited by Docfxit
Posted (edited)

try this

Opt("WinTitleMatchMode",2)

While 1
    If WinActive("— Mozilla Firefox") Then
        HotKeySet("+{SPACE}", "SpecialSpace") ; Shift-SPACE
    Else
        HotKeySet("+{SPACE}") ; unregister
    EndIf

    Sleep(100)
WEnd

Func SpecialSpace()

    Send("{SPACE 4}")
    Sleep(100)
    Send("{HOME}")
    Sleep(100)
    Send("{DOWN}")
    Sleep(100)
    Send("{ENTER}")
    Sleep(100)
    Send("is working!!")

EndFunc   ;==>SpecialSpace

shift+space

Edited by ioa747

I know that I know nothing

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...