Jump to content

Recommended Posts

Posted (edited)

You know why it's giving you 0 for a return? It gives you zero when you read an input with anything other than #'s in it. So the regular expression in your example really is the same as reading the control without any checks. That's why you aren't seeing it. You should get the String Regular Expression Tester to test out the results of different strings, that tool's helped me a lot :) .

In any case, I just thought it would be a good idea to tell the user that their string is invalid rather than treating it as 0.. but either way is good

*edit: I should add, it sets it to 0 when used in an algebraic expression, like using + or * (otherwise it maintains itself as a string)

Edited by ascendant
Posted

kinda off topic but still has to do something with my script..

like in the screenshot on page 1 i have these pics on the top that show the elements

the code for them to display looks like this

GUICtrlCreatePic(@DesktopDir & "\SRO]v[ o ])\Elements\archemy_element_earth.jpg", 57, 20, 32, 32)
    GUICtrlCreatePic(@DesktopDir & "\SRO]v[ o ])\Elements\archemy_element_fire.jpg", 127, 20, 32, 32)
    GUICtrlCreatePic(@DesktopDir & "\SRO]v[ o ])\Elements\archemy_element_water.jpg", 197, 20, 32, 32)
    GUICtrlCreatePic(@DesktopDir & "\SRO]v[ o ])\Elements\archemy_element_wind.jpg", 267, 20, 32, 32)

so i was wondering if i would send somebody a .rar file that contains

my script

folder with the images

and he runs my script then the pictures wont display if im right or?

and if they wont display.. how can i make it that it will display no matter in what folder they copy the files?

thx

Posted

Use a relative uri..

if your script is in @DesktopDir & "\SRO]v[ o ])\

then this should be the code:

GUICtrlCreatePic("Elements\archemy_element_earth.jpg", 57, 20, 32, 32)
GUICtrlCreatePic("Elements\archemy_element_fire.jpg", 127, 20, 32, 32)
GUICtrlCreatePic("Elements\archemy_element_water.jpg", 197, 20, 32, 32)
GUICtrlCreatePic("Elements\archemy_element_wind.jpg", 267, 20, 32, 32)
Posted (edited)

but if id send you the script in a .rar file lets say

folder name "images" in this folder there are the images

script.exe

and you would extract both the folder and the script lets say to C:\Program Files\TestScript\

then it wont be the desktop anymore or?

cause some users would extract it maybe to their desktop, some would extract it to C:\Program Files maybe even some to D:\

so idk

Edited by darkxraver
Posted

You know why it's giving you 0 for a return? It gives you zero when you read an input with anything other than #'s in it. So the regular expression in your example really is the same as reading the control without any checks. That's why you aren't seeing it. You should get the String Regular Expression Tester to test out the results of different strings, that tool's helped me a lot :) .

In any case, I just thought it would be a good idea to tell the user that their string is invalid rather than treating it as 0.. but either way is good

*edit: I should add, it sets it to 0 when used in an algebraic expression, like using + or * (otherwise it maintains itself as a string)

Thats the way I designed it though :)

@darkxraver- try @scriptdir & "\images\......"

Posted

ugh thx.. should have looked at the help file :S

while were at it :)

is there a way to display the users how many ppl already use the program/script ?

ive seen a program that shows something like "Users: xxxx" in the title bar but im not sure if it was coded with autoit

i think if a users runs the program/script it saves their mac or something

Posted

but if id send you the script in a .rar file lets say

folder name "images" in this folder there are the images

script.exe

and you would extract both the folder and the script lets say to C:\Program Files\TestScript\

then it wont be the desktop anymore or?

cause some users would extract it maybe to their desktop, some would extract it to C:\Program Files maybe even some to D:\

so idk

It is relative. Relative file names are a concept from the DOS age and possibly earlier, I'm surprised you don't understand them by now.

For example your script is in:

D:\asjkdhajksd\myscript.au3

D:\asjkdhajksd\myscript.exe

then it would look for the images in:

D:\asjkdhajksd\Elements\archemy_element_earth.jpg

etc.

Posted

@BrettF and ascendant

with the thingy that only allows to input numbers in the inputbox..

i just found out that you could use the code $ES_NUMBER i.e

$addinput1 = GUICtrlCreateInput("0", 375, 70, 55, 20,$ES_NUMBER)

it will block any other inputs than 0-9 :)

Posted

@BrettF and ascendant

with the thingy that only allows to input numbers in the inputbox..

i just found out that you could use the code $ES_NUMBER i.e

$addinput1 = GUICtrlCreateInput("0", 375, 70, 55, 20,$ES_NUMBER)

it will block any other inputs than 0-9 :)

haha u skooled us :)

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
×
×
  • Create New...