Jump to content
Sign in to follow this  
lazytitan88

First topic and spin...please help

Recommended Posts

lazytitan88

So fairly new to Autoit and trying to teach myself how to use it. Not much of a programmer so can yell at me call me names. Basically i created this spin to just loop through ever 15 secs and depending what X is equal to want it to run a macro i created thats set to certain key strokes.

$X = 0
While $X < 25
    IF $X = 3 or $X = 6 OR $X = 9 OR $X = 12 OR $X = 15 OR $X = 18 OR $X = 21 OR $X = 24 Then
        Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If $X = 6 OR $X = 12 OR $X = 18 OR $X = 24 Then
       Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
    EndIf

    IF $X = 8 OR $X = 16 OR $X = 24 Then
        Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    IF $X = 12 OR $X = 24 Then
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        SLEEP (1000)
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If $X = 24 Then
        $X = 0
    ELSE
        $X = $X + 1
    EndIf
    Sleep (15000)
WEnd

Im not able to get this working right, and im guessing its because of the $X=$X+1 at the end that im doing, guessing cant pass a numeric into a string but i could be WAY off. Either way if someone can tell whats wrong so i can get this to increment $X ever 15 seconds.

Share this post


Link to post
Share on other sites
UEZ

Check your if statements! It seems to be not correct!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
guinness

Plus, $X = $X + 1 can be turned in to $X += 1

I added ConsoleWrite() which works in SciTE to see what is happening to $X and which statement is being Executed. I can't see a problem to be honest, so maybe look at the Send() Functions.

$X = 0
While $X < 25
    If $X = 3 Or $X = 6 Or $X = 9 Or $X = 12 Or $X = 15 Or $X = 18 Or $X = 21 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 1 & $X = " & $X & @CRLF)
    EndIf

    If $X = 6 Or $X = 12 Or $X = 18 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
        ConsoleWrite("If Statement 2 & $X = " & $X & @CRLF)
    EndIf

    If $X = 8 Or $X = 16 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 3 & $X = " & $X & @CRLF)
    EndIf

    If $X = 12 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
;~      Sleep(1000)
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 4 & $X = " & $X & @CRLF)
    EndIf

    If $X = 24 Then
        $X = 0
    Else
        $X += 1
    EndIf
    ConsoleWrite("$X is " & $X & @CRLF)
    Sleep(1000)
WEnd
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
lazytitan88

Plus, $X = $X + 1 can be turned in to $X += 1

I added ConsoleWrite() which works in SciTE to see what is happening to $X and which statement is being Executed. I can't see a problem to be honest, so maybe look at the Send() Functions.

$X = 0
While $X < 25
    If $X = 3 Or $X = 6 Or $X = 9 Or $X = 12 Or $X = 15 Or $X = 18 Or $X = 21 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 1 & $X = " & $X & @CRLF)
    EndIf

    If $X = 6 Or $X = 12 Or $X = 18 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
        ConsoleWrite("If Statement 2 & $X = " & $X & @CRLF)
    EndIf

    If $X = 8 Or $X = 16 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 3 & $X = " & $X & @CRLF)
    EndIf

    If $X = 12 Or $X = 24 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
;~      Sleep(1000)
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 4 & $X = " & $X & @CRLF)
    EndIf

    If $X = 24 Then
        $X = 0
    Else
        $X += 1
    EndIf
    ConsoleWrite("$X is " & $X & @CRLF)
    Sleep(1000)
WEnd

Ok ill redo that part, i used the autoit script writer to do that part so how do i properly use the Send feature? Basically tring to send Shift + Alt + ctrl + 1 with numlock on which i think reads as end but i can change that to be something else. but how do i properly add the keys i want it to activate?

Share this post


Link to post
Share on other sites
guinness

! = Alt / + = Shift / ^ = Ctrl & # = Windows Key >> Look at Send in the Help File and you will see the Remarks Section.

