Sign in to follow this  
Followers 0
monte

spiradic functions

10 posts in this topic

Hello. I have an au3 script with func's and buttons. Every now and then I get all func's executing when I press a button that executes a particular func. It doesn't happen all the time, nor does it pertain to a particular button (hence I can press any button and sometimes all func's get executed instead of just the one the button is calling). All my func's are listed in a case statement. Thanks for any help you may be able to provide.

Share this post


Link to post
Share on other sites



My first suggestion is to post your code to let us analyze it ourselves. Not sure about the rest of the members, but I can't fix something directly if I don't know what I'm trying to fix.

Share this post


Link to post
Share on other sites

My first suggestion is to post your code to let us analyze it ourselves. Not sure about the rest of the members, but I can't fix something directly if I don't know what I'm trying to fix.

ditto!!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

My first suggestion is to post your code to let us analyze it ourselves. Not sure about the rest of the members, but I can't fix something directly if I don't know what I'm trying to fix.

Damn... and I just put my Crystal Ball in the shop this morning :lmao:

[center]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.[/center]

Share this post


Link to post
Share on other sites

Ok, I figured if it didn't happen even 80% of the time that I could get a general answer...however, here's my code (please note that I replaced actual names with ?'s in urls for privacy):

#include <GUIConstants.au3>

#notrayicon

$checkRun = "Emc Script"

If WinExists($checkRun) Then Exit

AutoItWinSetTitle($checkRun)

func pa()

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

clipput($vServer)

WinActivate("PrivateArk")

Send("{F10}tf")

Send(clipget())

send("{TAB}a")

Send("{ENTER}")

sleep(1000)

send("{ENTER}")

clipput($vServerClip)

return 0

endfunc

func serverDatabase()

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

clipput($vServer)

runwait("C:\progra~1\lotus\notes\notes.exe ????/server/????!!netops\????.nsf")

winActivate("Server History")

sleep(100)

send("{F10}vw")

sleep(100)

send(clipget())

send("{ENTER}{ENTER}")

clipput($vServerClip)

return 0

endfunc

func emcid()

dim $site[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[17]

clipput($vServer)

$site0=" /c Start http://????/ens/emcid%20reference.nsf/ByEMCID/aServer"

$site00=stringreplace($site0,"aServer",$vServer)

$site[1]= @ComSpec

$site[2]= $site00

$site[3]= ""

$site[4]= @SW_HIDE

Run($site[1] & $site[2], $site[3], $site[4])

clipput($vServerClip)

return 0

endfunc

func masterAlert()

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServerS=$vServerString[23]

$vServer=stringleft($vServerS, 30)

clipput($vServer)

run(@ComSpec & " /c \\cwbteam02\cwb_emc$\em\master~1.xls", "", @SW_HIDE)

winActivate("microsoft excel-master alert")

sleep(2000)

send("{f10}ef")

send("{TAB}{ENTER}")

send(clipget())

send("{TAB}{TAB}")

send("w")

send("{ENTER}{ENTER}")

clipput($vServerClip)

endfunc

func nslookup()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c nslookup tserver& pause"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

Run($aMy[1] & $aMy[2])

clipput($vServerClip)

endfunc

func myping()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c ping tserver count 1& pause"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

Run($aMy[1] & $aMy[2])

clipput($vServerClip)

endfunc

func cmd()

run(@ComSpec & " /k")

endfunc

func telnet()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c telnet tserver"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

Run($aMy[1] & $aMy[2])

clipput($vServerClip)

endfunc

func uptime()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c C:\windows\uptime tserver& pause"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

Run($aMy[1] & $aMy[2])

clipput($vServerClip)

endfunc

func mmc()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c compmgmt.msc /computer=\\tserver"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

$aMy[3]= ""

$aMy[4]= @SW_HIDE

Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])

clipput($vServerClip)

endfunc

func netmaps()

dim $site[5]

Dim $primary

Dim $secondary

$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

If $k = 1 Then

$primary = "right"

$secondary = "left"

