
aerilus
Members-
Posts
7 -
Joined
-
Last visited
aerilus's Achievements
-
thank you for your help, there is no reason its in a different while loop just ignorance, I moved to the nested case structure and put the guidelete right after. I moved the regwrite into the same while loop. . Now my problem is that the regwrite wont pick up the variable $msg2. if i put something static there it will write it, but it will not put whats in the gui input and write it to the reg. I get the feeling its something to do with my expression stucture. When I am seeing other variables inside functions they are preceded by "&" but looking through the help file and searching "variables inside functions" isn't netting me the reason why. I know its expecting something like "1234" and what I am seeing people do is something like "123" & $4 but apparently "" & $msg2 isn't the write way to accomplish what I want because it throws syntax errors at me #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=c:/test6.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Denton\Documents\Form1.kxf $Form1 = GUICreate("Printer Install", 350, 446, 192, 124) $Label1 = GUICtrlCreateLabel("Please selct the printer you would like to install then click OK.", 16, 8, 292, 17) $Student_Accounts = GUICtrlCreateRadio("Student_Accounts", 24, 32, 113, 17) $Campbell = GUICtrlCreateRadio("Campbell", 24, 64, 113, 17) $Health_Center = GUICtrlCreateRadio("Health_Center", 24, 96, 113, 17) $Admissions = GUICtrlCreateRadio("Admissions", 24, 128, 113, 17) $Fin_Aid = GUICtrlCreateRadio("Fin_Aid", 24, 160, 113, 17) $Odell = GUICtrlCreateRadio("Odell", 24, 192, 113, 17) $Proctor_East = GUICtrlCreateRadio("Proctor_East", 24, 224, 113, 17) $Registar = GUICtrlCreateRadio("Registar", 24, 256, 113, 17) $Career_Center = GUICtrlCreateRadio("Career_Center", 24, 288, 113, 17) $Reynolds = GUICtrlCreateRadio("Reynolds", 24, 320, 113, 17) $Cowan = GUICtrlCreateRadio("Cowan", 160, 32, 113, 17) $Business_Office = GUICtrlCreateRadio("Business_Office", 160, 64, 113, 17) $Hanes_Gym = GUICtrlCreateRadio("Hanes_Gym", 160, 96, 113, 17) $Institutional_Advancement = GUICtrlCreateRadio("Institutional_Advancement", 160, 128, 150, 17) $Library = GUICtrlCreateRadio("Library", 160, 160, 113, 17) ;$Radio16 = GUICtrlCreateRadio("Radio16", 160, 192, 113, 17) ;$Radio17 = GUICtrlCreateRadio("Radio17", 160, 224, 113, 17) ;$Radio18 = GUICtrlCreateRadio("Radio18", 160, 256, 113, 17) $Label2 = GUICtrlCreateLabel("*****enter you account code here******", 160, 224) $Account = GUICtrlCreateInput("", 160, 256) $OK = GUICtrlCreateButton("OK", 152, 312, 75, 25) $Label3 = GUICtrlCreateLabel("Please enter your copier account code before pressing OK. After pressing OK select yess at the prompt then wait a few seconds for the printer installer to pop up", 16, 360, 300, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select ;Check if user clicked on the close button Case $msg = $GUI_EVENT_CLOSE ;Destroy the GUI including the controls GUIDelete() ;Exit the script Exit Case $msg = $OK Select Case GUICtrlRead($Proctor_East) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.22.0.224 /port:10.22.0.224") Case GUICtrlRead($Student_Accounts) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.217 /port:10.5.0.217") Case GUICtrlRead($Campbell) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.26.0.224 /port:10.26.0.224") Case GUICtrlRead($Health_Center) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.23.0.224 /port:10.23.0.224") Case GUICtrlRead($Library) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.20.0.224 /port:10.20.0.224") Case GUICtrlRead($Admissions) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.30.0.224 /port:10.30.0.224") Case GUICtrlRead($Fin_Aid) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.224 /port:10.5.0.224") Case GUICtrlRead($Odell) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.33.0.224 /port:10.33.0.224") Case GUICtrlRead($Registar) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.219 /port:10.5.0.219") Case GUICtrlRead($Career_Center) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.218 /port:10.5.0.218") Case GUICtrlRead($Reynolds) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.41.0.224 /port:10.41.0.224") Case GUICtrlRead($Cowan) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.32.0.224 /port:10.32.0.224") Case GUICtrlRead($Business_Office) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.220 /port:10.5.0.220") Case GUICtrlRead($Hanes_Gym) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.28.0.224 /port:10.28.0.224") Case GUICtrlRead($Institutional_Advancement) = $GUI_CHECKED ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.221 /port:10.5.0.221") EndSelect GUIDelete($Form1) EndSelect $msg2 = GUICtrlRead($Account) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Lexmark Copier\PrinterDriverData", "AccountTrackAccountNumber", "REG_SZ", $msg2) WEND
-
I'm working on my first script I have the skeleton set up and working. it pretty much runs a silent installer with a different argument per radio button. the first thing I am having trouble with is getting the gui to be destroyed after the ok button is hit. the second thing is that after waiting for the process started by pressing the ok button to finish i would like it to write a registry entry. it seems like I need a nested if statement but when I try something like that I light up like a christmas tree with syntax errors. any help is appreciated even if someone could just point me to some sample code that might be applicable. everything I can find seems to focus more on snippets rather than how to tie them together. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=c:/test6.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Denton\Documents\Form1.kxf $Form1 = GUICreate("Printer Install", 350, 446, 192, 124) $Label1 = GUICtrlCreateLabel("Please selct the printer you would like to install then click OK.", 16, 8, 292, 17) $Student_Accounts = GUICtrlCreateRadio("Student_Accounts", 24, 32, 113, 17) $Campbell = GUICtrlCreateRadio("Campbell", 24, 64, 113, 17) $Health_Center = GUICtrlCreateRadio("Health_Center", 24, 96, 113, 17) $Admissions = GUICtrlCreateRadio("Admissions", 24, 128, 113, 17) $Fin_Aid = GUICtrlCreateRadio("Fin_Aid", 24, 160, 113, 17) $Odell = GUICtrlCreateRadio("Odell", 24, 192, 113, 17) $Proctor_East = GUICtrlCreateRadio("Proctor_East", 24, 224, 113, 17) $Registar = GUICtrlCreateRadio("Registar", 24, 256, 113, 17) $Career_Center = GUICtrlCreateRadio("Career_Center", 24, 288, 113, 17) $Reynolds = GUICtrlCreateRadio("Reynolds", 24, 320, 113, 17) $Cowan = GUICtrlCreateRadio("Cowan", 160, 32, 113, 17) $Business_Office = GUICtrlCreateRadio("Business_Office", 160, 64, 113, 17) $Hanes_Gym = GUICtrlCreateRadio("Hanes_Gym", 160, 96, 113, 17) $Institutional_Advancement = GUICtrlCreateRadio("Institutional_Advancement", 160, 128, 150, 17) $Library = GUICtrlCreateRadio("Library", 160, 160, 113, 17) ;$Radio16 = GUICtrlCreateRadio("Radio16", 160, 192, 113, 17) ;$Radio17 = GUICtrlCreateRadio("Radio17", 160, 224, 113, 17) ;$Radio18 = GUICtrlCreateRadio("Radio18", 160, 256, 113, 17) $Label2 = GUICtrlCreateLabel("*****enter you account code here******", 160, 224) $Account = GUICtrlCreateInput("", 160, 256) $OK = GUICtrlCreateButton("OK", 152, 312, 75, 25) $Label3 = GUICtrlCreateLabel("Please enter your copier account code before pressing OK. After pressing OK select yess at the prompt then wait a few seconds for the printer installer to pop up", 16, 360, 300, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select ;Check if user clicked on the close button Case $msg = $GUI_EVENT_CLOSE ;Destroy the GUI including the controls GUIDelete() ;Exit the script Exit Case $msg = $OK If GUICtrlRead($Proctor_East) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.22.0.224 /port:10.22.0.224") If GUICtrlRead($Student_Accounts) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.217 /port:10.5.0.217") If GUICtrlRead($Campbell) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.26.0.224 /port:10.26.0.224") If GUICtrlRead($Health_Center) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.23.0.224 /port:10.23.0.224") If GUICtrlRead($Admissions) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.30.0.224 /port:10.30.0.224")If GUICtrlRead($Fin_Aid) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.224 /port:10.5.0.224") If GUICtrlRead($Odell) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.33.0.224 /port:10.33.0.224") If GUICtrlRead($Registar) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.219 /port:10.5.0.219") If GUICtrlRead($Career_Center) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.218 /port:10.5.0.218") If GUICtrlRead($Reynolds) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.41.0.224 /port:10.41.0.224") If GUICtrlRead($Cowan) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.32.0.224 /port:10.32.0.224") If GUICtrlRead($Business_Office) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.220 /port:10.5.0.220") If GUICtrlRead($Hanes_Gym) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.28.0.224 /port:10.28.0.224") If GUICtrlRead($Institutional_Advancement) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.5.0.221 /port:10.5.0.221") If GUICtrlRead($Library) = $GUI_CHECKED Then ShellExecutewait(@ScriptDir & "\LexmarkPkgInstall.exe", "/address:10.20.0.224 /port:10.20.0.224") GUIDelete($Form1) EndSelect WEND While 1 $msg2 = GUICtrlRead($Account) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Lexmark Universal v2 XL\PrinterDriverData", "AccountTrackAccountNumber", "REG_SZ", $msg2) WEnd
-
thanks for the help. while i could not get it to write the entry using the test script. It did work after compiling to an exe. I don't know whats going on with that my permissions should be good and uac is turned off. if it will work in the larger script when compiled that is all I need. I was also thinking about using reg add command with arguments as an alternative if anyone else is having trouble that might be the way to go something like ShellExecutewait("reg add"............
-
yes pretty extensively all the other individuals with problems were returning helpful error codes. the other solutions was to try #requireadmin, hklm 64, and to disable redirection with DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) . I tested with antivirus disabled. this is a driver configuration registry entry. I tried to put the key under hkcu to see if the print driver would look there before going to hklm but the driver just looks at the hklm registry key.
-
I need to write to a key in HKLM64SOFTWAREMicrosoftWindows NTCurrentVersionPrintPrinters eventually the code will look like this While 1 $msg2 = GUICtrlRead($Account) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Lexmark Universal v2 XL\PrinterDriverData", "AccountTrackAccountNumber", "REG_SZ", $msg2) WEnd but right now i am just trying to get reg write to work under hklm I hope I am diong something obviously stupid this is what I am testing with #RequireAdmin DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) RegWrite("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers", "test2", "REG_sz", "Hello this is a test2") RegWrite("HKCU\Software\Test", "TestKey2", "REG_SZ", "Hello this is a test2") MsgBox(0, "", @error) ive added the first two lines after reading the forum it still returns a 0 error. Ive stopped the print spooler, tried various locations HKLM as well as HKCC. I can write to HKCU just fine but i change two letters and it doesn't work. my personal user is an admin and "the" administrator account is active. Ive tried it under both. I've tried hklm and hklm64. importing from a reg works fine the admin group has full control over the key. I really don't think using reg add will do what I need since i need a variable in the function, ive tried new keys as well as existing keys. is there some kind of force overwrite?