Results 1 to 6 of 6

If statement

This is a discussion on If statement within the AutoHotKey Help/Training forums, part of the General/Help category; I am trying to write an if statement I have only done this once an it was 2yrs ago here ...

  1. #1
    Houdini's Avatar
    Houdini is offline Subscriber
    Join Date
    Apr 2008
    Posts
    547

    Default If statement

    I am trying to write an if statement
    I have only done this once an it was 2yrs ago
    here is where i am reading from which is not making sense yet
    it seems simple all i want it to do is check each link an compare with last link
    http://www.autohotkey.com/docs/commands/IfEqual.htm
    Code:
    IniWrite, %Link%,  num.ini, Url, %hh%<----this is newly found link
    IniRead, Link2,  num.ini, Got, %hf%<----this is last link
    IfEqual, Link, %link2% (same: if var = value) 
    
    COM_Invoke(pwb, "Navigate", Link)<----this is excuting the link
    IniWrite, %Link%,  num.ini, Got, %hf%<---this one keeps track of links clicked

    As I click my 2 terabyte hard drives together and say to myself "Theres no place like 192.285.10.09"

  2.   Alt These ads help cover server costs and such.


  3. #2
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default

    IfEqual, var, value

    IfEqual, Link, link2

    Though I do not know if you can use a variable for the value...But maybe... I have no idea what your trying to do...

  4. #3
    Houdini's Avatar
    Houdini is offline Subscriber
    Join Date
    Apr 2008
    Posts
    547

    Default

    compare 2 links to see if there the same
    Code:
    IniWrite, %Link%, %A_WorkingDir%\num.ini, Url, %hh%
    IniRead, Link2, %A_WorkingDir%\num.ini, Got, %hf% 
    
    If  %Link% = %link2%  
    {
        Goto, Start
            Return
    }
    COM_Invoke(pwb, "Navigate", Link)
    IniWrite, %Link%, %A_WorkingDir%\links.ini, Got, %hf%

    As I click my 2 terabyte hard drives together and say to myself "Theres no place like 192.285.10.09"

  5. #4
    Houdini's Avatar
    Houdini is offline Subscriber
    Join Date
    Apr 2008
    Posts
    547

    Default

    if Var in MatchList
    if Var not in MatchList
    if Var contains MatchList
    if Var not contains MatchList
    http://www.autohotkey.com/docs/commands/IfIn.htm
    maybe one of these will help me out

    Because the items in MatchList are not treated as individual parameters, the list can be contained entirely within a variable. In fact, all or part of it must be contained in a variable if its length exceeds 16383 since that is the maximum length of any script line. For example, MatchList might consist of %List1%,%List2%,%List3% -- where each of the sublists contains a large list of match phrases.


    Examples

    if var in exe,bat,com <--from there examples
    MsgBox The file extension is an executable type.

    if %Link% in Url.exe <---this is my code i just wrote from there example
    {
    Goto, Start
    Return
    }
    if link not found excute Rest of script
    would i need else statement
    Last edited by Houdini; 01-13-2011 at 12:44 PM.

    As I click my 2 terabyte hard drives together and say to myself "Theres no place like 192.285.10.09"

  6. #5
    soccer18soccer18 is offline Subscriber
    Join Date
    Jul 2009
    Posts
    434

    Default

    If link = %varcontaininglinkyouwant%
    {
    goto....
    }

  7. #6
    Houdini's Avatar
    Houdini is offline Subscriber
    Join Date
    Apr 2008
    Posts
    547

    Default

    Code:
    if %Link% in url.txt
    { Goto, Start 
    Return 
    } 
    else 
    { 
    COM_Invoke(pwb, "Navigate", Link)
    IniWrite, %Link%, %A_WorkingDir%\links.ini, Got, %hf%
    hf += 1
    hh += 1
    Sleep, 10000}
    thanks to precise

    As I click my 2 terabyte hard drives together and say to myself "Theres no place like 192.285.10.09"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Facebook Bots | Admin Forum