Gberrocal Posted June 24, 2020 Share Posted June 24, 2020 Hello I had to make two separate scripts because the #RequireAdmin does not work with FileCreateShortcut and FileCopy. I am unsure what the problem is and it is very inconvenient for me since I am trying to create a GUI and don't want two separate scripts. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 24, 2020 Developers Share Posted June 24, 2020 You're not really being very clear with this problem definition.... so please elaborate/show scripts/whatever is needed to explain the issue you have. 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. Link to comment Share on other sites More sharing options...
Danp2 Posted June 24, 2020 Share Posted June 24, 2020 Might be good if you posted some code to show us what you are trying to do. Otherwise, we can only guess. Also, "not working" isn't a great description of what is occurring. Did you receive an error message? Did you check the value of @error? Etc. My WAG is that you are trying to create a shortcut in the local user's directory, but can't because you are using #RequireAdmin. Might help if you explained why you are running with #RequireAdmin. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Gberrocal Posted June 24, 2020 Author Share Posted June 24, 2020 Sorry for the confusion, here is the code. The issue is when I use #RequireAdmin the script runs and doesn't place any of the icons on the desktop. Btw I am also logged in as a regular user and then putting in admin credentials when it requires me to. I am also using the #RequireAdmin because regular users can't install applications and that is part of the other half of the script. ;Shortcut Creations FileCreateShortcut("C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE", @DesktopDir & "\Excel.lnk") FileCreateShortcut("C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE", @DesktopDir & "\Outlook.lnk") FileCreateShortcut("C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE", @DesktopDir & "\Word.lnk") ;RDP Shortcut New Server FileCopy("\\computer\Shortcuts\Remote Desktop.rdp", @DesktopDir , 0) ;RDP Shortcut Old Server FileCopy("\\computer\Shortcuts\Remote Desktop(Old).rdp", @DesktopDir , 0) ;URL Link Shortcuts FileCopy("\\computer\avidxchange.ico",@LocalAppDataDir,0) FileCopy("\\computer\condocerts.ico",@LocalAppDataDir,0) FileCopy("\\computer\TOPS ONE.ico",@LocalAppDataDir,0) FileCreateShortcut("https://payableslockbox.com/Login.aspx", @DesktopDir & "\AvidXChange.lnk","","","", @LocalAppDataDir & "\avidxchange.ico") FileCreateShortcut("https://condocerts.com/resaleManagement/index.cfm?&CFID=5306583&CFTOKEN=1b2e3b00b7695aeb-0D45B142-5056-B80F-3A39D89DFE7A99F0&jsessionid=876DA4C2D47C1D95CC20F42C10A04509.cfusion&rsi=567CC6CE272555CDA934FE5AEFCA5124", @DesktopDir & "\CondoCerts.lnk","","","", @LocalAppDataDir & "\condocerts.ico") FileCreateShortcut("https://one.topssoft.com/", @DesktopDir & "\TOPS ONE.lnk","","","", @LocalAppDataDir & "\TOPS ONE.ico") ;Teams Desktop Icon Delete FileDelete(@DesktopDir & "\Microsoft Teams.lnk") Link to comment Share on other sites More sharing options...
Danp2 Posted June 24, 2020 Share Posted June 24, 2020 (edited) Check the value of @DesktopDir to make sure it's pointing to the desired directory (use a MsgBox because ConsoleWrite won't work with #RequireAdmin). Also check the value of @error following the call to FileCreateShortcut. FWIW, this ran for me and gave the expected results -- #RequireAdmin MsgBox(0, '@DesktopDir', @DesktopDir) FileCreateShortcut("C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE", @DesktopDir & "\Excel.lnk") MsgBox(0, "@error", @error) Edited June 24, 2020 by Danp2 Strike out my incorrect statement Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Gberrocal Posted June 24, 2020 Author Share Posted June 24, 2020 So after running it, it looks like the DesktopDir is changed to my admin account desktop instead on the user I am logged in as, is their a way around this? Link to comment Share on other sites More sharing options...
Nine Posted June 24, 2020 Share Posted June 24, 2020 21 minutes ago, Danp2 said: ConsoleWrite won't work with #RequireAdmin It has been solved long time ago, now working with or without... Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nine Posted June 24, 2020 Share Posted June 24, 2020 20 minutes ago, Gberrocal said: So after running it, it looks like the DesktopDir is changed to my admin account desktop instead on the user I am logged in as, is their a way around this? One way : run a first script that read user desktop and run the main script passing the user desktop as command line parameter. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted June 24, 2020 Share Posted June 24, 2020 What about using @DesktopCommonDir instead of @DesktopDir? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
rudi Posted June 26, 2020 Share Posted June 26, 2020 I cannot see at all why you think you need #RequireAdmin At a glance I see only writes to @LocalAppDataDir and @DesktopDir. To both folders the currently loggedon user *HAS* write access. These filecopies won't work, as no share name is specified: FileCopy("\\computer\avidxchange.ico",@LocalAppDataDir,0) This has to be something like this, and for filecopies I love to use "CreatePath" in case someone has deleted the expected directory, and "overwrite" to replace an already existing file with the currently wanted version (8+1) FileCopy("\\computer\share\path\path\avidxchange.ico",@LocalAppDataDir,8+1) Rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Gberrocal Posted June 29, 2020 Author Share Posted June 29, 2020 On 6/24/2020 at 5:26 PM, Danp2 said: What about using @DesktopCommonDir instead of @DesktopDir? Yeah I may just use this for now, I didn't really want to put icons on the public desktop but instead their personal account but I can't play with this script for too long. Link to comment Share on other sites More sharing options...
Gberrocal Posted June 29, 2020 Author Share Posted June 29, 2020 On 6/26/2020 at 8:15 AM, rudi said: I cannot see at all why you think you need #RequireAdmin At a glance I see only writes to @LocalAppDataDir and @DesktopDir. To both folders the currently loggedon user *HAS* write access. These filecopies won't work, as no share name is specified: FileCopy("\\computer\avidxchange.ico",@LocalAppDataDir,0) This has to be something like this, and for filecopies I love to use "CreatePath" in case someone has deleted the expected directory, and "overwrite" to replace an already existing file with the currently wanted version (8+1) FileCopy("\\computer\share\path\path\avidxchange.ico",@LocalAppDataDir,8+1) Rudi I do have the share drive name correctly inputted on my script. I also need admin access because regular users can not install applications and the other part of the script does that. 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