Jump to content
Sign in to follow this  
martinno

Newbie needs help in creating of script

Recommended Posts

martinno

Hello!

I'am new ( noob ;) ) to AutoIt and scripts in general, but found that AutoIt is one of the best choises...

Have spent some few hours reading manuals, but havent get even one step closer to what I need.

I hope, You can help me.

Need script that runs in background and starts keystroke.

What I need: when I press Enter, hotkey is launched and it launches RIGHT and after that F2.

It would be excellent, if script could be enabled/disabled by CapsLock button.

Hoping in Your help.

Thanks.

Martin.

Share this post


Link to post
Share on other sites
someone

Welcome to the forum. Lookup hotkeyset, and loops in the manual. That will get you started. If you get stuck, post the code you have and we will be more then happy to help.

Also please forgive me if I'm off base...but this is NOT for a game correct?


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites
martinno

Thanks, will check it out.

No it's not for the game ;) It's for job. Need to automate some processes.

Share this post


Link to post
Share on other sites
martinno

Wrote this reading manuals... it doesnt work...

HotKeySet("{CAPSLOCK}", "TogglePause")
HotKeySet("{ENTER}", "Scan")
While 1
    Sleep(100)
WEnd
Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is"Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc
Func Scan()
    HotKeySet("{ENTER}")
SLEEP (1000)
    Send("{RIGHT}")
SLEEP (1000)
Send("{F2}")
HotKeySet("{ENTER}", "Scan")
EndFunc

Share this post


Link to post
Share on other sites
someone

Running this script you get a warning and error from Scite. You can fix that, also, can you be more specific about what doesn't work? And what doesn't work means?


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites
Melba23

martinno,

Welcome to the AutoIt forum. ;)

Here you go - see if this works for you: :)

HotKeySet("{CAPSLOCK}", "_Toggle")
HotKeySet("{ENTER}", "_Scan")
HotKeySet("{ESC}", "_Exit")

; Declare Global flag set to True
Global $fToggle = True
ConsoleWrite("Enabled" & @CRLF) ; Just for example

While 1
    Sleep(10)
WEnd

Func _Toggle()

    $fToggle = Not $fToggle
    ; Just for example
    Switch $fToggle
        Case True
            ConsoleWrite("Enabled" & @CRLF)
        Case False
            ConsoleWrite("Disabled" & @CRLF)
    EndSwitch
    ; End of example

EndFunc

Func _Scan()

    If $fToggle Then
        ConsoleWrite("Sending" & @CRLF) ; Just for example
        ;Send("{RIGHT}")
        ;Sleep(1000)
        ;Send("{F2}")
    EndIf

EndFunc

Func _Exit()
    Exit
EndFunc

Please ask if you have any questions. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
martinno

Yes - i get warning when trying to pause script. OK, it's not the main problem - it can run all the time.

It works, but not as I want - I need to hold ENTER key for a while, to run this script - short ENTER don't run it.

How can I fix it?

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×