Weird string/integer bug.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Knoore
Junior Coder
Posts: 28
Joined: Fri Oct 20, 2006 8:30 am

Weird string/integer bug.

Post by Knoore » Wed Jan 03, 2007 9:24 pm

When running this script I recieve the following errors
"Invalid parameters to ROUND"
"Cannot read String as Float"

Code: Select all

Let>x=1
Let>pgdwn=0
Let>clicks=0
Let>clicks={%x%*250}
Let>pgdwn={%clicks%/30}
Let>pgdwn={round(%pgdwn%)}
Let>pgdwn={%pgdwn%-1}
mousemove>560,210
wait>0.001
Lclick
wait>0.001
Let>k=0
Repeat>k
  Wait>0.001
  Press Page Down
  Let>k=k+1
Until>k,pgdwn
Let>pgdwn={pgdwn*30}
Let>clicks={clicks-pgdwn}
Mousemove>1260,760
Let>k=0
Repeat>k
  Wait>0.001
  Lclick
  Let>k=k+1
Until>k,clicks

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jan 03, 2007 9:35 pm

That script works ok for me. Is this the actual code?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Knoore
Junior Coder
Posts: 28
Joined: Fri Oct 20, 2006 8:30 am

Post by Knoore » Wed Jan 03, 2007 9:39 pm

Hmm it doesnt work for me, if i create a new macro and copy above stuff in it, then it gives the error.

Doesnt work in Version 8 and Vesion 9, havent tested older versions.
I think its because decimal numbers have a , and not a .
gonna try to change my windows settings now.

Its all part of this script:

Code: Select all

//Select 240,210
//Scroll Down 1260,760
//Right click 560,210
//Overnemen naar mijn gids 600,280

Let>APP_TITLE=Adressen By Knoore
Let>INPUT_BROWSE=0
Let>nt=C:\Nationale telefoongids\ggids.exe
Let>dir=C:\Documents and Settings\AMD 3200\Desktop\Adressen1250\
CreateDir>dir
Let>probook=C:\Documents and Settings\AMD 3200\My Documents\GGIDS\PROBOOK.PAB
Let>x=1
Let>pgdwn=0
Let>clicks=0
//Set messages
Let>msg_wp=The password you entered was incorrect.%CRLF%The upload bot will now be closed.
Let>msg_finished=The Adressen Bot is finished.%CRLF%The bot will now be closed.
Let>msg_stop=Tank you for using Adressen Bot.%CRLF%The bot will now be closed.
Let>msg_about=This bot has been written by Jeroen Knooren.%CRLF%This bot is written to automate copying adresses.%CRLF%In case you found any errors in this bot; contact me at [email protected].
Let>msg_nt=ggids.exe hasnt been found.%CRLF%Nationale telefoongids needs to be installed in:%CRLF%%nt%%CRLF%The bot will now be closed.

//Enter Password
Let>INPUT_PASSWORD=1
Input>pw,Please enter the password.
Let>INPUT_PASSWORD=0
If>pw<Knoore>%msg_wp%
  Goto>stop
Endif

iffileexists>%nt%
  gosub>main
else
  MessageModal>%msg_nt%
  Goto>stop
Endif


SRT>main
  Let>l=0
  Repeat>l
    Gosub>restart
    Let>m=0
    Repeat>m
      Gosub>tomijngids
      Let>m=m+1
    Until>m,10
  Let>l=l+1
  Until>l,77
END>main

