Sign in to follow this  
Followers 0
DevilEvilGod

need help

10 posts in this topic

ok my problem is the script when activated with the pause key goes straigth to the msgbox and does nothing of the rest

here is the code i have :

;Change key delay
Opt("SendKeyDelay", 150)

; Press Esc to terminate script, Pause/Break to "pause"
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
Global $i = 0

Global $Loop = 10 ;Change loop count
Global $Family = 44 ;Change Family #
Global $Supply = 0 ;Change # of Supplyer

; Body of program would go here
While 1
    Sleep(100)
WEnd

Func TogglePause()
    $Paused = NOT $Paused
        While $Paused
            If $i = $Loop Then
            Send ("{CTRLDOWN}c{CTRLUP}")
            Send ("{ALTDOWN}{TAB}{ALTUP}")
            Send ("{CTRLDOWN}v{CTRLUP}")

                If $Supply = 0 Then
                Send ("{ENTER 14}")
                Else
                Send ("{ENTER 13}")
                Send ($Supply)
                Send ("{ENTER}")
                EndIf

            Send ($Family)
            Send ("{PGDN}")
            Send ("{ALTDOWN}s{ALTUP}")
            Send ("{ALTDOWN}{TAB}{ALTUP}")
            Send ("{DOWN}")
            $i = $i+1
            Else
            Send ("{PAUSE}")
            MsgBox(0 , "Finish" , "Loops Ended.")
            EndIf
        WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

as i understand the problem is at line 22 ( If $i = $Loop Then ) but of course im not sure i searched forum, help, and all i can think of so this is my last resort

thanks for any help provided

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

As you said line 22

I dont have puase key in my pc... (laptop)

But I think you should change line 22 to

If $i < $Loop Then

P.S you should check For...To...Step...Next

Edited by oren

Share this post


Link to post
Share on other sites

thank you so much that solve it....

im such a noob by not trying others operators...

i tried the for..to..step..next but i think for msgbox to work as i intended the if... else works better (might be wrong tho)

any suggestion on how to better the code is welcome :huh2:

once again thanks oren

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Opt("SendKeyDelay", 150) ;Change key delay

; Press Esc to terminate script, Pause/Break to "pause"
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
Global $i = 0

Global $Loop = IniRead ( "custom.ini", "Default", "Loop", 0 )
Global $Family = IniRead ( "custom.ini", "Default", "Family", 0 )
Global $Supply = IniRead ( "custom.ini", "Default", "Supply", 0 )

; Body of program would go here
While 1
    Sleep(100)
WEnd

Func TogglePause()
    If @error Then 
    MsgBox(4096, "", "Error occurred, probably no INI file.")
    Else
    $Paused = NOT $Paused
        While $Paused
            If $i < $Loop Then
            Send ("{CTRLDOWN}c{CTRLUP}")
            Send ("{ALTDOWN}{TAB}{ALTUP}")
            Send ("{CTRLDOWN}v{CTRLUP}")
                If $Supply = 0 Then
                Send ("{ENTER 14}")
                Else
                Send ("{ENTER 13}")
                Send ($Supply)
                Send ("{ENTER}")
                EndIf
            Send ($Family)
            Send ("{PGDN}")
            Send ("{ALTDOWN}s{ALTUP}")
            Send ("{ALTDOWN}{TAB}{ALTUP}")
            Send ("{DOWN}")
            $i = $i+1
            Else
            Send ("{PAUSE}")
            MsgBox(0 , "Finish" , "Loops Ended.")
            EndIf
        WEnd
    EndIf
EndFunc

Func Terminate()
    Exit 0
EndFunc

ini file contains

custom.ini:

[Default]

Loop=100

Family=44

Supply=0

update code so it uses a ini file on the same dir as the script posted so it might help others

any suggestions on make a better codding welcome

thx all

Edited by DevilEvilGod

Share this post


Link to post
Share on other sites

Just wrote this minutes ago!

Might help witht he ini file, but i dont know.


[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

btw anyone kwons any method of cheking a value in clipboard?

ex. 1 , copy , check if clipboard = 1

thx

Share this post


Link to post
Share on other sites

thx zedna that helpd :huh2:

now a question is this possible?

If $Name <> 0 Then ;for product name
                Alt_Tab()
                Send ("{RIGHT}")
                Copy()
                Send ("{LEFT}")
                Alt_Tab()
                    $varname = ClipGet()
                    Sel_All()
                    Copy()
                    If ClipGet() = "" Then
                        send($varname)
                        send ("{ENTER 2}")
                        Send($varname)
                        Send ("{ENTER}")
                    Else
                        Send ("{ENTER 3}")
                    EndIf
            Else
                Send ("{ENTER 3}")
            EndIf

the $vars are:

$Name=1

and the functons do their name ex Alt_Tab() = a function that sends " Send ("{ALTDOWN}{TAB}{ALTUP}") "

so my question is can one add a var with the clipget() function then replace whats on clipboard and still use the valu of that var u added?

thx for any help

Share this post


Link to post
Share on other sites

ty zedna

btw i do search the help file/forum but sometimes i cant find what i am looking for and lack the correct term to search due to language barrier

sry if my questions are basic/simple/stupid but i just need a pointer then im off to look in help/forum how it works

still i guess you are right on the invest time, thx again for the ClipPut()

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  
Followers 0