skip to Main Content

I am working a lot with SEO so I made myself a shortcut for quickly checking on websites, issue is for some reason the second IF statement inside the function is not working properly ( if I type in "seo" it asks me for the domain I want to check and runs properly, but if I type in "whois" the Inputbox does not pop and it jumps straight to the whois.domaintools.com website ( without the URL extension )

here is the code I made so far

collectAction(){
InputBox, userAction, ,Which action would you like to perform?, , 300, 120, ,, Arial,
if(userAction="seo")
    InputBox, seoUrl, ,Please enter the domain you want to check., , 300, 120, ,, Arial,
    Run, https://freetools.seobility.net/en/seocheck/check?url=https`%3A`%2F`%2Fwww.%seoUrl%`%2F&crawltype=1
    return
if(userAction="whois")
    InputBox, whoisUrl, ,Please enter the domain you want to check., , 300, 120, ,, Arial,
    Run, https://whois.domaintools.com/%whoisUrl%
    return          
}

thanks in advance!
p.s if this info has any impact on the process i am calling this function with a hotkey (F1)

2

Answers


  1. changing two consecutive if statemets to if – else works

    collectAction(){
    
    InputBox, userAction, ,Which action would you like to perform?, , 300, 130, ,, ,
    if(userAction="seo") {
        InputBox, seoUrl, ,Please enter the domain you want to check., , 300, 120, ,, ,
        Run, https://freetools.seobility.net/en/seocheck/check?url=https`%3A`%2F`%2Fwww.%seoUrl%`%2F&crawltype=1
        return
    }
    else if(userAction="whois") {
        InputBox, whoisUrl, ,Please enter the domain you want to check., , 300, 120, ,, ,
        Run, https://whois.domaintools.com/%whoisUrl%
        return          
        }
    }
    
    

    function call example:

    F1::
    collectAction()
    return
    
    Login or Signup to reply.
  2. You need to wrap the commands in the if clause between {} block

        collectAction(){
        InputBox, userAction, ,Which action would you like to perform?, , 300, 120, ,, Arial,
        if(userAction="seo") {
            InputBox, seoUrl, ,Please enter the domain you want to check., , 300, 120, ,, Arial,
            Run, https://freetools.seobility.net/en/seocheck/check?url=https`%3A`%2F`%2Fwww.%seoUrl%`%2F&crawltype=1
            return
        } ; end if 
        if(userAction="whois") {
            InputBox, whoisUrl, ,Please enter the domain you want to check., , 300, 120, ,, Arial,
            Run, https://whois.domaintools.com/%whoisUrl%
            return          
        } ; end of if
        } ; end of function
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search