Jump to content

File looping (HELP)


Recommended Posts

Use the window's handle and not it's title.

https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

When I get to this step in the code with every new part the window handle will change after each loop because every loop pulls in a new part.  I don't want to have to hardcode all the window handles. Correct me if I'm wrong.

Link to comment
Share on other sites

@Subz I tried your command doesn't seem to work, it doesn't output "Family Table: it only outputs the StringTrimright command. I did testing to see what it's actually populating and it only displays the bottom portion "window doesnt exist" If I change that to Family Table  :" & StringTrimRight($aParts[$i], 4 it will display correctly but for some reason it doesn't activate the Winexist 

 

Func Example()
If WinExists ("Family Table  :" & StringTrimRight($aParts[$i], 4)) Then
    MsgBox($MB_SYSTEMMODAL, "", "Family Table :" & StringTrimRight($aParts[$i], 4))
 Else
     MsgBox($MB_SYSTEMMODAL, "", "window doesn't exist")
     EndIf
EndFunc

 

Link to comment
Share on other sites

Sorry just copied your code above, I believe your issues are spaces, you need to check where the spaces should be so in your code above I noticed you a double space between (Table) and the end colon (:), with no space afterwards

Quote

"Family Tablexx:" & StringTrimRight($aParts[$i], 4) = Family Tablexx:Part Name
nb: xx represents space

In my last post I had added a space after the colon:

Quote

"Family Table :x" & StringTrimRight($aParts([$i], 4) = Family Table :xPart Name

Once you figure out the spacing you should be alright

Link to comment
Share on other sites

yeah, I can't figure out the spacing. the window info it shows like this

Family Table :CAP_SMD_3528

My code is:

Func Example()
If WinActivate ("Family Table   :" & StringTrimRight($aParts[$i], 4)) Then
    MsgBox($MB_SYSTEMMODAL, "", "Coreect")
 Else
     MsgBox($MB_SYSTEMMODAL, "", "Sorry")
     EndIf
  EndFunc

Cap_smd_3528 is the part just fyi

 

I keep getting back sorry ...I tried all types of spacing single double triple and nothing works. Even when I output "Family Table   :" & StringTrimRight($aParts[$i], 4 in the message box it looks identical as what the Autoit Window tool shows me.

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
        _FileReadToArray($sParts, $aParts)

For $i = 1 To $aParts[0]
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(2000)
    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')
    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('primary', 372, 595, 1, 0)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will click on the Action button
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('primary', 312, 366, 1, 0)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will click on the Action button, scroll
    ; down, right, enter then it will open in Creo and populate the 3D model
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(9000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(9000)
    Send("{ENTER}")
    Sleep(7000)
    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
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    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


    ; Creo tools Tab
   WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 479, 53, 1, 0)


   ; This function clicks on FT and open it

    sleep(9000)
    WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
    MouseClick('Primary', 541, 102, 1, 0)


Example()
Func Example()
If WinActivate ("Family Table   :" & StringTrimRight($aParts[$i], 4)) Then
    MsgBox($MB_SYSTEMMODAL, "", "Correct")
 Else
     MsgBox($MB_SYSTEMMODAL, "", "Sorry")
     EndIf
  EndFunc

Full code above

Autoit window tool info down below:

2017-06-30_18-45-24.jpg

Edited by Rmedina4
more information to add
Link to comment
Share on other sites

For  Family Table :CAP_SMD_3528  you should be using something like this, if you run this within Scite it should output the name to the console.

Func Example()
    Local $sWinTitle = "Family Table :" & StringTrimRight($aParts[$i], 4) 
    WinActivate($sWinTitle, "")
    ConsoleWrite($sWinTitle & @CRLF)
    If WinActive($sWinTitle, "") Then
        MsgBox(4096, "", $sWinTitle & " is active.")
    Else
        MsgBox(4096, "", $sWinTitle & " is inactive.")
    EndIf
EndFunc

 

Link to comment
Share on other sites

Maybe this?

Send(StringTrimRight($aParts[$i], 4) & ".txt")

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Quick question: Can I control a drop down list like controlclick funtion does with a button?

 

My basic control info is down below. .....I want control the class:List instance 2 so It automatically clicks it and I can send 2 down command then enter. I can do it with mouse clicks but curious if I can control the list. If so how?

 

Thank you,

 

2017-07-11_18-48-45.jpg

Link to comment
Share on other sites

My script is complete and was working perfect this morning and it goes thru one full cycle and starts the second loop but when it gets to one command (Send ("lop"))

it doesn't run it just stalls.. Any clue on why? Doesn't make sense to me because it does one full cycle and starts to work on the second loop but stops when it gets to that part of the code. it worked perfect this morning and now it doesn't work, plus I didn't change anything either. Also it finish the 

WinWait("Select Instance")
    WinActivate("Select Instance")
    Send("{ENTER}")
    Sleep(9000)

part of the code which is right before the Send command

Here is my code:

#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
        _FileReadToArray($sParts, $aParts)

For $i = 1 To $aParts[0]
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    sleep(2000)
    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])
    sleep(3000)
    Send('^v')
    Sleep(3000)
    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(5000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('primary', 372, 595, 1, 0)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will click on the Action button
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(5000)
    WinWait("Creo Parametric")
    WinActivate("Creo Parametric")
    MouseClick('primary', 292, 366, 1, 0)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in PDP and will click on the Action button, scroll
    ; down, right, enter then it will open in Creo and populate the 3D model
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    sleep(5000)
    Send('{DOWN}')
    Send('{RIGHT}')
    sleep(5000)
    Send("{ENTER}")
    Sleep(5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This part of the code executes in creo and will run thru a if else statement for when
    ; the information dialog box pops up
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    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 a Creo HotKey to load parameters
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   Send("lop")
   Sleep(5000)
   
   
   WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    WinWaitActive("Parameter Status",'')
    Send("{ENTER}")
    Sleep(5000)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey to delete Family table instances
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

WinWait("[CLASS:Dialog]")
    WinActivate ("[CLASS:Dialog]")
Send("dft")

; 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("{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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 Send("qq")
    Sleep(5000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This part of the code executes a Creo HotKey open up the PDP search window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Send("ss")


Next



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


Func Conflicts()
   Sleep(5000)
   If WinActivate("Conflicts") Then
      WinWait("Conflicts")
      WinActivate("Conflicts")
      MouseClick('primary', 483, 104, 1, 0)
      Sleep(3000)
      Send('{DOWN}')
      Send('{DOWN}')
      Send("{ENTER}")
      WinWait("Conflicts")
      WinActivate("Conflicts")
      MouseClick('primary', 472, 318, 1, 0)
      Sleep(4000)
      Send("{CTRLDOWN}s{CTRLUP}")
   Else
   EndIf
EndFunc

 

Link to comment
Share on other sites

  • 2 weeks later...
#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
        _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
   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)

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

I decided to use the if else statement in the script instead of making a function but when I do it this way it works half way. Everytime when the window ("Menu manager") doesn't exist it still starts to loop over which I don't want to happen. I only want it to happen when the window exist.

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