Jump to content

Two Questions


Chobyhy
 Share

Recommended Posts

1. Is there a way to make the script check for the current date and the do the following action

So If Today > 12 / 1 /2006 (If today is after december first 2006)

$var = 1

I think only possible way to do is to check the local comp time but this can be easily tricked if the user changes the local time so is there a possible way to check for a world timer on the internet?

2. I think I read this before but does anyone know how to make a script terminate if there is a same script already running?

Link to comment
Share on other sites

  • Moderators

Look at _Now()/_NowCalcDate()/_NowDate()/_NowTime() in the help file. (Make sure you are using AutoIt v3.2 or higher.)

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

What do you mean gui stuff? its just a tray icon for mine

For #2 look at _SingleTon() in the help file, regardless of whether you're using a script based or gui based executable.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

For question #2, this works for gui stuff:

$script_version = "Some Name"
If WinExists($script_version) Then
    ;do something if it's running/exists
    Exit  ;and/or exit
EndIf
AutoItWinSetTitle($script_version)
In reference, that has got absolutely nothing to do with an "AutoIt Gui". It looks for the existance of a window title that is the main invisible window that AutoIt creates with every script executed and sets the title of that window.

AutoItWinSetTitle()

Link to comment
Share on other sites

  • Moderators

err wait about the date thing is there anyways to check date on internet instead of locally?

Find a site that has the time you want and use _InetGetSource() or _InetGet() both in the help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

In reference, that has got absolutely nothing to do with an "AutoIt Gui". It looks for the existance of a window title that is the main invisible window that AutoIt creates with every script executed and sets the title of that window.

Ahhh ok, cool. I was making an assumption because of the Win references. :">

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...