Fractured Posted October 16, 2018 Share Posted October 16, 2018 Windows 10 x64 - Autoit ver 3.3.14.5 Ive searched around and all I seem to find is elevating your scripts UAC. My problem is for autoit/scite to run I need to set them as Run as Admin in compatibility mode. Once I do that, the script im working on no longer sees the network drive im searching. Is there a way to de-elevate a script even if autoit/scite is elevated? Thanks! Link to comment Share on other sites More sharing options...
BrewManNH Posted October 16, 2018 Share Posted October 16, 2018 Can't you remap the drive once the process is started? The drives mapped to a user aren't visible once you run something with different credentials. 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 GudeHow 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 More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 Background - I work in a Corporate environment, in Product Testing. As of late ive gotten into Test Automation since I was no longer feeling challenged!! I have no control over the network or even my computer. This company is very "computer" restrictive and do not allow "users" to alter anything. So, I had thought of drive mapping, but as im unsure if our IT will allow it or if it can even be accomplished on this computer I will admit I didnt even try! Although the drive map would be local, and probably not permanent, the software they use to "spy" on the computers would report the map. Believe me, im on the phone all the time having to justify what im doing and how it saves time/money/man hours but it does get tiring. Guess the question would be: would the map only apply to the script that is running or would it apply to the windows environment as a whole? Link to comment Share on other sites More sharing options...
caramen Posted October 16, 2018 Share Posted October 16, 2018 (edited) Man... I work iṇ IT since 12 year. No offence but, You dont got it. I wont discuss about it since i am not working with you. IT security does not allow users to dev. Even in a free style environement the reasons are very very obvius.... Well... You can do whatever you want until you got the rigths to do that. If you got rights for one drive with one user. you can map it from anywhere under that user's rights. Exept if the computer gpo/&Or/policy does not allow you to do so. (yes it is possible to disable that). In a classic environement you wont be able to élévate without IT. Not gonna fall in a deep dark subject. Ask what you can do. Dont do something if you dont know if it s allowed. I mean we can give you 50 solutions if it s not allowed. The result will be always same. PARTICULARY In closed environnement where security is main subject. Fail about this can make big problems for you Edited October 16, 2018 by caramen Fractured 1 My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 @caramen No offense taken Been on computers since 1987, network stuff only 1 or 2 years, and programming a few months! The script used to run in our old environment when I could easily map and read across the network, but when the company got purchased by someone else they really hammered down on the security. Most of the stuff we do is on each workstation, so its never been a problem. Since the change, alot has gone wonky!! The script was just a search script for drawings, test procedures and such. no big lose other thank the speed. And just so everyone knows, I wasn't looking for a "hack the system" type of answer. Just curious on the elevation/de-elevation since I found an elevate function. Didnt know if it could work the other way around. Link to comment Share on other sites More sharing options...
caramen Posted October 16, 2018 Share Posted October 16, 2018 (edited) Yeah dont worry. Not saying you trying to hack . It's difficult to explain. I mean ....For exemple: I made codes with more than 3 month of work. These scripts was very very userfull for everyone. Less Time/work/efforts spend. But for security reasons the script was refused and sent to trash. Just saying, it is sometime looking very ridiculus since you dev in open source( Sure you would do same if that can allow you to dev .) but yeah they dont allow little actions or others actions. But there is always a purpose on each security. It seem ridiculus but it is not. Until the IT is'nt validate it. But who know ? May it's not your problem. Maybe it is technical issue. Seem like it 's not. But take care . To reply about the main question. You can do that yes. If you run you script compiled as exe. It will use the curent user rigths. And not autoIT/Scite rights. So it wont have admin/elevated permition. And you will be able to Try the script comportement with user's rights. But if you map something with rights for someone who dont have the rigths = IDEM = Face palm. Edited October 16, 2018 by caramen Fractured 1 My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 @caramen So I shall edit, compile, see if it works..if so rinse wash repeat till its back to a functioning status!! That way I know its the rights they gave me! Link to comment Share on other sites More sharing options...
caramen Posted October 16, 2018 Share Posted October 16, 2018 (edited) 1 Edit & debug. 2 Compile & see if it work. But man that is when you are sure that you got rigths problem... and not to find if you got rigths problem. Is it sensitive code ?? can you show us the code ? Edited October 16, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 (edited) ok...Compiled it works fine except for the drawings radio button...It always puts up the File Path no Found error. but all other radios/searches work... the drawings are in " S:\Drawing Vault\DWG VAULT\DWG###\#####.whatever CAD was used extension! " - hence the StringLeft... expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Search.ico #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#INDEX# ============================================================================================================================= ; Title .........: Fast Find v4.2 ; AutoIt Version : 3.3.10.2 ; Language ......: English ; Author(s) .....: Charles Wright ; Modifiers .....: ; Forum link ....: ; Description ...: Searches for documents relevant to Test ; ===================================================================================================================================== #Region #EndRegion ; #Includes# ========================================================================================================================== #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIListBox.au3> #include "GUIListViewEx.au3" #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <WinAPISysWin.au3> ; #Global Variables# =================================================================================================================== Global $RState = 0 Global $g_sFilePatha = "S:\Drawing Vault\DWG VAULT\" Global $g_sFilePathb = "S:\Drawing Vault\DWG VAULT\ATP\" Global $g_sFilePathc = "S:\Drawing Vault\DWG VAULT\Manuals\" Global $g_sFilePathd = "S:\Drawing Vault\DWG VAULT\Manuals-iso images\" Global $SlideFLag = 1 ;======================================================================================================================================= #Region ### START Koda GUI section ### Form=i:\work\macro\autoit scripts\mine\fastfind.kxf ;======================================================================================================================================= $hWnd = GUICreate("Fast Find", 1058, 160, 1788, 1) GUISetIcon("K:\Work\AutoIT Scripts\Mine\BAK Files\Search.ico", -1, $hWnd) GUISetBkColor(0xC0DCC0) $Radio1 = GUICtrlCreateRadio("Drawing", 16, 48, 113, 17) $Radio2 = GUICtrlCreateRadio("ATP", 16, 72, 113, 17) $Radio3 = GUICtrlCreateRadio("Manual", 16, 96, 113, 17) $Radio4 = GUICtrlCreateRadio("Manual-ISO", 16, 120, 113, 17) $Input1 = GUICtrlCreateInput("", 32, 16, 169, 21) $List1 = GUICtrlCreateList("", 216, 16, 817, 110) $Button1 = GUICtrlCreateButton("Search", 128, 48, 75, 25) $Button2 = GUICtrlCreateButton("Select", 592, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### HotKeySet("{PAUSE}", "_Slider") ;#Main Script / Form Control# ============================================================================================================ While 1 $nMsg1 = GUIGetMsg() Switch $nMsg1 Case $GUI_EVENT_CLOSE Exit Case $Radio1 $RState = 1 Case $Radio2 $RState = 2 Case $Radio3 $RState = 3 Case $Radio4 $RState = 4 Case $Button1 If $RState = 1 Then GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch1(GUICtrlRead($Input1))) EndIf If $RState = 2 Then GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch2(GUICtrlRead($Input1))) EndIf If $RState = 3 Then GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch3(GUICtrlRead($Input1))) EndIf If $RState = 4 Then GUICtrlSetData($List1, GUICtrlRead($Input1) = "" ? "" : _FSearch4(GUICtrlRead($Input1))) EndIf Case $Button2 Local $sResult = GUICtrlRead($List1) ShellExecute($sResult) EndSwitch WEnd ;#File Search Function 1 DWG# ======================================================================================================================== Func _FSearch1($sSearch = "DWG") GUICtrlSetData($List1, "") Local $idSearchSL = StringLeft($sSearch, 3) ;~ Store just first 3 characters of $idSearch Local $sSourceFolder = $g_sFilePatha & "DWG" & $idSearchSL MsgBox($MB_SYSTEMMODAL, "", $sSourceFolder, 10) If FileExists($sSourceFolder) = 0 Then MsgBox(4096, "File Path Error", $sSourceFolder & " does not exist.") Return "" EndIf Local $sSearchMask = $sSearch & "?.*" Local $aFileList = _FileListToArrayRec($sSourceFolder, $sSearchMask & "*|*.cdr", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileList = "" Return _ArrayToString($aFileList, "|", 1) EndFunc ;==>_FSearch1 ; #End File Search Function 1 DWG# ======================================================================================================================= ; #File Search Function 2 ATP# =========================================================================================================================== Func _FSearch2($sSearch = $Input1) GUICtrlSetData($List1, "") If FileExists($g_sFilePathb) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathb & " does not exist.") Return "" EndIf Local $sSearchMask = $sSearch & "*.*" Local $aFileListb = _FileListToArrayRec($g_sFilePathb, $sSearchMask & "*|*.vp", 1, 0, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListb = "" Return _ArrayToString($aFileListb, "|", 1) EndFunc ;==>_FSearch2 ; #End File Search Function 2 ATP# ======================================================================================================================= ; #File Search Function 3 Manuals# =========================================================================================================================== Func _FSearch3($sSearch = $Input1) GUICtrlSetData($List1, "") If FileExists($g_sFilePathc) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathc & " does not exist.") Return "" EndIf Local $sSearchMask = "IM-" & $sSearch & "*.pdf" Local $aFileListc = _FileListToArrayRec($g_sFilePathc, $sSearchMask & "*|*.vp", 1, 1, 1, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListc = "" Return _ArrayToString($aFileListc, "|", 1) EndFunc ;==>_FSearch3 ; #End File Search Function 3 Manuals# ======================================================================================================================= ; #File Search Function 4 Manuals-ISO# =========================================================================================================================== Func _FSearch4($sSearch = $Input1) GUICtrlSetData($List1, "") If FileExists($g_sFilePathd) = 0 Then MsgBox(4096, "File Path Error", "Folder : " & $g_sFilePathd & " does not exist.") Return "" EndIf Local $sSearchMask = "IM" & $sSearch & "*.iso" Local $aFileListd = _FileListToArrayRec($g_sFilePathd, $sSearchMask & "*|*.vp", 1, 0, 0, 2) ; _FileListToArrayRec(Path,Mask,Files Only,No Recurs,No Sort,File Name Only) If _ErrorCodes(@error) Then Local $aFileListd = "" Return _ArrayToString($aFileListd, "|", 1) EndFunc ;==>_FSearch4 ; #End File Search Function 3 Manuals# ======================================================================================================================= ; #Error Codes Function# ================================================================================================================================= Func _ErrorCodes($iErrorCode = 0) Switch $iErrorCode Case 1 MsgBox(4096, "File List To Array Error", "Path not found or invalid") Return 1 Case 2 MsgBox(4096, "File List To Array Error", "Invalid Include parameter") Return 1 Case 3 MsgBox(4096, "File List To Array Error", "Invalid Exclude parameter") Return 1 Case 4 MsgBox(4096, "File List To Array Error", "Invalid Exclude_Folders parameter") Return 1 Case 5 MsgBox(4096, "File List To Array Error", "Invalid $iReturn parameter") Return 1 Case 6 MsgBox(4096, "File List To Array Error", "Invalid $iRecur parameter") Return 1 Case 7 MsgBox(4096, "File List To Array Error", "Invalid $iSort parameter") Return 1 Case 8 MsgBox(4096, "File List To Array Error", "Invalid $iReturnPath parameter") Return 1 Case 9 MsgBox(4096, "File List To Array Error", "No files/folders found") Return 1 Case Else Return 0 EndSwitch EndFunc ;==>_ErrorCodes ; #End Error Codes# ==================================================================================================================================== Func _Slider() Select Case $SlideFLag = 0 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWnd, "int", 1000, "long", 0x00040004) ;slide-in from top $SlideFLag = 1 Case $SlideFLag = 1 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWnd, "int", 1000, "long", 0x00050008) ;slide-out to top $SlideFLag = 0 EndSelect EndFunc ;==>_Slider Edited October 16, 2018 by Fractured Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 16, 2018 Share Posted October 16, 2018 I access a lot of Network shares with scripts and I always use UNC paths. NEVER drive letters as they can be different between systems. \\domain\server\share\drive\Drive\ Fractured and Davidowicza 1 1 Link to comment Share on other sites More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 ahh that would be good, got the domain...now just need to figure out the server!! Link to comment Share on other sites More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 and i got it!! Thanks to @BigDaddyO for the UNC path idea!! And to @caramen for the permissions help!! Switched to the UNC paths and it seems to be working again! Link to comment Share on other sites More sharing options...
caramen Posted October 16, 2018 Share Posted October 16, 2018 Always post your code that lead to a very faster way to help. Fractured 1 My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Fractured Posted October 16, 2018 Author Share Posted October 16, 2018 yeah...should have done that from the get go even if the question didnt really fit the code till later in the postings!! Amazing what you learn! Link to comment Share on other sites More sharing options...
AceOfAllTrades Posted October 16, 2018 Share Posted October 16, 2018 This is a windows issue. When you runas admin or a different user the mappings from the logged in user won't show up. As suggested the UNC path is the best thing to use. Link to comment Share on other sites More sharing options...
mLipok Posted October 16, 2018 Share Posted October 16, 2018 1 hour ago, AceOfAllTrades said: This is a windows issue. When you runas admin or a different user the mappings from the logged in user won't show up. As suggested the UNC path is the best thing to use. This is not issue, but standard security system behavior. You could use net.exe from AutoIt scirpt to map the same drive again, and in this case the mapped shared folder will have the same credentials level, as running AutoIt scirpt. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
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