Jump to content



Photo

Conversion From String "" To Type Integer Is Not Valid


  • Please log in to reply
6 replies to this topic

#1 unibotsi

unibotsi

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 02 December 2019 - 06:23 AM

While I was working on my project and running some test, suddently I get the message "conversion from string "" to type Integer is not valid" What does it mean?

 

 

I think it has to do with the first loop. If I set a fixed number into the loop, instead of using a variable number coming from a UI textbox, its working. Whats wrong here?

 

 

This is my code:

 

ui open file("Textfile mit Keywords",#importedkeywords)
ui save file("Save Path",#savepathset)
ui text box("Position SV (Ombros = 27; Pilhar = 28)",#positionsvvarable)
ui text box("Number of Loops",#numberofloops)
add list to list(%keywords2check,$list from file(#importedkeywords),"Don\'t Delete","Global")
loop(#numberofloops) {
    set(#keywords2checkfirstkwinlist,$list item(%keywords2check,0),"Global")
    divider
    remove from list(%keywords2check,0)
    change attribute(<outerhtml=w"<input autocapitalize=\"none\" class=\"mg-searchform-s uk-width-medium-1-3 font-14\" maxlength=\"100\" minlength=\"2\" placeholder=\"Enter keyword\" required=\"\" spellcheck=\"false\" type=\"text\" value=\"*\">">,"value",$nothing)
    type text(<outerhtml=w"<input autocapitalize=\"none\" class=\"mg-searchform-s uk-width-medium-1-3 font-14\" maxlength=\"100\" minlength=\"2\" placeholder=\"Enter keyword\" required=\"\" spellcheck=\"false\" type=\"text\" value=\"*\">">,#keywords2checkfirstkwinlist,"Standard")
    wait(5)
    click(<type="submit">,"Left Click","No")
    wait(10)
    divider
    add item to list(%keyword,$scrape attribute(<outerhtml=w"<strong class=\"mg-truncate\">*</strong>">,"innertext"),"Don\'t Delete","Global")
    add list to table as column(&data,0,0,%keyword)
    divider
    set(#SV,$scrape attribute($element offset(<tagname="span">,#positionsvvarable),"innertext"),"Global")
    set(#SV,$replace(#SV,",",""),"Global")
    add item to list(%SV,#SV,"Don\'t Delete","Global")
    add list to table as column(&data,0,1,%SV)
    divider
    add item to list(%country,$scrape attribute(<outerhtml=w"<span class=\"mg-margin-r-15\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"map-marker-alt\" class=\"svg-inline--fa fa-map-marker-alt fa-w-12 mg-margin-r-5\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\"viewBox=\"0 0 384 512\"><path fill=\"currentColor\" d=\"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z\"></path></svg> *</span>">,"innertext"),"Don\'t Delete","Global")
    add list to table as column(&data,0,2,%country)
    divider
    add item to list(%language,$scrape attribute($element offset(<class="rw-input">,1),"innertext"),"Don\'t Delete","Global")
    add list to table as column(&data,0,3,%language)
    divider
    divider
    add item to list(%rightframenumberchek,$scrape attribute(<class="mg-results-td is-id uk-flex uk-flex-middle uk-flex-right">,"innertext"),"Don\'t Delete","Global")
    if($contains(%rightframenumberchek,9)) {
        then {
        }
        else {
            click(<class="mg-btn is-link is-xsmall uk-width-1-1 font-14">,"Left Click","No")
        }
    }
    add list to list(%LPSALL,$scrape attribute(<class=w"mg-results-td is-seo">,"innertext"),"Don\'t Delete","Global")
    divider
    set(#LPS1,$list item(%LPSALL,0),"Global")
    set(#LPS2,$list item(%LPSALL,1),"Global")
    set(#LPS3,$list item(%LPSALL,2),"Global")
    set(#LPS4,$list item(%LPSALL,3),"Global")
    set(#LPS5,$list item(%LPSALL,4),"Global")
    set(#LPS6,$list item(%LPSALL,5),"Global")
    set(#LPS7,$list item(%LPSALL,6),"Global")
    set(#LPS8,$list item(%LPSALL,7),"Global")
    set(#LPS9,$list item(%LPSALL,8),"Global")
    set(#LPS10,$list item(%LPSALL,9),"Global")
    add item to list(%LPS1,#LPS1,"Don\'t Delete","Global")
    add item to list(%LPS2,#LPS2,"Don\'t Delete","Global")
    add item to list(%LPS3,#LPS3,"Don\'t Delete","Global")
    add item to list(%LPS4,#LPS4,"Don\'t Delete","Global")
    add item to list(%LPS5,#LPS5,"Don\'t Delete","Global")
    add item to list(%LPS6,#LPS6,"Don\'t Delete","Global")
    add item to list(%LPS7,#LPS7,"Don\'t Delete","Global")
    add item to list(%LPS8,#LPS8,"Don\'t Delete","Global")
    add item to list(%LPS9,#LPS9,"Don\'t Delete","Global")
    add item to list(%LPS10,#LPS10,"Don\'t Delete","Global")
    add list to table as column(&data,0,4,%LPS1)
    add list to table as column(&data,0,5,%LPS2)
    add list to table as column(&data,0,6,%LPS3)
    add list to table as column(&data,0,7,%LPS4)
    add list to table as column(&data,0,8,%LPS5)
    add list to table as column(&data,0,9,%LPS6)
    add list to table as column(&data,0,10,%LPS7)
    add list to table as column(&data,0,11,%LPS8)
    add list to table as column(&data,0,12,%LPS9)
    add list to table as column(&data,0,13,%LPS10)
    divider
    divider
    add item to list(%SEODIFF,$scrape attribute($element offset(<class="mg-rank yellow">,0),"innertext"),"Don\'t Delete","Global")
    add list to table as column(&data,0,14,%SEODIFF)
    divider
    add list to list(%cpc,$scrape attribute(<outerhtml=w"<span>$*</span>">,"innertext"),"Delete","Global")
    set(#cpc,$list item(%cpc,0),"Global")
    set(#cpc,$replace(#cpc,"$",""),"Global")
    set(#cpc,$replace(#cpc,".",","),"Global")
    add item to list(%cpcfirstvalue,#cpc,"Don\'t Delete","Global")
    add list to table as column(&data,0,15,%cpcfirstvalue)
    divider
    add list to list(%cpc,$scrape attribute(<outerhtml=w"<span>$*</span>">,"innertext"),"Delete","Global")
    add list to list(%comp,$scrape attribute(<outerhtml=w"<span>*</span>">,"innertext"),"Delete","Global")
    set(#first_item_PPC,$list item(%comp,11),"Global")
    add item to list(%compfirstvalue,#first_item_PPC,"Don\'t Delete","Global")
    add list to table as column(&data,0,16,%compfirstvalue)
    divider
    divider
    save to file(#savepathset,&data)
    clear list(%LPSALL)
    clear list(%cpc)
    clear list(%comp)
}



#2 UBotBuddy

UBotBuddy

    UBot Studio Training

  • ADMIN
  • 3537 posts
  • LocationVirginia
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 02 December 2019 - 05:51 PM

When the error appears check to see if that variable has a non-numeric character in it.  That could trigger that issue.

 

Buddy


UBot Training for FREE! Yes, that is correct!

#3 pash

pash

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 3403 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 02 December 2019 - 07:10 PM

Normally, Ubot will convert String and Number automatically.
But when this occurs, restart ubot.

New Plugin:: Advanced Facebook | Advanced Connection | Advanced Twitter | Advanced Email | Advanced PowerPoint
- Advanced Data Text File | Advanced DateTime | Advanced Dialog | Advanced Document | Advanced Google Blogger V3 | Advanced Google Drive | Advanced Google YouTube V3 | Advanced Image | Advanced Video | Advanced Screen and Windows | Advanced Systems | Advanced Ubot 1 | Advanced Ubot 2 | Advanced WordPress | Advanced Connection | Advanced Twitter | Advanced Email | Advanced PowerPoint

- Advanced Captcha (V3) | Advanced Captcha (V2) (Old) | Create Table From Excel (Lite) | Check Conection | Ubot Enter License | Auto Free Memory
- Working hours GMT+7. i regret sometimes the answer is delayed due to health problems.


#4 unibotsi

unibotsi

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 02 December 2019 - 07:29 PM

My input is a symple 1 as a number of course. Since 2 days I`m also having problems to run my already compiled bots (who worked before). For me it looks like I`m facing the same UI problem, described here: http://network.ubots...-ubot-ui-crash/

 

I`ve tried to perform the steps described in the video of this thread, but since my system language is german and not english, I can`t find the same websites which are showing up in that video.

 

Any other solutions or fixes for this? Can we hope for a fix from the developer for it?



#5 unibotsi

unibotsi

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 03 December 2019 - 12:29 AM

I`ve managed to remove the latest .net update from my system, but the problem still exists. Its defenitely caused by the values numbers from the UI TEXTBOXES

 

Does anybody else having this problem? I have it on 2 different computers (windows 7 and windows 10).

 

It`s making me crazy because from one secound to the other everything stoped working correctly (on both computers) and I have no idea why.

 

The only thing I found out is, that if I replace the numbers comming from the UI TEXTBOXES in the source code by real numbers, its working again....



#6 UBotBuddy

UBotBuddy

    UBot Studio Training

  • ADMIN
  • 3537 posts
  • LocationVirginia
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 03 December 2019 - 11:12 AM

Have you tried placing your variable in a $trim function?  What about confirming the text length of the variable to ensure there are no invisible characters?

 

Buddy


UBot Training for FREE! Yes, that is correct!

#7 HelloInsomnia

HelloInsomnia

    Advanced Member

  • Moderators
  • 3222 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 05 December 2019 - 02:58 PM

is the variable set in the debugger?

 

This error happens when you put an empty string in the number of cycles for loop.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users