Else

$primary = "left"

$secondary = "right"

EndIf

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$myServer=StringLeft($vServer,5)

clipput($myServer)

run(@ComSpec & " /c start http://????/WebDev/netmap.nsf/0000/$searchForm?SearchView")

sleep(2000)

winactivate("search this view")

sleep(100)

send("{TAB 3}")

sleep(100)

send(clipget())

send("*")

send("{ENTER}")

sleep(1000)

mousemove(82,523,0)

send(MouseClick($primary))

sleep(1000)

send("{END}")

mousemove(505,691,0)

send(MouseClick($primary))

sleep(100)

; $site00=stringreplace($site0,"aServer",$myServer)

; $site[1]= @ComSpec

; $site[2]= $site00

; $site[3]= ""

; $site[4]= @SW_HIDE

; Run($site[1] & $site[2], $site[3], $site[4])

clipput($vServerClip)

return 0

endfunc

func trace()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c tracert tserver& pause"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

Run($aMy[1] & $aMy[2])

clipput($vServerClip)

endfunc

func rdp()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$mycmd=" /c mstsc.exe /v:tserver& pause"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd0

$aMy[3]= ""

$aMy[4]= @SW_HIDE

Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])

clipput($vServerClip)

endfunc

func disk()

dim $aMy[5]

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

$vSummary=$vServerString[23]

$myDisk=stringmid($vSummary,19,1)

$mycmd=" /c explorer \\tserver\tmpDrive$"

$mycmd0=stringreplace($mycmd,"tserver",$vServer)

$mycmd1=stringreplace($mycmd0,"tmpDrive",$myDisk)

$aMy[1]= @ComSpec

$aMy[2]= $mycmd1

$aMy[3]= ""

$aMy[4]= @SW_HIDE

Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])

clipput($vServerClip)

endfunc

func dameware()

dim $site[5]

Dim $primary

Dim $secondary

$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

If $k = 1 Then

$primary = "right"

$secondary = "left"

Else

$primary = "left"

$secondary = "right"

EndIf

$vServerClip=clipget()

$vServerString=stringsplit($vServerClip,@TAB)

$vServer=$vServerString[22]

clipput($vServer)

run(@ComSpec & " /c C:\progra~1\damewa~1\damewa~1\dntu.exe")

sleep(2000)

winactivate("dameware")

sleep(100)

send("{END}")

sleep(500)

mousemove(77,660,0)

send(MouseClick($secondary))

send("{DOWN}")

send("{ENTER}")

send(clipget())

send("{ENTER}")

sleep(100)

clipput($vServerClip)

return 0

endfunc

;func diskmmc()

; dim $aMy[5]

; $vServerClip=clipget()

; $vServerString=stringsplit($vServerClip,@TAB)

; $vServer=$vServerString[22]

; $mycmd=" /c diskmgmt.msc /computer=\\tserver"

; $mycmd0=stringreplace($mycmd,"tserver",$vServer)

; $aMy[1]= @ComSpec

; $aMy[2]= $mycmd0

; $aMy[3]= ""

; $aMy[4]= @SW_HIDE

; Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])

; clipput($vServerClip)

;endfunc

Opt("GUICoordMode", 1)

GUICreate("Emc Script", 400,280)

; Create the controls

$button1 = GUICtrlCreateButton ("pa", 10, 10, 30, 30, $BS_BITMAP)

GUICtrlSetImage (-1, "C:\progra~1\pa.bmp",22)

$button2 = GUICtrlCreateButton ("&Server Database", 50, 10, 30, 30, $BS_ICON)

GUICtrlSetImage (-1, "C:\progra~1\lnotes.ico",0)

$button3 = GUICtrlCreateButton ("&emcid", 90, 10, 60, 20)

$button4 = GUICtrlCreateButton ("m&aster alert", 140, 10, 70, 20)

$button5 = GUICtrlCreateButton ("&nslookup", 220, 10, 60, 20)

$button6 = GUICtrlCreateButton ("&ping", 10, 30, 30, 20)

