AutoHotkey Community

It is currently May 25th, 2012, 4:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 25th, 2007, 1:24 pm 
Offline

Joined: January 13th, 2006, 3:13 pm
Posts: 29
Hi all. I am writing another script.

In this one, I want to display to the users running it, a status window showing the completion of each step. I have something that works, but it seems a little awkward. Here's what I have.
Code:
Gui, +ToolWindow
Gui, -Theme
Gui, +AlwaysOnTop
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x26 y7 w130 h20 , Doing Step 1 . . .
Gui, Add, Text, x26 y37 w130 h20 ,
Gui, Add, Text, x26 y67 w130 h20 ,
Gui, Add, Text, x26 y97 w160 h20 ,
Gui, Add, Text, x26 y127 w130 h20 ,
Gui, Add, Text, x26 y157 w150 h20 ,
Gui, Add, Text, x26 y187 w60 h20 ,
Gui, Show,, File Proccessing

RunWait osql -U <user> -P <pass> -i '"%A_Temp%\script.sql'" -S MACHINE1 -d SERVERA  ,,Hide

Gui, Destroy
Gui, +ToolWindow
Gui, -Theme
Gui, +AlwaysOnTop
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x26 y7 w130 h20 , Doing Step 1 . . .
Gui, Add, Text, x26 y37 w130 h20 , Doing Step 2 . . .
Gui, Add, Text, x26 y67 w130 h20 ,
Gui, Add, Text, x26 y97 w160 h20 ,
Gui, Add, Text, x26 y127 w130 h20 ,
Gui, Add, Text, x26 y157 w150 h20 ,
Gui, Add, Text, x26 y187 w60 h20 ,

Gui, Show,, File Proccessing

RunWait osql -U <user> -P <pass> -i '"%A_Temp%\script.sql'" -S MACHINE2 -d SERVERB  ,,Hide

etc ...
Is this the best way to do this? Or is there a better way?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2007, 3:11 pm 
Offline

Joined: January 13th, 2006, 3:13 pm
Posts: 29
I figured out a better way. I only added a TEXT control one at a time, removed the RETURNs, added a SHOW at each spot, And used the SHOW to display a larger box in the beginning.

The last step has a Return on it, to pause at the end


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2007, 4:40 pm 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8657
Location: Salem, MA
an even better way would be to use GuiControl.

If this is just to show you progress, try the Progress command.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2007, 4:45 pm 
Code:
#SingleInstance, Force

Gui, +ToolWindow -Theme +AlwaysOnTop
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x26 y7 w300 h300 vProgress,
Gui, Show,, File Proccessing


osql("BoBo","B0B0P0w3r",3,A_Temp)
SoundBeep
Sleep 800
Gui, Destroy

osql(User,Pass,NumOfMachines,ScriptDir)
{
   Loop, %NumOfMachines%
   {
      osqlParams := ("-U " . user . " -P " . pass . " -i " . ScriptDir . "\script.sql -S MACHINE" . A_Index . " -d SERVERA")
      RunWait, cmd /c osql %osqlParams%,, Hide
      StatusMsg .= "`nRunning " A_Index "/" NumOfMachines
      Sleep, 1500
      GuiControl,, Progress, %StatusMsg%
      }
   Return
   }


[Moderator's note - Merged the correction]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2007, 7:55 pm 
Offline

Joined: January 13th, 2006, 3:13 pm
Posts: 29
nice. Will have to give that a try. :)


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: BrandonHotkey, engunneer, Exabot [Bot], vsub and 25 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