Jump to content

Restart Autoit Script in If statement


Recommended Posts

is there anyway to create a function and in the function start the loop from the beginning. I want to have it so if the MenuManager function gets called and it follows the If statement it will go straight to the beginning of the script and continue. I created the function and If statement already but after the Send SS command I want the program to start from the beginning again.

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#RequireAdmin
AutoItSetOption('MouseCoordMode', 0)
AutoItSetOption('SendKeyDelay', 7)

Global $sParts = @ScriptDir & "\connectors-prt.txt" ;~ String Variable pointing to Parts.txt file

   Global $aParts ;~ Array Variable
        _FileReadToArray($sParts, $aParts)

$log = Fileopen(@scriptdir & "\log.txt", 10)

For $i = 1 To $aParts[0]
   FileWrite($log, $aParts[$i])
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(5000)
    MouseClick('primary', 1300, 292, 1, 0)


    ;****************************************************************************************
    ;This part of the code is for assigning a var to a part
    ;it stores the var then paste it into the search field and hits enter
    ;
    ;****************************************************************************************

    ClipPut($aParts[$i])
    Send('^v')
    Sleep(2000)
    Send("{ENTER}")

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will show the results of
    ; the ClipPut ("Value") and will show the part in PDP
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('Secondary', 415, 603, 1, 0)
     sleep(3000)
    Send('{DOWN}')
    sleep(1000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(3000)
    Send("{ENTER}")

    Information()
    Sleep (5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes when select instance window comes up
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWait("Select Instance")
    WinActivate("Select Instance")
    Send("{ENTER}")
    Sleep(9000)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and will click on the X button To
    ; Close the current window another way to do this is WinClose funtion
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinWaitActive("[CLASS:Dialog]")
Send("uf")
MenuManager ()
sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(9000)
    Send('{DOWN 4}')
    Sleep(9000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(9000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and bring back the PDP search link
    ; Make sure to have MapKey created in Creo call it qq so when its called
    ; it will close the object in creo
    ;
    ; Another Mapkey that needs to be created is ss so it can bring up the PDP search
    ; site.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   #comments-start
   This part of the script locates the Tools in Creo and clicks on Family Table
   #comments-end


    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN 4}')
    Sleep(5000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")

Send("dftt")

; nv tool tab
   WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 122, 53, 1, 0)
Sleep(5000)


; this part is for the "Generate family table Columns"
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
  Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)

; This part clicks on the manu load feature
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
Send('{DOWN}')
Send('{DOWN}')
 Sleep(5000)
    Send("{ENTER}")

    ; popup window after you click on the manu load button
WinWait("Information")
WinActivate("Information")
Send("{ENTER}")

; in the search field it will enter the part.txt file and press enter
WinWait("Select File")
WinActivate("Select File")
Send (StringTrimRight($aParts[$i], 4) &".txt")
    Sleep(5000)
    Send('{ENTER}')

    ; the status will appear and a dialog box will appear, click enter
WinWait("Family Table Status")
WinActivate("Family Table Status")
Sleep(5000)
Send ('{ENTER}')
Sleep(5000)

;After the manu process is complete
WinWaitActive("Information")
Sleep(5000)
Send("{ENTER}")
Sleep (5000)
WinWaitActive("[CLASS:Dialog]")
Send("viv")
;Send ("vinst")
;Send("{CTRLDOWN}s{CTRLUP}")
;close object window

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a if else function for things to be verify if needed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;Conflicts()
 ;Sleep(3000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey to quit object
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;WinWaitActive("[CLASS:Dialog]")
 ;Send("qq")
    Sleep(5000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey open up the PDP search window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

FileWrite($log, @CRLF)

Next

FileClose($log)

Func Information ()
   If WinActivate ("Information") Then
      Send("{ENTER}")
   Else
   EndIf
EndFunc


Func MenuManager ()
   If WinActivate ("Menu Manager") Then
      MouseClick('Primary', 66, 53, 1, 0)
      Sleep(2000)
      MouseClick('Primary', 55, 192, 1, 0)
      WinWaitActive("[CLASS:Dialog]")
    Send("qq")
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

   Else
   EndIf
EndFunc

 

Link to comment
Share on other sites

is there anyway to create a function and in the function start the loop from the beginning. I want to have it so if the MenuManager function gets called and it follows the If statement it will go straight to the beginning of the script and continue. I created the function and If statement already but after the Send SS command I want the program to start from the beginning again.

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#RequireAdmin
AutoItSetOption('MouseCoordMode', 0)
AutoItSetOption('SendKeyDelay', 7)

Global $sParts = @ScriptDir & "\connectors-prt.txt" ;~ String Variable pointing to Parts.txt file

   Global $aParts ;~ Array Variable
        _FileReadToArray($sParts, $aParts)

$log = Fileopen(@scriptdir & "\log.txt", 10)

For $i = 1 To $aParts[0]
   FileWrite($log, $aParts[$i])
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(5000)
    MouseClick('primary', 1300, 292, 1, 0)


    ;****************************************************************************************
    ;This part of the code is for assigning a var to a part
    ;it stores the var then paste it into the search field and hits enter
    ;
    ;****************************************************************************************

    ClipPut($aParts[$i])
    Send('^v')
    Sleep(2000)
    Send("{ENTER}")

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will show the results of
    ; the ClipPut ("Value") and will show the part in PDP
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('Secondary', 415, 603, 1, 0)
     sleep(3000)
    Send('{DOWN}')
    sleep(1000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(3000)
    Send("{ENTER}")

    Information()
    Sleep (5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes when select instance window comes up
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWait("Select Instance")
    WinActivate("Select Instance")
    Send("{ENTER}")
    Sleep(9000)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and will click on the X button To
    ; Close the current window another way to do this is WinClose funtion
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinWaitActive("[CLASS:Dialog]")
Send("uf")
MenuManager ()
sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(9000)
    Send('{DOWN 4}')
    Sleep(9000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(9000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and bring back the PDP search link
    ; Make sure to have MapKey created in Creo call it qq so when its called
    ; it will close the object in creo
    ;
    ; Another Mapkey that needs to be created is ss so it can bring up the PDP search
    ; site.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   #comments-start
   This part of the script locates the Tools in Creo and clicks on Family Table
   #comments-end


    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN 4}')
    Sleep(5000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")

Send("dftt")

; nv tool tab
   WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 122, 53, 1, 0)
Sleep(5000)


; this part is for the "Generate family table Columns"
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
  Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)

; This part clicks on the manu load feature
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
Send('{DOWN}')
Send('{DOWN}')
 Sleep(5000)
    Send("{ENTER}")

    ; popup window after you click on the manu load button
WinWait("Information")
WinActivate("Information")
Send("{ENTER}")

; in the search field it will enter the part.txt file and press enter
WinWait("Select File")
WinActivate("Select File")
Send (StringTrimRight($aParts[$i], 4) &".txt")
    Sleep(5000)
    Send('{ENTER}')

    ; the status will appear and a dialog box will appear, click enter
WinWait("Family Table Status")
WinActivate("Family Table Status")
Sleep(5000)
Send ('{ENTER}')
Sleep(5000)

;After the manu process is complete
WinWaitActive("Information")
Sleep(5000)
Send("{ENTER}")
Sleep (5000)
WinWaitActive("[CLASS:Dialog]")
Send("viv")
;Send ("vinst")
;Send("{CTRLDOWN}s{CTRLUP}")
;close object window

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a if else function for things to be verify if needed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;Conflicts()
 ;Sleep(3000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey to quit object
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;WinWaitActive("[CLASS:Dialog]")
 ;Send("qq")
    Sleep(5000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey open up the PDP search window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

FileWrite($log, @CRLF)

Next

FileClose($log)

Func Information ()
   If WinActivate ("Information") Then
      Send("{ENTER}")
   Else
   EndIf
EndFunc


Func MenuManager ()
   If WinActivate ("Menu Manager") Then
      MouseClick('Primary', 66, 53, 1, 0)
      Sleep(2000)
      MouseClick('Primary', 55, 192, 1, 0)
      WinWaitActive("[CLASS:Dialog]")
    Send("qq")
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

   Else
   EndIf
EndFunc

 

Link to comment
Share on other sites

is there anyway to create a function and in the function start the loop from the beginning. I want to have it so if the MenuManager function gets called and it follows the If statement it will go straight to the beginning of the script and continue. I created the function and If statement already but after the Send SS command I want the program to start from the beginning again.

 

Thanks in advance!!

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#RequireAdmin
AutoItSetOption('MouseCoordMode', 0)
AutoItSetOption('SendKeyDelay', 7)

Global $sParts = @ScriptDir & "\connectors-prt.txt" ;~ String Variable pointing to Parts.txt file

   Global $aParts ;~ Array Variable
        _FileReadToArray($sParts, $aParts)

$log = Fileopen(@scriptdir & "\log.txt", 10)

For $i = 1 To $aParts[0]
   FileWrite($log, $aParts[$i])
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(5000)
    MouseClick('primary', 1300, 292, 1, 0)


    ;****************************************************************************************
    ;This part of the code is for assigning a var to a part
    ;it stores the var then paste it into the search field and hits enter
    ;
    ;****************************************************************************************

    ClipPut($aParts[$i])
    Send('^v')
    Sleep(2000)
    Send("{ENTER}")

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will show the results of
    ; the ClipPut ("Value") and will show the part in PDP
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('Secondary', 415, 603, 1, 0)
     sleep(3000)
    Send('{DOWN}')
    sleep(1000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(3000)
    Send("{ENTER}")

    Information()
    Sleep (5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes when select instance window comes up
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWait("Select Instance")
    WinActivate("Select Instance")
    Send("{ENTER}")
    Sleep(9000)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and will click on the X button To
    ; Close the current window another way to do this is WinClose funtion
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinWaitActive("[CLASS:Dialog]")
Send("uf")
MenuManager ()
sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(9000)
    Send('{DOWN 4}')
    Sleep(9000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(9000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and bring back the PDP search link
    ; Make sure to have MapKey created in Creo call it qq so when its called
    ; it will close the object in creo
    ;
    ; Another Mapkey that needs to be created is ss so it can bring up the PDP search
    ; site.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   #comments-start
   This part of the script locates the Tools in Creo and clicks on Family Table
   #comments-end


    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN 4}')
    Sleep(5000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")

Send("dftt")

; nv tool tab
   WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 122, 53, 1, 0)
Sleep(5000)


; this part is for the "Generate family table Columns"
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
  Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)

; This part clicks on the manu load feature
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
Send('{DOWN}')
Send('{DOWN}')
 Sleep(5000)
    Send("{ENTER}")

    ; popup window after you click on the manu load button
WinWait("Information")
WinActivate("Information")
Send("{ENTER}")

; in the search field it will enter the part.txt file and press enter
WinWait("Select File")
WinActivate("Select File")
Send (StringTrimRight($aParts[$i], 4) &".txt")
    Sleep(5000)
    Send('{ENTER}')

    ; the status will appear and a dialog box will appear, click enter
WinWait("Family Table Status")
WinActivate("Family Table Status")
Sleep(5000)
Send ('{ENTER}')
Sleep(5000)

;After the manu process is complete
WinWaitActive("Information")
Sleep(5000)
Send("{ENTER}")
Sleep (5000)
WinWaitActive("[CLASS:Dialog]")
Send("viv")
;Send ("vinst")
;Send("{CTRLDOWN}s{CTRLUP}")
;close object window

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a if else function for things to be verify if needed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;Conflicts()
 ;Sleep(3000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey to quit object
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;WinWaitActive("[CLASS:Dialog]")
 ;Send("qq")
    Sleep(5000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey open up the PDP search window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

FileWrite($log, @CRLF)

Next

FileClose($log)

Func Information ()
   If WinActivate ("Information") Then
      Send("{ENTER}")
   Else
   EndIf
EndFunc


Func MenuManager ()
   If WinActivate ("Menu Manager") Then
      MouseClick('Primary', 66, 53, 1, 0)
      Sleep(2000)
      MouseClick('Primary', 55, 192, 1, 0)
      WinWaitActive("[CLASS:Dialog]")
    Send("qq")
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

   Else
   EndIf
EndFunc

 

Link to comment
Share on other sites

  • Moderators

@Rmedina4 this is now 3 times you have posted the same question in different threads. Stop doing so and stick to one thread.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

try it:

#RequireAdmin
#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>

AutoItSetOption('MouseCoordMode', 0)
AutoItSetOption('SendKeyDelay', 7)
While 1
    Global $sParts = @ScriptDir & "\connectors-prt.txt" ;~ String Variable pointing to Parts.txt file

    Global $aParts ;~ Array Variable
    _FileReadToArray($sParts, $aParts)

    Global $log = FileOpen(@ScriptDir & "\log.txt", 10)

    For $i = 1 To $aParts[0]
        FileWrite($log, $aParts[$i])
        WinWait("Creo Parametric")
        WinActivate("Creo Parametric")
        Sleep(5000)
        MouseClick('primary', 1300, 292, 1, 0)


        ;****************************************************************************************
        ;This part of the code is for assigning a var to a part
        ;it stores the var then paste it into the search field and hits enter
        ;
        ;****************************************************************************************

        ClipPut($aParts[$i])
        Send('^v')
        Sleep(2000)
        Send("{ENTER}")

        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes in PDP and will show the results of
        ; the ClipPut ("Value") and will show the part in PDP
        ;
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

        Sleep(9000)
        WinWait("Creo Parametric")
        WinActivate("Creo Parametric")
        MouseClick('Secondary', 415, 603, 1, 0)
        Sleep(3000)
        Send('{DOWN}')
        Sleep(1000)
        Send('{DOWN}')
        Send('{RIGHT}')
        Sleep(3000)
        Send("{ENTER}")

        ;Information()
        If WinActivate("Information") Then Send("{ENTER}")

        Sleep(5000)
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes when select instance window comes up
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        WinWait("Select Instance")
        WinActivate("Select Instance")
        Send("{ENTER}")
        Sleep(9000)

        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes in Creo and will click on the X button To
        ; Close the current window another way to do this is WinClose funtion
        ;
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        WinWaitActive("[CLASS:Dialog]")
        Send("uf")
        ; MenuManager ()
        If WinActivate("Menu Manager") Then
            MouseClick('Primary', 66, 53, 1, 0)
            Sleep(2000)
            MouseClick('Primary', 55, 192, 1, 0)
            WinWaitActive("[CLASS:Dialog]")
            Send("qq")
            WinWaitActive("[CLASS:Dialog]")
            Send("ss")

            ContinueLoop 2
        EndIf

        Sleep(5000)
        WinWait("[CLASS:Dialog]")
        WinActivate("[CLASS:Dialog]")
        MouseClick('Primary', 610, 84, 1, 0)
        Sleep(9000)
        Send('{DOWN 4}')
        Sleep(9000)
        Send("{ENTER}")
        WinWaitActive("Parameter Status", '')
        Send("{ENTER}")
        WinWaitActive("Parameter Status", '')
        Send("{ENTER}")
        Sleep(9000)
        WinWait("[CLASS:Dialog]")
        WinActivate("[CLASS:Dialog]")
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes in Creo and bring back the PDP search link
        ; Make sure to have MapKey created in Creo call it qq so when its called
        ; it will close the object in creo
        ;
        ; Another Mapkey that needs to be created is ss so it can bring up the PDP search
        ; site.
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

        #comments-start
            This part of the script locates the Tools in Creo and clicks on Family Table
        #comments-end


        MouseClick('Primary', 610, 84, 1, 0)
        Sleep(5000)
        Send('{DOWN 4}')
        Sleep(5000)
        Send("{ENTER}")
        WinWaitActive("Parameter Status", '')
        Send("{ENTER}")
        WinWaitActive("Parameter Status", '')
        Send("{ENTER}")
        Sleep(5000)
        WinWait("[CLASS:Dialog]")
        WinActivate("[CLASS:Dialog]")

        Send("dftt")

        ; nv tool tab
        WinWaitActive("[CLASS:Dialog]")
        MouseClick('Primary', 122, 53, 1, 0)
        Sleep(5000)


        ; this part is for the "Generate family table Columns"
        WinWaitActive("[CLASS:Dialog]")
        MouseClick('Primary', 610, 84, 1, 0)
        Sleep(5000)
        Send('{DOWN}')
        Sleep(5000)
        Send("{ENTER}")
        Sleep(5000)

        ; This part clicks on the manu load feature
        WinWaitActive("[CLASS:Dialog]")
        MouseClick('Primary', 610, 84, 1, 0)
        Sleep(5000)
        Send('{DOWN}')
        Send('{DOWN}')
        Send('{DOWN}')
        Sleep(5000)
        Send("{ENTER}")

        ; popup window after you click on the manu load button
        WinWait("Information")
        WinActivate("Information")
        Send("{ENTER}")

        ; in the search field it will enter the part.txt file and press enter
        WinWait("Select File")
        WinActivate("Select File")
        Send(StringTrimRight($aParts[$i], 4) & ".txt")
        Sleep(5000)
        Send('{ENTER}')

        ; the status will appear and a dialog box will appear, click enter
        WinWait("Family Table Status")
        WinActivate("Family Table Status")
        Sleep(5000)
        Send('{ENTER}')
        Sleep(5000)

        ;After the manu process is complete
        WinWaitActive("Information")
        Sleep(5000)
        Send("{ENTER}")
        Sleep(5000)
        WinWaitActive("[CLASS:Dialog]")
        Send("viv")
        ;Send ("vinst")
        ;Send("{CTRLDOWN}s{CTRLUP}")
        ;close object window

        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes a if else function for things to be verify if needed
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

        ;Conflicts()
        ;Sleep(3000)
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes a Creo HotKey to quit object
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ;WinWaitActive("[CLASS:Dialog]")
        ;Send("qq")
        Sleep(5000)
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        ; This part of the code executes a Creo HotKey open up the PDP search window
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        WinWaitActive("[CLASS:Dialog]")
        Send("ss")

        FileWrite($log, @CRLF)

    Next

    FileClose($log)
WEnd

 

Edited by Trong
fix

Regards,
 

Link to comment
Share on other sites

It doesn't work. For some reason when it gets to this part of the code it starts the loop all over even when the window doesn't exist.

WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
Send("uf")
Sleep(5000)
If WinExists ("Menu Manager") Then
      FileWrite($log, @CRLF)
      Send("rf")
      FileWrite($log, $aParts[$i] & " Regeneration Failed")
      FileWrite($log, @CRLF)

ContinueLoop
   EndIf

 

Link to comment
Share on other sites

@Trong yeah it still doesn't work. When it gets to continue 2 it restarts the same loop I don't want it to do that I want the loop to start on the next item in the array. basically end the loop it's currently on then proceed to the next loop when the Menu manager window exist but for some reason it restart the loop and keeps proceeding to the next item in the array even when the menu manager doesnt exist.

Link to comment
Share on other sites

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#RequireAdmin
AutoItSetOption('MouseCoordMode', 0)
AutoItSetOption('SendKeyDelay', 7)

Global $sParts = @ScriptDir & "\Symbol-look-with-prt.txt" ;~ String Variable pointing to Parts.txt file
Global $aParts ;~ Array Variable


While 1

_FileReadToArray($sParts, $aParts)
$log = Fileopen(@scriptdir & "\log.txt", 10)

For $i = 1 To $aParts[0]
   FileWrite($log, $aParts[$i])
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(5000)
    MouseClick('primary', 1300, 292, 1, 0)


    ;****************************************************************************************
    ;This part of the code is for assigning a var to a part
    ;it stores the var then paste it into the search field and hits enter
    ;
    ;****************************************************************************************

    ClipPut($aParts[$i])
    Send('^v')
    Sleep(2000)
    Send("{ENTER}")

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will show the results of
    ; the ClipPut ("Value") and will show the part in PDP
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('Secondary', 415, 603, 1, 0)
     sleep(3000)
    Send('{DOWN}')
    sleep(1000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(3000)
    Send("{ENTER}")

    ;Information()
    Sleep (5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes when select instance window comes up
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWait("Select Instance")
    WinActivate("Select Instance")
    Send("{ENTER}")
    Sleep(9000)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and will click on the X button To
    ; Close the current window another way to do this is WinClose funtion
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
Send("uf")
Sleep(5000)
If WinExists ("Menu Manager") Then
      FileWrite($log, @CRLF)
      Send("rf")
      FileWrite($log, $aParts[$i] & " Regeneration Failed")
      FileWrite($log, @CRLF)

ContinueLoop
Else
   EndIf
sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(9000)
    Send('{DOWN 4}')
    Sleep(9000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(9000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and bring back the PDP search link
    ; Make sure to have MapKey created in Creo call it qq so when its called
    ; it will close the object in creo
    ;
    ; Another Mapkey that needs to be created is ss so it can bring up the PDP search
    ; site.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   #comments-start
   This part of the script locates the Tools in Creo and clicks on Family Table
   #comments-end


    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN 4}')
    Sleep(5000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")

Send("dftt")

; nv tool tab
   WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 122, 53, 1, 0)
Sleep(5000)


; this part is for the "Generate family table Columns"
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
  Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)

; This part clicks on the manu load feature
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
Send('{DOWN}')
Send('{DOWN}')
 Sleep(5000)
    Send("{ENTER}")

    ; popup window after you click on the manu load button
WinWait("Information")
WinActivate("Information")
Send("{ENTER}")

; in the search field it will enter the part.txt file and press enter
WinWait("Select File")
WinActivate("Select File")
Send (StringTrimRight($aParts[$i], 4) &".txt")
    Sleep(5000)
    Send('{ENTER}')

    ; the status will appear and a dialog box will appear, click enter
WinWait("Family Table Status")
WinActivate("Family Table Status")
Sleep(5000)
Send ('{ENTER}')
Sleep(5000)

;After the manu process is complete
WinWaitActive("Information")
Sleep(5000)
Send("{ENTER}")
Sleep (5000)
WinWaitActive("[CLASS:Dialog]")
Send("viv")

    Sleep(5000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey open up the PDP search window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

FileWrite($log, @CRLF)

Next

FileClose($log)
WEnd

;Func Information ()
 ;  If WinActivate ("Information") Then
 ;     Send("{ENTER}")
 ;  Else
 ;  EndIf
;EndFunc

Updated code I took out the information function and added winexist 

Edited by Rmedina4
Link to comment
Share on other sites

13 minutes ago, Rmedina4 said:

@Trong yeah it still doesn't work. When it gets to continue 2 it restarts the same loop I don't want it to do that I want the loop to start on the next item in the array. basically end the loop it's currently on then proceed to the next loop when the Menu manager window exist but for some reason it restart the loop and keeps proceeding to the next item in the array even when the menu manager doesnt exist.

While 1
    ; Start your script, Run again when DONE and loop forever!
    For 1 To 5
        ; Check script
        ContinueLoop 1 ; For to next intem on FOR NEXT
        ContinueLoop 2 ; For Restart your script (Run agian begin form While 1)
    Next
WEnd

 

Regards,
 

Link to comment
Share on other sites

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#RequireAdmin
AutoItSetOption('MouseCoordMode', 0)
AutoItSetOption('SendKeyDelay', 7)

Global $sParts = @ScriptDir & "\Symbol-look-with-prt.txt" ;~ String Variable pointing to Parts.txt file
Global $aParts ;~ Array Variable


While 1

_FileReadToArray($sParts, $aParts)
$log = Fileopen(@scriptdir & "\log.txt", 10)
$log1 = Fileopen(@scriptdir & "\log-Regeneration-failed.txt", 10)

For $i = 1 To $aParts[0]
   FileWrite($log, $aParts[$i])
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(5000)
    MouseClick('primary', 1300, 292, 1, 0)


    ;****************************************************************************************
    ;This part of the code is for assigning a var to a part
    ;it stores the var then paste it into the search field and hits enter
    ;
    ;****************************************************************************************

    ClipPut($aParts[$i])
    Send('^v')
    Sleep(2000)
    Send("{ENTER}")

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will show the results of
    ; the ClipPut ("Value") and will show the part in PDP
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('Secondary', 415, 603, 1, 0)
     sleep(3000)
    Send('{DOWN}')
    sleep(1000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(3000)
    Send("{ENTER}")

    ;Information()
    Sleep (5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes when select instance window comes up
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWait("Select Instance")
    WinActivate("Select Instance")
    Send("{ENTER}")
    Sleep(9000)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and will click on the X button To
    ; Close the current window another way to do this is WinClose funtion
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
Send("uf")
Sleep(9000)
If WinActive ("Menu Manager") Then
      FileWrite($log, @CRLF)
      Send("rf")
      FileWrite($log1, $aParts[$i] & " Regeneration Failed")
      FileWrite($log1, @CRLF)

ContinueLoop
Else
   EndIf
sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(9000)
    Send('{DOWN 4}')
    Sleep(9000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(9000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in Creo and bring back the PDP search link
    ; Make sure to have MapKey created in Creo call it qq so when its called
    ; it will close the object in creo
    ;
    ; Another Mapkey that needs to be created is ss so it can bring up the PDP search
    ; site.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   #comments-start
   This part of the script locates the Tools in Creo and clicks on Family Table
   #comments-end


    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN 4}')
    Sleep(5000)
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(5000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")

Send("dftt")

; nv tool tab
   WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 122, 53, 1, 0)
Sleep(5000)


; this part is for the "Generate family table Columns"
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
  Sleep(5000)
    Send("{ENTER}")
    Sleep(5000)

; This part clicks on the manu load feature
WinWaitActive("[CLASS:Dialog]")
    MouseClick('Primary', 610, 84, 1, 0)
    Sleep(5000)
    Send('{DOWN}')
Send('{DOWN}')
Send('{DOWN}')
 Sleep(5000)
    Send("{ENTER}")

    ; popup window after you click on the manu load button
WinWait("Information")
WinActivate("Information")
Send("{ENTER}")

; in the search field it will enter the part.txt file and press enter
WinWait("Select File")
WinActivate("Select File")
Send (StringTrimRight($aParts[$i], 4) &".txt")
    Sleep(5000)
    Send('{ENTER}')

    ; the status will appear and a dialog box will appear, click enter
WinWait("Family Table Status")
WinActivate("Family Table Status")
Sleep(5000)
Send ('{ENTER}')
Sleep(5000)

;After the manu process is complete
WinWaitActive("Information")
Sleep(5000)
Send("{ENTER}")
Sleep (5000)
WinWaitActive("[CLASS:Dialog]")
Send("viv")

    Sleep(5000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey open up the PDP search window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    WinWaitActive("[CLASS:Dialog]")
    Send("ss")

FileWrite($log, @CRLF)

Next

FileClose($log)
WEnd

;Func Information ()
 ;  If WinActivate ("Information") Then
 ;     Send("{ENTER}")
 ;  Else
 ;  EndIf
;EndFunc

I got it to work perfect I just had to increment the sleep before the winexist code idk why that matters but seems to work how i want it to.

Link to comment
Share on other sites

  • 4 years later...

I have this script

 

--snippet start

$body = _IEBodyReadHTML($oIE)
If StringInStr($body, "no hay") Then
   restart script (looked at plenty of code but nothing)
Else
    sound a windows notifications until clicked
EndIf

--snippet end

The 'no hay' is on the 5 page I work on so not that easy to "While ... Do"

Anyone help please?

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