Jump to content

Acceptable script?


mr-es335
 Share

Recommended Posts

Good day,

; -----------------------------------------------
#include <AutoItConstants.au3>
#include <FileConstants.au3>
; -----------------------------------------------
Call_Me_A()
Call_Me_B()
Call_Me_C()
; -----------------------------------------------
Func Call_Me_A()
    Call_Me_A1()
    Call_Me_A2()
EndFunc   ;==>Call_Me_A
; -----------------------------------------------
Func Call_Me_A1()
    ; Insert code here!
EndFunc   ;==>Call_Me_A1
; -----------------------------------------------
Func Call_Me_A2()
    ; Insert code here!
EndFunc   ;==>Call_Me_A2
; -----------------------------------------------
Func Call_Me_B()
    Call_Me_B1()
    Call_Me_B2()
EndFunc   ;==>Call_Me_B
; -----------------------------------------------
Func Call_Me_B1()
    ; Insert code here!
EndFunc   ;==>Call_Me_B1
; -----------------------------------------------
Func Call_Me_B2()
    ; Insert code here!
EndFunc   ;==>Call_Me_B2
; -----------------------------------------------
; -----------------------------------------------
Func Call_Me_C()
    Call_Me_C1()
    Call_Me_C2()
EndFunc   ;==>Call_Me_C
; -----------------------------------------------
Func Call_Me_C1()
    ; Insert code here!
EndFunc   ;==>Call_Me_C1
; -----------------------------------------------
Func Call_Me_C2()
    ; Insert code here!
EndFunc   ;==>Call_Me_C2
; -----------------------------------------------

Any assistance in this matter would be greatly appreciated!

Edited by mr-es335
Link to comment
Share on other sites

Looks like a good start.

33 minutes ago, mr-es335 said:

Any assistance in this matter would be greatly appreciated!

Sure, what would you like this script to do?  What type of 'call' would you like the script to make?  Will it be voice telephone calls, or something else?

Edited by Xandy
Link to comment
Share on other sites

Xandy,

Thanks for the reply...appreciated!

Quite simply really...

1. To create a folder structure
2. Copy specific data to some of those folders

That is pretty much "it"!

Would the following would be consider "inappropriate"?

; -----------------------------------------------
#include <AutoItConstants.au3>
#include <FileConstants.au3>
; -----------------------------------------------
Call_Me_A()
Call_Me_B()
Call_Me_C()
; -----------------------------------------------
Func Call_Me_A()
    Call_Me_A1()
    Call_Me_A2()
EndFunc   ;==>Call_Me_A
    ; -----------------
    Func Call_Me_A1()
        ; Insert code here!
    EndFunc   ;==>Call_Me_A1
    ; -----------------
    Func Call_Me_A2()
        ; Insert code here!
    EndFunc   ;==>Call_Me_A2
; -----------------------------------------------
; -----------------------------------------------
Func Call_Me_B()
    Call_Me_B1()
    Call_Me_B2()
EndFunc   ;==>Call_Me_B
    ; -----------------
    Func Call_Me_B1()
        ; Insert code here!
    EndFunc   ;==>Call_Me_B1
    ; -----------------
    Func Call_Me_B2()
        ; Insert code here!
    EndFunc   ;==>Call_Me_B2
; -----------------------------------------------
; -----------------------------------------------
Func Call_Me_C()
    Call_Me_C1()
    Call_Me_C2()
EndFunc   ;==>Call_Me_C
    ; -----------------
    Func Call_Me_C1()
        ; Insert code here!
    EndFunc   ;==>Call_Me_C1
    ; -----------------
    Func Call_Me_C2()
        ; Insert code here!
    EndFunc   ;==>Call_Me_C2
; -----------------------------------------------
; -----------------------------------------------

How about this?

; -----------------------------------------------
#include <AutoItConstants.au3>
#include <FileConstants.au3>
; -----------------------------------------------
Call_Me_A()
; -----------------------------------------------
Func Call_Me_A()
    Call_Me_A1()
    Call_Me_A2()
    Call_Me_B()
    Call_Me_C()
