Jump to content

Changing variables


Recommended Posts

ack this is the second time I've written this...

Well uh its been quite a long time since i last used auto it and my skills are a bit rusty...

i was wondering is it possible to change a variable

ex:

$date = _DateNow

therefore:

$date = 10/15/05

now what if i wanted the date to just be:

$date = 101505

also if i wanted to add another character to the variable such as a:

$date = 101505a

how would this be possible... I'm guessing it has to deal with strings...

thanks for your help in advanced

Link to comment
Share on other sites

ahh... i thought it was something simple like that... thanks

just wondering.. for future reference how would you add a symbol like a in the middle of 101505

ex.

101a505

EDIT: also on a random note how do you get the X button in a gui script to work

Case $get = $GUI_EVENT_CLOSE
    Exit
    EndSelect

doesnt seem to work

Edited by kapowdude
Link to comment
Share on other sites

a is not a number so will treat it like a string.

; Just in the middle
$date = String(101505)
$date = StringLeft($date, 3) & 'a' & StringRight($date, 3)
MsgBox(0, '', $date)

; Between 15 only
$date = String(101505)
$date = StringReplace($date, '15', '1a5')
MsgBox(0, '', $date)

For your close issue. Are you using

$get = GuiGetMsg()

in your loop?

Edited by MHz
Link to comment
Share on other sites

For your close issue. Are you using

$get = GuiGetMsg()

in your loop?

yeah

While 1
$get= GUIGetMsg ()
Select
Case $get = $GUI_EVENT_CLOSE
    Exit
    EndSelect

;rest of script goes here

also im not getting how these return values / @error works (i'm a complete noob)

say im doing an inetget and the page doesnt exist it would have a return value of 0, but the function inetget returns something from the internet so you would use @error right?

so say:

If Inetget (blah blah blah) @error then msgbox (0, "error","an error occured")

but that doesnt seem to work..

how would do do something with a normal return such as 0 or 1 such as a msgbox

Link to comment
Share on other sites

No @error return for InetGet() so you can use the true or false concept for 1 and 0. Any number other then 0 is true.

If Not True Then MsgBox.

If Not InetGet() Then MsgBox()

1 = True. MsgBox will show.

If 1 Then MsgBox()

Not 1 = False. MsgBox will not show.

If Not 1 Then MsgBox()

0 = False. MsgBox will not show.

If 0 Then MsgBox()

Not 0 = True. MsgBox will show.

If Not 0 Then MsgBox()

Your full of questions. HTH ;)

Link to comment
Share on other sites

also on a random note how do you get the X button in a gui script to work

Case $get = $GUI_EVENT_CLOSE
    Exit
    EndSelect

doesnt seem to work

Have you included this line at the top of your script? --

#Include <GUIConstants.au3>

Otherwise AutoIt won't know what $GUI_EVENT_CLOSE signifies.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...