AutoHotkey Community

It is currently May 26th, 2012, 10:20 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: If statements
PostPosted: August 1st, 2008, 4:23 pm 
Offline

Joined: August 1st, 2008, 3:16 pm
Posts: 16
I am automating installers.

Some of these have commonality and are therefore combined in the same script.

I encountered an install window common to all of the softwares encorporated by the script. However two of them require different input from the other three. I have overcome this by using Ifs but I have to do this three times, which is not satisfactory.

Is there any way I can script the below more succinctly.

Mant thanks
Rob - Sytner IT

AHT Script:

IfWinExist, Choose Setup Language, Choose language for installation process
{
WinActivate
Sleep 100
If _AppName = AIC
{
Send {Tab}
Send {Space}
Sleep 100
}
If _AppName = STM
{
Send {Tab}
Send {Space}
Sleep 100
}
If _AppName = MNU
{
Send {Tab}
Send {Space}
Sleep 100
}
Send {Enter}
Sleep 1000
Continue
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2008, 5:02 pm 
Offline

Joined: July 21st, 2008, 4:16 pm
Posts: 726
Location: Calgary, AB, Canada
Code:
IfWinExist, Choose Setup Language, Choose language for installation process
{
   WinActivate
   WinWaitActive
   If _AppName = AIC || STM || MNU
   {
      Send {Tab}{Space}
      If _AppName = MNU
      {
         Send {Enter}
         Sleep 1000
      }
      Else
         Sleep 100
   }
   Continue
}

No Tested, but may work.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2008, 10:04 am 
Offline

Joined: August 1st, 2008, 3:16 pm
Posts: 16
Thanks for the tip, but unfortunately it does not work.

If I have _AppName = AIC this works but when you set the variable to be equal to more than one eg. _AppName = AIC || STM it fails.

Does anyone have any suggstions to where my syntax is going wrong.

Or if this is not possible.

Cheers

Rob
SytnerIT


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2008, 1:56 pm 
Sivvy wrote:
Code:
   ...
   If _AppName = AIC || STM || MNU ;  <------RTFM
   ...
   Continue ;  <------RTFM - continue is for loops!!
}

No Tested, but may work.
No fooling! You should test before posting!!! :evil:

SytnerIT, the "if" has been tested like this:
Code:
StringCaseSense, On  ; if you want case sensitive search
_AppName = STM

If _AppName in AIC,STM,MNU
  MsgBox, found it
Else
  MsgBox, Not found
ExitApp

and your code would be something like this:
Code:
IfWinExist, Choose Setup Language, Choose language for installation process
{
   WinActivate
   WinWaitActive
   If _AppName in AIC,STM,MNU
   {
      Send {Tab}{Space}
      Sleep, 100
;      MsgBox, found it
   }
   else {
     Send,{Enter}
     Sleep, 1000
;     MsgBox, not found
   }
}
This code not tested as I don't have your environment/context.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2008, 3:58 pm 
Offline

Joined: August 1st, 2008, 3:16 pm
Posts: 16
Many thanks, this was successful.

Much appreciated

Rob
SytnerIT


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], bobbysoon, Google [Bot], iBob35555VR, krajan and 58 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group