EndFunc   ;==>Call_Me_A
    ; -----------------
    Func Call_Me_A1()
        ; Insert code here!
    EndFunc   ;==>Call_Me_A1
    ; -----------------
    Func Call_Me_A2()
        ; Insert code here!
    EndFunc   ;==>Call_Me_A2
    ; -----------------
    ; -----------------
    Func Call_Me_B()
        Call_Me_B1()
        Call_Me_B2()
    EndFunc   ;==>Call_Me_B
    ; -----------------
        Func Call_Me_B1()
            ; Insert code here!
        EndFunc   ;==>Call_Me_B1
        ; -----------------
        Func Call_Me_B2()
            ; Insert code here!
        EndFunc   ;==>Call_Me_B2
    ; -----------------
    ; -----------------
    Func Call_Me_C()
        Call_Me_C1()
        Call_Me_C2()
    EndFunc   ;==>Call_Me_C
        ; -----------------
    Func Call_Me_C1()
        ; Insert code here!
    EndFunc   ;==>Call_Me_C1
    ; -----------------
    Func Call_Me_C2()
        ; Insert code here!
    EndFunc   ;==>Call_Me_C2
; -----------------------------------------------
; -----------------------------------------------

 

Edited by mr-es335
Link to comment
Share on other sites

1 hour ago, mr-es335 said:

Would the following would be consider "inappropriate"?

No, I don't think so.  Seems legit to me.

1 hour ago, mr-es335 said:

1. To create a folder structure
2. Copy specific data to some of those folders

That can certainly be done.

DirCreate(path)
DirMove(source, dest, flag); use help file for flags
FileMove(source, dest, flag); use help file for flags

There could be better ways, but those are some tools above.

Edited by Xandy
Link to comment
Share on other sites

Xandy,

One more...

; -----------------------------------------------
#include <AutoItConstants.au3>
#include <FileConstants.au3>
; -----------------------------------------------
Call_Me_A()
; -----------------------------------------------
Func Call_Me_A()
    Call_Me_A1()
EndFunc   ;==>Call_Me_A
; -----------------
Func Call_Me_A1()
    ; Insert code here!
    Call_Me_B()
EndFunc   ;==>Call_Me_A1
; -----------------
; -----------------
Func Call_Me_B()
    Call_Me_B1()
EndFunc   ;==>Call_Me_B
; -----------------
Func Call_Me_B1()
    ; Insert code here!
    Call_Me_C()
EndFunc   ;==>Call_Me_B1
; -----------------
; -----------------
Func Call_Me_C()
    Call_Me_C1()
EndFunc   ;==>Call_Me_C
; -----------------
Func Call_Me_C1()
    ; Insert code here!
EndFunc   ;==>Call_Me_C1
; -----------------------------------------------
; -----------------------------------------------

 

Link to comment
Share on other sites

Honestly I don't really know.  It's difficult for me to approve your structure logic without the code meat.  I worked all day, if there is a slight structure fail.  I'm not likely to notice it right now.  Best of luck mate.  I hope you enjoy your time programming.  I always do.

Link to comment
Share on other sites

