ASING Posted December 26, 2022 Posted December 26, 2022 (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): Cellular Analysis PowerPoint File Should look like: LoRa NaaS Analysis PowerPoint File Should look like: Tailored Analysis PowerPoint File Should look like: Edited December 27, 2022 by ASING
seadoggie01 Posted January 11, 2023 Posted January 11, 2023 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
Developers Jos Posted January 11, 2023 Developers Posted January 11, 2023 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now