Jump to content

Recommended Posts

Posted (edited)

To Whom It may concern,

I am trying to add more functionality to our AUTOIT Add Project Files Button. Basically it generates a power point file base off a name from another file. However, I'm trying to obtain a file from our file website for about 3 to 4 files. Im not sure if I need a different code or not but currently all whats running is the original code. Im really new to coding and just need some guidance of where I could be going wrong. NOTE: Even using the website path from the original code (InetGet("http://gontg/arbfixedbase/Propagation Analysis/) still does not choose the files I need after I put the name of the file I need.

 

Original Code:

;Add project files into current Project folder. User must browse to xReports folder
Func AddProjFiles($ProjPath)
    Local $ProjType = GUICtrlRead($ProjTypeIn)
    Sleep(100)

    $temp = StringLeft($ProjPath, StringInStr($ProjPath, ","))
    $temp2 = StringMid($temp, StringInStr($temp, "\") + 28)
    $city = StringLeft($temp2, StringInStr($temp2, ",") -1 )
    $State = StringMid($ProjPath, StringInStr($ProjPath, ",") + 2, 2)
    $PropType = StringMid($ProjPath, StringInStr($ProjPath, ",") + 5, 4)
    Sleep(100)

        DirCopy("\\TetonRiver\prop\template\Data\xReports", $ProjPath)
        If $PropType == "R900" Then
            Sleep(100)
                If FileExists($ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "- Services-Area Count.xlsx") Then
                    FileCopy("\\TetonRiver\prop\template\Data\xReports\Project Rxxx YYMMDD - Services-Area Count.xlsx", $ProjPath & "\(1)" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Services-Area Count.xlsx")
                    Sleep(100)
                    InetGet("http://gontg/arbfixedbase/Propagation Analysis/Project YYMMDD R900 - FN Propagation Analysis 180207.pptx", $ProjPath & "\(1)" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Prop Study.pptx")
                    Sleep(100)
                Else
                    FileCopy("\\TetonRiver\prop\template\Data\xReports\Project Rxxx YYMMDD - Services-Area Count.xlsx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Services-Area Count.xlsx")
                    Sleep(100)
                    InetGet("http://gontg/arbfixedbase/Propagation Analysis/Project YYMMDD R900 - FN Propagation Analysis 180207.pptx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Prop Study.pptx")
                    Sleep(100)
                EndIf
        ElseIf $PropType == "R450" Then
            Sleep(100)
            If FileExists($ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "- Services-Area Count.xlsx") Then
                FileCopy("\\TetonRiver\prop\template\Data\xReports\Project Rxxx YYMMDD - Services-Area Count.xlsx",  $ProjPath & "\(1)" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Services-Area Count.xlsx")
                Sleep(100)
                InetGet("http://gontg/arbfixedbase/Propagation Analysis/Project YYMMDD R450 - FN Propagation Analysis 180207.pptx", $ProjPath & "\(1)" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Prop Study.pptx")
            Else
                FileCopy("\\TetonRiver\prop\template\Data\xReports\Project Rxxx YYMMDD - Services-Area Count.xlsx",  $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Services-Area Count.xlsx")
                Sleep(100)
                InetGet("http://gontg/arbfixedbase/Propagation Analysis/Project YYMMDD R450 - FN Propagation Analysis 180207.pptx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Prop Study.pptx")
            EndIf
        EndIf
            Sleep(100)
    Run("C:\WINDOWS\EXPLORER.EXE /n,/e, """ & $ProjPath & """")
    ;Work on getting this to run with just $ProjPath
EndFunc

 

Above Result yields out only titled: "Revision" or "As Built" titled Power point presentation Files.

 

What I changed in the Code Below Highlighted in Bold (Website Path & Name of File):

#Region AddProjFiles
$AddProjFileGUI = GUICreate("Add Project Files", 300, 71, @DesktopWidth - 680, @DesktopHeight - 745)
$Browse27 = GUICtrlCreateButton("Browse", 15, 40, 60, 25, 1)
$LabelProj = GUICtrlCreateLabel("Project Type", 80, 8, 120, 40)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
$ProjTypeIn = GUICtrlCreateCombo(" ", 100, 40, 70, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, " ")
GUICtrlSetData(-1, " Revision ")
GUICtrlSetData(-1, " As Built ")
GUICtrlSetData(-1, " Cellular ")
GUICtrlSetData(-1, " Tailored ")
GUICtrlSetData(-1, " LoRa NaaS ")
GUICtrlSetData(-1, " R450 ")
Func AddProjFiles1($ProjPath)
    Local $ProjType = GUICtrlRead($ProjTypeIn)
    Sleep(100)

    $temp = StringLeft($ProjPath, StringInStr($ProjPath, ","))
    $temp2 = StringMid($temp, StringInStr($temp, "\") + 28)
    $city = StringLeft($temp2, StringInStr($temp2, ",") -1 )
    $State = StringMid($ProjPath, StringInStr($ProjPath, ",") + 2, 2)
    $PropType = StringMid($ProjPath, StringInStr($ProjPath, ",") + 5, 4)
    Sleep(100)

      DirCopy("\\TetonRiver\prop\template\Data\xReports", $ProjPath)
      If $PropType == "R900" Then
              Sleep(100)
              If FileExists($ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "- Services-Area Count.xlsx") Then
                    FileCopy("\\TetonRiver\prop\template\Data\xReports\Project Rxxx YYMMDD - Services-Area Count.xlsx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Services-Area Count.xlsx")
                    Sleep(100)
                    InetGet("http://gontg/arbfixedbase/Propagation%20Analysis/Forms/AllItems.aspx/Project R900 YYMMDD Cellular Analysis.pptx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Prop Study.pptx")
                    Sleep(100)
                  Else
                    FileCopy("\\TetonRiver\prop\template\Data\xReports\Project Rxxx YYMMDD - Services-Area Count.xlsx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Services-Area Count.xlsx")
                    Sleep(100)
                    InetGet("http://gontg/arbfixedbase/Propagation%20Analysis/Forms/AllItems.aspx/Project R900 YYMMDD Cellular Analysis.pptx", $ProjPath & "\" & $city & ", " & $state & " " & $PropType & " " & StringRight(@YEAR, 2) & @MON & @MDAY & $ProjType & "Prop Study.pptx")
               EndIf
         EndIf
         Sleep(100)
   Run("C:\WINDOWS\EXPLORERE.EXE/n,/e, """ & $ProjPath & """")
EndFunc

 

Image of Website of the 3 power point files I need (Example of what they should like like once downloaded below as well):

image.thumb.png.f326481e28413e499a868f3d36239fc6.png

 

Cellular Analysis PowerPoint File Should look like:

image.thumb.png.9e1c61348781a7650cda964403b83af3.png

 

 

LoRa NaaS Analysis PowerPoint File Should look like:

image.thumb.png.dd0e75c58487bc84afce488ac5839bd5.png

 

Tailored Analysis PowerPoint File Should look like:

 image.thumb.png.90914fb07eca6915745e8985d35eb099.png

Edited by ASING
  • ASING changed the title to Functionality to Project File Button Question/ Help Guidance Needed?
  • 3 weeks later...
Posted

Welcome to the forum!

When you post code, it's very helpful to use the <> icon in the editor. It formats the code and makes it easier to read ;)

Can you try navigating to the addresses you've listed inside of the InetGet function and verify that it downloads a file?

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...