SRT>restart
  Ifwindowopen>Nationale telefoongids*
    CloseWindow>Nationale telefoongids*
  Endif
  Let>y=x
  Length>y,leny
  If>leny<3>y=0%y%
    If>leny<2>y=0%y%
    Endif
  Endif
  Let>newfilename=%dir%nml Deel %y%.xls
  Del>newfilename
  CopyFile>probook,newfilename
  Del>probook
  Run>%nt%
  Wait>10
  Press Tab*2
  Wait>0.001
  Press Down*17
  Wait>0.001
  Let>clicks={%x%*250}
  if>clicks<0>pgdwn={%clicks%/30}
      Let>pgdwn={round(%pgdwn%)}
    Let>pgdwn={%pgdwn%-1}
    mousemove>560,210
    wait>0.001
    Lclick
    wait>0.001
    Let>k=0
    Repeat>k
      Wait>0.001
      Press Page Down
      Let>k=k+1
    Until>k,pgdwn
    Let>pgdwn={pgdwn*30}
    Let>clicks={clicks-pgdwn}
    Mousemove>1260,760
      Let>k=0
    Repeat>k
      Wait>0.001
      Lclick
      Let>k=k+1
    Until>k,clicks
  Endif
  Wait>0.001
  Let>x=x+1
END>restart

SRT>tomijngids
  Wait>0.001
  Let>k=0
  Repeat>k
    Wait>0.001
    Mousemove>240,210
    Wait>0.001
    Lclick
    Wait>0.001
    Mousemove>1260,760
    Wait>0.001
    Lclick
    Let>k=k+1
  Until>k,25
  Wait>0.001
  Mousemove>560,210
  Wait>0.001
  Rclick
  Wait>0.01
  Mousemove>600,280
  Wait>0.001
  Lclick
  Wait>0.01
  Press Enter
  Wait>0.001
  Lclick
  Wait>0.001
  Press Alt
  Wait>0.001
  Release Alt
  Wait>0.001
  Press Right*2
  Wait>0.001
  Press Down*9
  Wait>0.001
  Press Enter
  Wait>0.001
END>tomijngids


SRT>about
  MessageModal>%msg_about%
  Gosub>dialog1
END>about

SRT>stop
  MessageModal>%msg_stop%
  Goto>stop
END>stop

Label>stop
Last edited by Knoore on Wed Jan 03, 2007 9:48 pm, edited 1 time in total.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Wed Jan 03, 2007 9:48 pm

If I replace:

Let>pgdwn={pgdwn*30}
Let>clicks={clicks-pgdwn}

with:

Let>pgdwn=pgdwn*30
Let>clicks=clicks-pgdwn

Then the code works for me. With the brackets I get an Unknown Identifier error.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jan 03, 2007 9:49 pm

Yeh, 'cos with the brackets you'd need:

Let>pgdwn={%pgdwn%*30}
Let>clicks={%clicks%-%pgdwn%}
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Knoore
Junior Coder
Posts: 28
Joined: Fri Oct 20, 2006 8:30 am

Post by Knoore » Wed Jan 03, 2007 9:52 pm

This works perfect with english settings, but I'm Dutch so I selected Dutch language in Windows... This results in the decimal sign being a , and not a . therefor it goes wrong with the round() maybe a good idea to fix this bug.
Dunno if it also happens to other math functions, but i guess it does.
Just make it replace the , with a . incase its a comma.

Code: Select all

//Select 240,210
//Scroll Down 1260,760
//Right click 560,210
//Overnemen naar mijn gids 600,280

Let>APP_TITLE=Adressen By Knoore
Let>INPUT_BROWSE=0
Let>nt=C:\Nationale telefoongids\ggids.exe
Let>dir=C:\Documents and Settings\AMD 3200\Desktop\Adressen1250\
CreateDir>dir
Let>probook=C:\Documents and Settings\AMD 3200\My Documents\GGIDS\PROBOOK.PAB
Let>x=1
Let>pgdwn=0
Let>clicks=0
//Set messages
Let>msg_wp=The password you entered was incorrect.%CRLF%The upload bot will now be closed.
Let>msg_finished=The Adressen Bot is finished.%CRLF%The bot will now be closed.
Let>msg_stop=Tank you for using Adressen Bot.%CRLF%The bot will now be closed.
Let>msg_about=This bot has been written by Jeroen Knooren.%CRLF%This bot is written to automate copying adresses.%CRLF%In case you found any errors in this bot; contact me at [email protected].
Let>msg_nt=ggids.exe hasnt been found.%CRLF%Nationale telefoongids needs to be installed in:%CRLF%%nt%%CRLF%The bot will now be closed.