@mr-es335 Anything is appropriate if you have the right use case, even some "inappropriate" things like GOTO are appropriate in the right circumstances. (It doesn't exist in AutoIt by the way.)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

My understanding of a nested function would be:

Func Fruit()
    Func Apple()
        ; Apple Code
    EndFunc; Apple
    Func Cavendish()
        ; Cavendish Code
    EndFunc; Cavendish
EndFunc; Fruit

As far as I know, the above would not execute and be improper in AutoIt.

Edited by Xandy
Link to comment
Share on other sites

Xandy,

You are absolutely correct...no matter how you attempt to rectify the above sampling...

I do find this "interesting: to-say-the-least, in that in all of the examples that I have provided, that all "return" successfully!

Thus, we could assume, that such implementations are "appropriate"!

PS: I am completing a script, which, when completed, I will then post for "critique"!

Thanks again, Xandy, for your insight! Appreciated!

Link to comment
Share on other sites

Good day,

Okay...following is my completed script...

; -----------------------------------------------
#include <AutoItConstants.au3>
#include <FileConstants.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Local $hGUI = GUICreate("Session_Master Folder Development", 345, 155)
GUISetFont(12, $FW_BOLD, $GUI_FONTNORMAL, "Calibri")
; -----------------------------------------------
Local $Dev_Fldrs = GUICtrlCreateButton("Dev Fldrs", 20, 20, 150, 25)
Local $Copy_SM_Folder = GUICtrlCreateButton("Copy SM Folder", 20, 50, 150, 25)
Local $Launch_Both = GUICtrlCreateButton("Launch Both", 20, 80, 150, 25)
Local $Exit_Both = GUICtrlCreateButton("Exit Both", 20, 110, 150, 25)
; -----------------
Local $ExitMe = GUICtrlCreateButton("Exit", 175, 20, 150, 25)
; -----------------------------------------------
GUISetState(@SW_SHOW, $hGUI)
;$Pic1=GUICtrlCreatePic("@ScriptDir & "\Data\bg_img.bmp", 640, 120, 150, 175)
; -----------------------------------------------
While 1
    Switch GUIGetMsg()
        Case $Dev_Fldrs
            Dev_Fldrs()
        Case $Copy_SM_Folder
            Copy_SM_Folder()
        Case $Launch_Both
            Launch_Both()
        Case $Exit_Both
            Exit_Both()
        Case $ExitMe
            ExitMe()
    EndSwitch
WEnd
; -----------------------------------------------
Func Dev_Fldrs()
    Call_Intro()
EndFunc   ;==>Dev_Fldrs
    Func Call_Intro()
        SplashTextOn("NOTICE!!", "Create Session_Master folders...", 450, 50, -1, -1)
        Sleep(2000)
        SplashOff()
        Create_Main_Folder()
    EndFunc   ;==>Call_Intro
    ; -----------------
        Create_Main_Folder()
        Func Create_Main_Folder()
            Local $_main_folder = "E:\Master_Backup\Session_Master"
            ; ------
            DirCreate($_main_folder)
            Create_Sub_Folders1()
        EndFunc   ;==>Create_Main_Folder
        ; -----------------
        Create_Sub_Folders1()
        Func Create_Sub_Folders1()
            Local $_main_folder = "E:\Master_Backup\Session_Master"
            Local $_show_folder = "E:\Master_Backup\Session_Master\Show"
            Local $_scenes_folder = "E:\Master_Backup\Session_Master\Scenes"
            Local $_su_folder = "E:\Master_Backup\Session_Master\Session_Undo"
            ; ------
            FileChangeDir($_main_folder)
            DirCreate($_show_folder)
            DirCreate($_scenes_folder)
            DirCreate($_su_folder)
            Create_Sub_Folders2()
        EndFunc   ;==>Create_Sub_Folders1
        ; -----------------
        Create_Sub_Folders2()
            Func Create_Sub_Folders2()
            Local $_show_folder = "E:\Master_Backup\Session_Master\Show"
            Local $_sd_folder = "E:\Master_Backup\Session_Master\Show\Session_Data"
            Local $_su_folder = "E:\Master_Backup\Session_Master\Show\Session_Undo"
            ; ------
            FileChangeDir($_show_folder)
            DirCreate($_sd_folder)
            DirCreate($_su_folder)
            Copy_Scenes()
        EndFunc   ;==>Create_Sub_Folders2
        ; -----------------
        Func Copy_Scenes()
            Local $src_folder="E:\Master_Backup\3_Integrated\Session_Master\Scenes"
            Local $dest_folder="E:\Master_Backup\Session_Master\Scenes"
            ; ------
            DirCopy($src_folder, $dest_folder, $FC_OVERWRITE)
            Copy_Show_Data()
        EndFunc
        ; -----------------
        Func Copy_Show_Data()
            Local $src_data="E:\Master_Backup\3_Integrated\Session_Master\Shows\Master_Show.shw"
            Local $dest_folder="E:\Master_Backup\Session_Master\Show"
            ; ------
            FileCopy($src_data, $dest_folder, $FC_OVERWRITE)
            Copy_Session_Data()
        EndFunc   ;==>Copy_Show_Data
        ; -----------------
        Func Copy_Session_Data()
            Local $src_data1="E:\Master_Backup\3_Integrated\Session_Master\*.edl"
            Local $src_data2="E:\Master_Backup\3_Integrated\Session_Master\*.mxs"
            Local $dest_folder="E:\Master_Backup\Session_Master"
            ; -----------------
            FileCopy($src_data1, $dest_folder, $FC_OVERWRITE)
            FileCopy($src_data2, $dest_folder, $FC_OVERWRITE)
            Copy_Doc_Data()
        EndFunc   ;==>Copy_Session_Data
        ; -----------------
        Func Copy_Doc_Data()
            Local $src_data="E:\Master_Backup\3_Integrated\Session_Master\Sets\Type_1\Session_Data\*.doc"
        Local $dest_folder="E:\Master_Backup\Session_Master\Show\Session_Data"
        ; -----------------
        FileCopy($src_data, $dest_folder, $FC_OVERWRITE)
        Call_Outro()
        EndFunc   ;==>Copy_Doc_Data
        ; -----------------
        Call_Outro()
            Func Call_Outro()
            SplashTextOn("NOTICE!!", "Create Session_Master folders completed...", 450, 50, -1, -1)
            Sleep(2000)
            SplashOff()
        EndFunc   ;==>Call_Outro
; -----------------------------------------------
Func Copy_SM_Folder()
    Local $_src_fldr="E:\Master_Backup\Session_Master"
    Local $_dest_fldr="G:\Session_Master"
    ; -----------------
    SplashTextOn("NOTICE!!", "Copy Session_Master folder...", 450, 50, -1, -1)
    Sleep(2000)
    SplashOff()
    ; -----------------
    DirCopy($_src_fldr, $_dest_fldr, $FC_OVERWRITE)
    ; -----------------
    SplashTextOn("NOTICE!!", "Copy Session_Master folder completed...", 450, 50, -1, -1)
    Sleep(2000)
    SplashOff()
EndFunc   ;==>Copy_SM_Folder
; -----------------------------------------------
Func Launch_Both()
    Local $_app1 = "C:\Windows\toggleTaskbarAutohide.exe"
    Local $_app2 = "C:\RML\SAC\SAC64.exe"
    Local $_app3 = "C:\RML\SAW\SAWStudio64.exe"
    ; ------
    Run($_app1)
    Sleep(100)
    ; ------
    Run($_app2)
    Sleep(250)
    MouseClick($MOUSE_CLICK_RIGHT, 27, 56, 1, 2)
    Send("{F11}")
    Sleep(2500)
    ; ------
    Run($_app3)
EndFunc   ;==>Launch_Both
; -----------------------------------------------
Func Exit_Both()
    Local $_app1 = "C:\Windows\toggleTaskbarAutohide.exe"
    Local $_app2 = "C:\RML\SAC\SAC64.exe"
    Local $_app3 = "C:\RML\SAW\SAWStudio64.exe"
    Local $PID = 0
    ; ------
    ProcessClose($_app3)
    $PID = ProcessExists("SAWStudio64.exe")
    If $PID Then ProcessClose($PID)
    ProcessClose($_app2)
    ; ------
    $PID = ProcessExists("SAC64.exe")
    If $PID Then ProcessClose($PID)
    ; ------
    Run($_app1)
    Sleep(100)
EndFunc   ;==>Exit_Both
; -----------------------------------------------
Func ExitMe()
    Exit
EndFunc   ;==>ExitMe
; -----------------------------------------------

Observations

A: All within Func Dev_Fldrs()
B: Standalone

2.png.c53c1960902e2e274c9d3478e967e2a8.png

 

 

 

 

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