$button7 = GUICtrlCreateButton ("&cmd", 50, 30, 30, 20)

$button8 = GUICtrlCreateButton ("&telnet", 90, 30, 40, 20)

$button9 = GUICtrlCreateButton ("&uptime", 140, 30, 40, 20)

$button10 = GUICtrlCreateButton ("&mmc", 190, 30, 30, 20)

$button11 = GUICtrlCreateButton ("n&etmaps", 10, 50, 50, 20)

$button12 = GUICtrlCreateButton ("tr&ace", 70, 50, 40, 20)

$button13 = GUICtrlCreateButton ("&rdp", 120, 50, 30, 20)

$button14 = GUICtrlCreateButton ("&disk", 160, 50, 30, 20)

$button15 = GUICtrlCreateButton ("dame&ware", 210, 50, 60, 20)

;$button?? = GUICtrlCreateButton ("diskmmc", 210, 50, 60, 20)

; Show the GUI

GUISetState ()

; In this message loop we use variables to keep track of changes to the radios, another

; way would be to use GUICtrlRead() at the end to read in the state of each control

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Select

Case $msg = $GUI_EVENT_MINIMIZE

Case $msg = $GUI_EVENT_MAXIMIZE

Case $msg = $GUI_EVENT_CLOSE

Case $msg = $button1

pa()

Case $msg = $button2

serverDatabase()

Case $msg = $button3

emcid()

Case $msg = $button4

masterAlert()

Case $msg = $button5

nslookup()

Case $msg = $button6

myping()

Case $msg = $button7

cmd()

Case $msg = $button8

telnet()

Case $msg = $button9

uptime()

Case $msg = $button10

mmc()

Case $msg = $button11

netmaps()

Case $msg = $button12

trace()

Case $msg = $button13

rdp()

Case $msg = $button14

disk()

Case $msg = $button15

dameware()

; Case $msg = $button??

; diskmmc()

EndSelect

WEnd

Share this post


Link to post
Share on other sites

Just a few observations, I didn't look too hard at your code because you didn't use code tags, and to be honest it was making me go cross eyed.

1. Since you have this in your loop:

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
you can take these out of the case statement.
Case $msg = $GUI_EVENT_MINIMIZE
Case $msg = $GUI_EVENT_MAXIMIZE
Case $msg = $GUI_EVENT_CLOSE

2. This

mousemove(82,523,0)
send(MouseClick($primary))
Could just be
MouseClick($Primary, 82, 523, 1, 1)

3. This

send(clipget())
is redundant, your not using it for anything, If you want to use it's value, then put it in a variable or within a statement
$ClipGetVar = ClipGet()
If $ClipGetVar <> 'Something' Then
or
If ClipGet() <> 'Something' Then

Hope this gives you some ideas...


[center]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.[/center]

Share this post


Link to post
Share on other sites

Sorry about the code tags, I didn't know about them and thanks for your suggestions, I'll make those changes.

#include <GUIConstants.au3>
#notrayicon
$checkRun = "Emc Script"
If WinExists($checkRun) Then Exit
AutoItWinSetTitle($checkRun)


func pa()
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
clipput($vServer)
WinActivate("PrivateArk")
Send("{F10}tf")
Send(clipget())
send("{TAB}a")
Send("{ENTER}")
sleep(1000)
send("{ENTER}")
clipput($vServerClip)
return 0
endfunc

func serverDatabase()
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
clipput($vServer)
runwait("C:\progra~1\lotus\notes\notes.exe ????/server/????!!netops\????.nsf")
winActivate("Server History")
sleep(100)
send("{F10}vw")
sleep(100)
send(clipget())
send("{ENTER}{ENTER}")
clipput($vServerClip)
return 0
endfunc