So Shift+Alt+Ctrl+1 is Send("^!+1") or Ctrl+Alt+Shift+1 (doesn't matter about the order)

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
whim

Just noticed the 'IF ORgy' can be reduced to

$X = 0
While $X < 25
    If Mod($X , 3) = 0 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 1 & $X = " & $X & @CRLF)
    EndIf

    If Mod($X , 6) = 0 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
        ConsoleWrite("If Statement 2 & $X = " & $X & @CRLF)
    EndIf

    If Mod($X , 8) = 0 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 3 & $X = " & $X & @CRLF)
    EndIf

    If Mod($X , 12) = 0 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
;~      Sleep(1000)
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 4 & $X = " & $X & @CRLF)
    EndIf

    If $X = 24 Then
        $X = 0
    Else
        $X += 1
    EndIf
    ConsoleWrite("$X is " & $X & @CRLF)
    Sleep(1000)
WEnd
Edited by whim

Share this post


Link to post
Share on other sites
lazytitan88

! = Alt / + = Shift / ^ = Ctrl & # = Windows Key >> Look at Send in the Help File and you will see the Remarks Section.

So Shift+Alt+Ctrl+1 is Send("^!+1") or Ctrl+Alt+Shift+1 (doesn't matter about the order)

Thanks that worked, just had to change up the keys to something else and working great. Thanks for the knowledge on !^+ very useful, also look at the remarks section.

Just noticed the 'IF ORgy' can be reduced to

$X = 0
While $X < 25
    If Mod($X , 3) = 0 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 1 & $X = " & $X & @CRLF)
    EndIf

    If Mod($X , 6) = 0 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
        ConsoleWrite("If Statement 2 & $X = " & $X & @CRLF)
    EndIf

    If Mod($X , 8) = 0 Then
;~      Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 3 & $X = " & $X & @CRLF)
    EndIf

    If Mod($X , 12) = 0 Then
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
;~      Sleep(1000)
;~      Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        ConsoleWrite("If Statement 4 & $X = " & $X & @CRLF)
    EndIf

    If $X = 24 Then
        $X = 0
    Else
        $X += 1
    EndIf
    ConsoleWrite("$X is " & $X & @CRLF)
    Sleep(1000)
WEnd

I dont really understand what you did there looking it over but ill take a look at it.

Share this post


Link to post
Share on other sites
jaberwacky

Here's another improvement:

:)

Global $X = 3

While $X < 25
    Sleep(15000)
    
    If Mod($X , 3) = 0 Then
        Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If Mod($X , 6) = 0 Then
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
    EndIf

    If Mod($X , 8) = 0 Then
        Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If Mod($X , 12) = 0 Then
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        Sleep(1000)
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If $X = 24 Then
        $X = 3
    Else
        $X = $X + 1
    EndIf
WEnd
Edited by jaberwocky6669

Share this post


Link to post
Share on other sites
lazytitan88

Here's another improvement:

:)

Global $X = 3

While $X < 25
    Sleep(15000)
    
    If Mod($X , 3) = 0 Then
        Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If Mod($X , 6) = 0 Then
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{SHIFTUP}{CTRLUP}{ALTUP}")
    EndIf

    If Mod($X , 8) = 0 Then
        Send("{SHIFTDOWN}{ALTDOWN}{CTRLDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If Mod($X , 12) = 0 Then
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
        Sleep(1000)
        Send("{SHIFTDOWN}{CTRLDOWN}{ALTDOWN}{ALTUP}{SHIFTUP}{CTRLUP}")
    EndIf

    If $X = 24 Then
        $X = 3
    Else
        $X = $X + 1
    EndIf
WEnd

could you explain what is you did i dont understand how this is working. what does the global and mod functions that you are doing.

Share this post


Link to post
Share on other sites
jaberwacky

could you explain what is you did i dont understand how this is working. what does the global and mod functions that you are doing.

I tested you. The only thing that matters is that $X begins with 3. :)

Because when $X = 1 or $X = 2 then nothing happens.

When you devide a number by another number you sometimes get a remainder. Modulo is a function that returns only the remainder.

Let's assume that $X = 24 then Mod($X, 12) = 0 because when you devide 24 / 12 then the remainder is 0. Also, Mod(24, 10) = 4 becuase 24/10 = 2 r4

Edited by jaberwocky6669

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.