//Enter Password
Let>INPUT_PASSWORD=1
Input>pw,Please enter the password.
Let>INPUT_PASSWORD=0
If>pw<Knoore>%msg_wp%
  Goto>stop
Endif

iffileexists>%nt%
  gosub>main
else
  MessageModal>%msg_nt%
  Goto>stop
Endif


SRT>main
  Let>l=0
  Repeat>l
    Gosub>restart
    Let>m=0
    Repeat>m
      Gosub>tomijngids
      Let>m=m+1
    Until>m,10
  Let>l=l+1
  Until>l,77
END>main

SRT>restart
  Ifwindowopen>Nationale telefoongids*
    CloseWindow>Nationale telefoongids*
  Endif
  Let>y=x
  Length>y,leny
  If>leny<3>y=0%y%
    If>leny<2>y=0%y%
    Endif
  Endif
  Let>newfilename=%dir%nml Deel %y%.xls
  Del>newfilename
  CopyFile>probook,newfilename
  Del>probook
  Run>%nt%
  Wait>10
  Press Tab*2
  Wait>0.001
  Press Down*17
  Wait>0.001
  Let>clicks={%x%*250}
  if>clicks<0>pgdwn={%clicks%/30}
    Let>pgdwn={round(%pgdwn%)}
    Let>pgdwn={%pgdwn%-1}
    mousemove>560,210
    wait>0.001
    Lclick
    wait>0.001
    Let>k=0
    Repeat>k
      Wait>0.001
      Press Page Down
      Let>k=k+1
    Until>k,pgdwn
    Let>pgdwn={%pgdwn%*30}
    Let>clicks={%clicks%-%pgdwn%}
    Mousemove>1260,760
      Let>k=0
    Repeat>k
      Wait>0.001
      Lclick
      Let>k=k+1
    Until>k,clicks
  Endif
  Wait>0.001
  Let>x=x+1
END>restart

SRT>tomijngids
  Wait>0.001
  Let>k=0
  Repeat>k
    Wait>0.001
    Mousemove>240,210
    Wait>0.001
    Lclick
    Wait>0.001
    Mousemove>1260,760
    Wait>0.001
    Lclick
    Let>k=k+1
  Until>k,25
  Wait>0.001
  Mousemove>560,210
  Wait>0.001
  Rclick
  Wait>0.01
  Mousemove>600,280
  Wait>0.001
  Lclick
  Wait>0.01
  Press Enter
  Wait>0.001
  Lclick
  Wait>0.001
  Press Alt
  Wait>0.001
  Release Alt
  Wait>0.001
  Press Right*2
  Wait>0.001
  Press Down*9
  Wait>0.001
  Press Enter
  Wait>0.001
END>tomijngids


SRT>about
  MessageModal>%msg_about%
  Gosub>dialog1
END>about

SRT>stop
  MessageModal>%msg_stop%
  Goto>stop
END>stop

Label>stop

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Jan 03, 2007 10:01 pm

In the first script that was submitted I got errors here:

Code: Select all

Until>k,pgdwn
Let>pgdwn={pgdwn*30}
Let>clicks={clicks-pgdwn}
Was fixed by changing to this:
Until>k,pgdwn
Let>pgdwn={%pgdwn%*30}
Let>clicks={%clicks%-%pgdwn%}
------------------------------
Have not looked at second code sample yet.....


Edited ---Oops, looks like others already submitted this while I was typing.
Nothing different from others.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Knoore
Junior Coder
Posts: 28
Joined: Fri Oct 20, 2006 8:30 am

Post by Knoore » Wed Jan 03, 2007 10:31 pm

The errors is in my Windows regional & language settings.
It was dutch, but to be able to run Macro Schedular's Math functions, it has to be english.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts