Jump to content

First Scripts


IcantCodeHelp
 Share

Recommended Posts

Here's my first actual script I made my next step is making it into a GUI

Global $start
HotKeySet("{ESC}", "Start_Up")
HotKeySet("{1}", "Stop_Now")

While 1
    if $start==True Then
        Send("Start and Stop works")
        Sleep(1000)
    EndIf
    ToolTip("")
    Sleep ("")
WEnd

Func Start_Up()
    $start = True
    ;Return $start
EndFunc

Func Stop_Now()
    $start = False
EndFunc


Its really simple hopefully it helps on lookers

Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

IcantCodeHelp,

When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

22 hours ago, IcantCodeHelp said:

Here's my first actual script I made my next step is making it into a GUI

Global $start
HotKeySet("{ESC}", "Start_Up")
HotKeySet("{1}", "Stop_Now")

While 1
    if $start==True Then
        Send("Start and Stop works")
        Sleep(1000)
    EndIf
    ToolTip("")
    Sleep ("")
WEnd

Func Start_Up()
    $start = True
    ;Return $start
EndFunc

Func Stop_Now()
    $start = False
EndFunc


Its really simple hopefully it helps on lookers

Start_Up()

Edited by JockoDundee
Modified my function call

Code hard, but don’t hard code...

Link to comment
Share on other sites

16 hours ago, IcantCodeHelp said:good thing it was in 2020 its 2021 now 
 

Maybe I can make it up to you.  
Since your being gracious enough to put your code out there for others, let me help as well by pointing out a few things about the code you posted.  

Global $start
HotKeySet("{ESC}", "Start_Up")
HotKeySet("{1}", "Stop_Now")

While 1
    if $start==True Then ; == is useful when comparing strings with mixed case, in this case = works fine
                         ; or just If $start Then
        Send("Start and Stop works")  ; Send where? - this could be dangerous
        Sleep(1000)                   ; also be careful when using Send at the same time as Hotkeyset
                                      ; strange interactions can occur
    EndIf
    ToolTip("") ; Doesn't do anything here
    
    Sleep ("")  ; "" evaluates to 0, so also not useful - if this was meant to slow down the loop it
                ; wont work use an integer with a nominal magnitude
WEnd

Func Start_Up()
    $start = True
    ;Return $start
EndFunc

Func Stop_Now()
    $start = False
EndFunc

Regarding the Send and Autohotkey interaction, see what happens if you change your message to “Start and Stop works 1 time”.

G’day :)

Code hard, but don’t hard code...

Link to comment
Share on other sites

2 hours ago, JockoDundee said:

Maybe I can make it up to you.  
Since your being gracious enough to put your code out there for others, let me help as well by pointing out a few things about the code you posted.  

Global $start
HotKeySet("{ESC}", "Start_Up")
HotKeySet("{1}", "Stop_Now")

While 1
    if $start==True Then ; == is useful when comparing strings with mixed case, in this case = works fine
                         ; or just If $start Then
        Send("Start and Stop works")  ; Send where? - this could be dangerous
        Sleep(1000)                   ; also be careful when using Send at the same time as Hotkeyset
                                      ; strange interactions can occur
    EndIf
    ToolTip("") ; Doesn't do anything here
    
    Sleep ("")  ; "" evaluates to 0, so also not useful - if this was meant to slow down the loop it
                ; wont work use an integer with a nominal magnitude
WEnd

Func Start_Up()
    $start = True
    ;Return $start
EndFunc

Func Stop_Now()
    $start = False
EndFunc

Regarding the Send and Autohotkey interaction, see what happens if you change your message to “Start and Stop works 1 time”.

G’day :)

Thank I took note to this and im working on another now
and == is from another language i was learning 

Edited by IcantCodeHelp
Link to comment
Share on other sites

Through trial and error and reading the scripts presented to me I've made a new simple script 

Global $TheText = InputBox("Hi its me", "Paste sleep time below", "")
While 1
ToolTip("You Can change my sleep time through input")
Sleep($TheText)
WEnd

For any on lookers or anyone new to programming my issue was not slowing down take your time

Link to comment
Share on other sites

  • Melba23 changed the title to First Scripts
  • Moderators

IcantCodeHelp,

I have moved your post 2 above from Chat and merged it with this thread as Chat is NOT for AutoIt coding threads. I suggest that from now on you keep all your code snippets in this thread - if you post them elsewhere they are likely to disappear.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

9 hours ago, Melba23 said:

IcantCodeHelp,

I have moved your post 2 above from Chat and merged it with this thread as Chat is NOT for AutoIt coding threads. I suggest that from now on you keep all your code snippets in this thread - if you post them elsewhere they are likely to disappear.

M23

Oh ok didnt understand it

Link to comment
Share on other sites

  • Moderators
6 hours ago, IcantCodeHelp said:

Oh ok didnt understand it

That seems to be a real issue with you. I believe you have been spoken to by everyone on the Mod staff now; not sure how we can explain things any more simply to you.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...