func emcid()
dim $site[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[17]
clipput($vServer)
$site0=" /c Start http://????/ens/emcid%20reference.nsf/ByEMCID/aServer"
$site00=stringreplace($site0,"aServer",$vServer)
$site[1]= @ComSpec
$site[2]= $site00
$site[3]= ""
$site[4]= @SW_HIDE
Run($site[1] & $site[2], $site[3], $site[4])
clipput($vServerClip)
return 0
endfunc

func masterAlert()
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServerS=$vServerString[23]
$vServer=stringleft($vServerS, 30)
clipput($vServer)
run(@ComSpec & " /c \\cwbteam02\cwb_emc$\em\master~1.xls", "", @SW_HIDE)
winActivate("microsoft excel-master alert")
sleep(2000)
send("{f10}ef")
send("{TAB}{ENTER}")
send(clipget())
send("{TAB}{TAB}")
send("w")
send("{ENTER}{ENTER}")
clipput($vServerClip)
endfunc

func nslookup()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c nslookup tserver& pause"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
Run($aMy[1] & $aMy[2])
clipput($vServerClip)
endfunc

func myping()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c ping tserver count 1& pause"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
Run($aMy[1] & $aMy[2])
clipput($vServerClip)
endfunc

func cmd()
run(@ComSpec & " /k")
endfunc

func telnet()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c telnet tserver"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
Run($aMy[1] & $aMy[2])
clipput($vServerClip)
endfunc

func uptime()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c C:\windows\uptime tserver& pause"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
Run($aMy[1] & $aMy[2])
clipput($vServerClip)
endfunc

func mmc()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c compmgmt.msc /computer=\\tserver"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
$aMy[3]= ""
$aMy[4]= @SW_HIDE
Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
clipput($vServerClip)
endfunc

func netmaps()
dim $site[5]
Dim $primary
Dim $secondary
$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $k = 1 Then
$primary = "right"
$secondary = "left"
Else 
$primary = "left"
$secondary = "right"
EndIf
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$myServer=StringLeft($vServer,5)
clipput($myServer)
run(@ComSpec & " /c start http://????/WebDev/netmap.nsf/0000/$searchForm?SearchView")
sleep(2000)
winactivate("search this view")
sleep(100)
send("{TAB 3}")
sleep(100)
send(clipget())
send("*")
send("{ENTER}")
sleep(1000)
mousemove(82,523,0)
send(MouseClick($primary))
sleep(1000)
send("{END}")
mousemove(505,691,0)
send(MouseClick($primary))
sleep(100)
; $site00=stringreplace($site0,"aServer",$myServer)
; $site[1]= @ComSpec
; $site[2]= $site00
; $site[3]= ""
; $site[4]= @SW_HIDE
; Run($site[1] & $site[2], $site[3], $site[4])
clipput($vServerClip)
return 0
endfunc

func trace()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c tracert tserver& pause"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
Run($aMy[1] & $aMy[2])
clipput($vServerClip)
endfunc

func rdp()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$mycmd=" /c mstsc.exe /v:tserver& pause"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd0
$aMy[3]= ""
$aMy[4]= @SW_HIDE
Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
clipput($vServerClip)
endfunc

func disk()
dim $aMy[5]
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
$vSummary=$vServerString[23]
$myDisk=stringmid($vSummary,19,1)
$mycmd=" /c explorer \\tserver\tmpDrive$"
$mycmd0=stringreplace($mycmd,"tserver",$vServer)
$mycmd1=stringreplace($mycmd0,"tmpDrive",$myDisk)
$aMy[1]= @ComSpec
$aMy[2]= $mycmd1
$aMy[3]= ""
$aMy[4]= @SW_HIDE
Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
clipput($vServerClip)
endfunc

func dameware()
dim $site[5]
Dim $primary
Dim $secondary
$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $k = 1 Then
$primary = "right"
$secondary = "left"
Else 
$primary = "left"
$secondary = "right"
EndIf
$vServerClip=clipget()
$vServerString=stringsplit($vServerClip,@TAB)
$vServer=$vServerString[22]
clipput($vServer)
run(@ComSpec & " /c C:\progra~1\damewa~1\damewa~1\dntu.exe")
sleep(2000)
winactivate("dameware")
sleep(100)
send("{END}")
sleep(500)
mousemove(77,660,0)
send(MouseClick($secondary))
send("{DOWN}")
send("{ENTER}")
send(clipget())
send("{ENTER}")
sleep(100)
clipput($vServerClip)
return 0
endfunc

;func diskmmc()
; dim $aMy[5]
; $vServerClip=clipget()
; $vServerString=stringsplit($vServerClip,@TAB)
; $vServer=$vServerString[22]
; $mycmd=" /c diskmgmt.msc /computer=\\tserver"
; $mycmd0=stringreplace($mycmd,"tserver",$vServer)
; $aMy[1]= @ComSpec
; $aMy[2]= $mycmd0
; $aMy[3]= ""
; $aMy[4]= @SW_HIDE
; Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
; clipput($vServerClip)
;endfunc

Opt("GUICoordMode", 1)
GUICreate("Emc Script", 400,280)

; Create the controls
$button1 = GUICtrlCreateButton ("pa", 10, 10, 30, 30, $BS_BITMAP)
GUICtrlSetImage (-1, "C:\progra~1\pa.bmp",22)

$button2 = GUICtrlCreateButton ("&Server Database", 50, 10, 30, 30, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\lnotes.ico",0)

$button3 = GUICtrlCreateButton ("&emcid", 90, 10, 60, 20)
$button4 = GUICtrlCreateButton ("m&aster alert", 140, 10, 70, 20)
$button5 = GUICtrlCreateButton ("&nslookup", 220, 10, 60, 20)
$button6 = GUICtrlCreateButton ("&ping", 10, 30, 30, 20)
$button7 = GUICtrlCreateButton ("&cmd", 50, 30, 30, 20)
$button8 = GUICtrlCreateButton ("&telnet", 90, 30, 40, 20)
$button9 = GUICtrlCreateButton ("&uptime", 140, 30, 40, 20)
$button10 = GUICtrlCreateButton ("&mmc", 190, 30, 30, 20)
$button11 = GUICtrlCreateButton ("n&etmaps", 10, 50, 50, 20)
$button12 = GUICtrlCreateButton ("tr&ace", 70, 50, 40, 20)
$button13 = GUICtrlCreateButton ("&rdp", 120, 50, 30, 20)
$button14 = GUICtrlCreateButton ("&disk", 160, 50, 30, 20)
$button15 = GUICtrlCreateButton ("dame&ware", 210, 50, 60, 20)
;$button?? = GUICtrlCreateButton ("diskmmc", 210, 50, 60, 20)

; Show the GUI
GUISetState ()

; In this message loop we use variables to keep track of changes to the radios, another
; way would be to use GUICtrlRead() at the end to read in the state of each control
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Select
Case $msg = $GUI_EVENT_MINIMIZE
Case $msg = $GUI_EVENT_MAXIMIZE
Case $msg = $GUI_EVENT_CLOSE
Case $msg = $button1
pa()
Case $msg = $button2
serverDatabase()
Case $msg = $button3
emcid()
Case $msg = $button4
masterAlert()
Case $msg = $button5
nslookup()
Case $msg = $button6
myping()
Case $msg = $button7
cmd()
Case $msg = $button8
telnet()
Case $msg = $button9
uptime()
Case $msg = $button10
mmc()
Case $msg = $button11
netmaps()
Case $msg = $button12
trace()
Case $msg = $button13
rdp()
Case $msg = $button14
disk()
Case $msg = $button15
dameware()
; Case $msg = $button??
; diskmmc()

EndSelect
WEnd

Share this post


Link to post
Share on other sites

I'm going to assume that you haven't edited yet.. and assume that this is only a portion of your script, because the Buttons in the GUI are all over the place... In saying that... is there by any chance in your actual script that you have a Case/If/Then statement that has a condition that if 'something' equals '0' to do something else? The reason I ask, is your returning 0 in some of your functions, which don't look like you need to return anything... Other than that, it's still bit hard to follow, like the WinSetTitle() before the actual GUI is up is a bit redundant. The Opt('GUICoordMode', 1) doesn't look like your using it for anything in your current setup... but with just the case statement to be honest, I can't see it calling anything else unless your returning a value that would make one of those buttons true, or to call the function true.


[center]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.[/center]

Share this post


Link to post
Share on other sites

Ok, sorry for the wait. I've made all the previous changes and here's my full code (except the ?'s in place of hostnames). I thank you all for you help! It's very appreciated.

#include <GUIConstants.au3>
#notrayicon
$checkRun = "Emc Script"
If WinExists($checkRun) Then Exit


func pa()
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 WinActivate("PrivateArk")
 Send("{F10}tf")
 Send($vServer)
 send("{TAB}a")
 Send("{ENTER}")
 sleep(1000)
 send("{ENTER}")
endfunc

func serverDatabase()
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 runwait("C:\progra~1\lotus\notes\notes.exe ?/server/?!!netops\?.nsf")
 winActivate("Server History")
 sleep(100)
 send("{F10}vw")
 sleep(100)
 send($vServer)
 send("{ENTER}{ENTER}")
endfunc

func emcid()
 dim $site[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[17]
 $site0=" /c Start http://?/ens/emcid%20reference.nsf/ByEMCID/aServer"
 $site00=stringreplace($site0,"aServer",$vServer)
 $site[1]= @ComSpec
 $site[2]= $site00
 $site[3]= ""
 $site[4]= @SW_HIDE
 Run($site[1] & $site[2], $site[3], $site[4])
endfunc

func masterAlert()
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServerS=$vServerString[23]
 $vServer=stringleft($vServerS, 30)
 run(@ComSpec & " /c \\?\?$\em\master~1.xls", "", @SW_MAXIMIZE)
 winActivate("microsoft excel-master alert")
 sleep(2000)
 send("{f10}ef")
 send("{TAB}{ENTER}")
 send($vServer)
 send("{TAB}{TAB}")
 send("w")
 send("{ENTER}{ENTER}")
endfunc

func nslookup()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c nslookup tserver& pause"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 Run($aMy[1] & $aMy[2])
endfunc

func myPing()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c ping tserver count 1& pause"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 Run($aMy[1] & $aMy[2])
endfunc

func cmd()
 run(@ComSpec & " /k")
endfunc

func telnet()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c telnet tserver"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 Run($aMy[1] & $aMy[2])
endfunc

func uptime()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c C:\windows\uptime tserver& pause"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 Run($aMy[1] & $aMy[2])
endfunc

func mmc()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c compmgmt.msc /computer=\\tserver"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 $aMy[3]= ""
 $aMy[4]= @SW_HIDE
 Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
endfunc

func netMaps()
 dim $site[5]
 Dim $primary
 Dim $secondary
 $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
 If $k = 1 Then
   $primary = "right"
   $secondary = "left"
 Else 
   $primary = "left"
   $secondary = "right"
 EndIf
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $myServer=StringLeft($vServer,5)
 run(@ComSpec & " /c start http://?/WebDev/?.nsf/0/$searchForm?SearchView", "", @SW_HIDE)
 sleep(2000)
 winactivate("search this view")
 sleep(100)
 send("{TAB 3}")
 sleep(100)
 send($myServer)
 send("*")
 send("{ENTER}")
 sleep(1000)
 MouseClick($Primary, 82, 523, 1, 0)
 sleep(1000)
 send("{END}")
 MouseClick($Primary, 505, 691, 1, 0)
 sleep(100)
endfunc

func trace()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c tracert tserver& pause"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 Run($aMy[1] & $aMy[2])
endfunc

func rdp()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $mycmd=" /c mstsc.exe /v:tserver& pause"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd0
 $aMy[3]= ""
 $aMy[4]= @SW_HIDE
 Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
endfunc

func disk()
 dim $aMy[5]
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 $vSummary=$vServerString[23]
 $myDisk=stringmid($vSummary,19,1)
 $mycmd=" /c explorer \\tserver\tmpDrive$"
 $mycmd0=stringreplace($mycmd,"tserver",$vServer)
 $mycmd1=stringreplace($mycmd0,"tmpDrive",$myDisk)
 $aMy[1]= @ComSpec
 $aMy[2]= $mycmd1
 $aMy[3]= ""
 $aMy[4]= @SW_HIDE
 Run($aMy[1] & $aMy[2], $aMy[3], $aMy[4])
endfunc

func dameware()
 dim $site[5]
 Dim $primary
 Dim $secondary
 $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
 If $k = 1 Then
   $primary = "right"
   $secondary = "left"
 Else 
   $primary = "left"
   $secondary = "right"
 EndIf
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 run(@ComSpec & " /c C:\progra~1\damewa~1\damewa~1\dntu.exe")
 sleep(2000)
 winactivate("dameware")
 sleep(100)
 send("{END}")
 sleep(500)
 MouseClick($Secondary, 77, 660, 1, 0)
 send("{DOWN}")
 send("{ENTER}")
 send($vServer)
 send("{ENTER}")
 sleep(100)
endfunc


GUICreate("Emc Script", 400,280)

; Create the controls
$button1 = GUICtrlCreateButton ("pa", 10, 10, 40, 40, $BS_BITMAP)
GUICtrlSetImage (-1, "C:\progra~1\pa.bmp",22)

$button2 = GUICtrlCreateButton ("&Server Database", 60, 10, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\lnotes.ico",0)

$button3 = GUICtrlCreateButton ("&ping", 110, 10, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\ping.ico",0)

$button4 = GUICtrlCreateButton ("&cmd", 160, 10, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\dosprompt.ico",0)

$button5 = GUICtrlCreateButton ("n&etmaps", 210, 10, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\visio.ico",0)

$button6 = GUICtrlCreateButton ("&rdp", 10, 60, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\rdp.ico",0)

$button7 = GUICtrlCreateButton ("dame&ware", 60, 60, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\dameware.ico",0)

$button8 = GUICtrlCreateButton ("&telnet", 110, 60, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\telnet.ico",0)

$button9 = GUICtrlCreateButton ("&disk", 160, 60, 40, 40)
GUICtrlSetImage (-1, "C:\progra~1\disk.ico",0)

$button10 = GUICtrlCreateButton ("&emcid", 10, 110, 40, 20)
$button11 = GUICtrlCreateButton ("m&aster alert", 60, 110, 70, 20)
$button12 = GUICtrlCreateButton ("&nslookup", 140, 110, 60, 20)
$button13 = GUICtrlCreateButton ("&uptime", 210, 110, 40, 20)
$button14 = GUICtrlCreateButton ("&mmc", 260, 110, 30, 20)
$button15 = GUICtrlCreateButton ("tr&ace", 300, 110, 40, 20)


; Show the GUI
GUISetState ()

; In this message loop we use variables to keep track of changes to the radios, another
; way would be to use GUICtrlRead() at the end to read in the state of each control
While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   Select
      Case $msg = $button1
         pa()
      Case $msg = $button2
         serverDatabase()
      Case $msg = $button3
         myPing()
      Case $msg = $button4
         cmd()
      Case $msg = $button5
         netMaps()
      Case $msg = $button6
         rdp()
      Case $msg = $button7
         dameware()
      Case $msg = $button8
         telnet()
      Case $msg = $button9
         disk()
      Case $msg = $button10
         emcid()
      Case $msg = $button11
         masterAlert()
      Case $msg = $button12
         nslookup()
      Case $msg = $button13
         uptime()
      Case $msg = $button14
         mmc()
      Case $msg = $button15
         trace()

   EndSelect
WEnd

Share this post


Link to post
Share on other sites

In case anyone has forgotten, my question is that I have all func's being executed when I press only one button, as apposed to just the one func being executed. This happens at spiradic times and it's related to a particular button being pressed. Thank you all for your help, I've been searching for hours on google and have found nothing.

Share this post


Link to post
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
Sign in to follow this  
Followers 0