-
Posts
1,640 -
Joined
-
Last visited
-
Days Won
5
Community Answers
-
orbs's post in GUI file menu/submenu was marked as the answer
you need the "Generate" to be a menu, not a menu item:
; wrong: $MenuGenerateFiles = GUICtrlCreateMenuItem("Generate", $MenuFile) ; correct: $MenuGenerateFiles = GUICtrlCreateMenu("Generate", $MenuFile) -
orbs's post in Hide tabs without hiding controls inside them was marked as the answer
sorry to budge in so late,
have you noticed that the position of the controls inside tabs are not relative to the tab position?
well, what happens if you position the tab outside of the GUI, but leave the controls position unchanged?
you get "hidden" tab, with perfectly visible controls:
#include <GUIConstantsEx.au3> Example() Func Example() Local $msg GUICreate('"hidden" tab') GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) GUICtrlCreateTab(1000, 10, 200, 100) ; >>>>>>>>>> x=1000 = outside of the GUI Local $gTab0 = GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) Local $gTab1 = GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon GUICtrlCreateButton("OK1", 80, 50, 50, 20) Local $gTab2 = GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateLabel("label3", 20, 130, 50, 20) Local $gShowTab0 = GUICtrlCreateButton('show contents of tab 0', 20, 200, 200, 20) Local $gShowTab1 = GUICtrlCreateButton('show contents of tab 1', 20, 230, 200, 20) Local $gShowTab2 = GUICtrlCreateButton('show contents of tab 2', 20, 260, 200, 20) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $gShowTab0 GUICtrlSetState($gTab0, $GUI_SHOW) Case $gShowTab1 GUICtrlSetState($gTab1, $GUI_SHOW) Case $gShowTab2 GUICtrlSetState($gTab2, $GUI_SHOW) EndSwitch WEnd EndFunc ;==>Example PRO: you avoid the main window focus loss/regain that is apparent when using child GUI's.
CON: transparent controls inside tab have their background color as the tab (i.e. white), not as the GUI.
-
orbs's post in GuiCtrlGetState seemingly not returning checkbox state. was marked as the answer
from the help of GUICtrlGetState():
As opposed to GUICtrlRead() this function returns ONLY the state of a control enabled/disabled/hidden/show/dropaccepted
so use GuiCtrlRead().
-
orbs's post in Removing all GUI functions was marked as the answer
go to everywhere this line appears:
$nMsg = GUIGetMsg() and change it to this:
$nMsg=$Next except in line 90 (or so), where it should be this:
$nMsg=$Next_lang meaning: instead of waiting for the user to click, you force the selection you want.
if this works, you can later disable the showing of the GUI. look for this:
GUISetState(@SW_SHOW, and wherever you find it, comment it out.
-
orbs's post in Help Replace Var (Get the name of the variable) was marked as the answer
Trong, AutoIt does not have the function you are looking for. better explain what is your purpose, so we can help you find the way to accomplish it.
-
orbs's post in Old SciTE4AutoIt3 versions was marked as the answer
i still keep a copy of AutoIt 3.3.8.1 + full SciTE package, because there is a (luckily decreasing) number of scripts which i need to maintain Windows 2000 support for (3.3.8.1 was the last formal release to support Windows 2000 & Obfuscator).
i'm totally with Jos here about compatibility issues, so i take great care in migrating my scripts to newer AutoIt version, and i will not upload the older versions to the forum. but i do have the installation packages, so, JFX, contact me by PM if you want it.
-
orbs's post in Sending Message To Other User On Windows was marked as the answer
msg.exe
note (Windows Vista and later): can send over network only on Professional / Business editions or higher level editions. other editions it can send message to local users only.
-
orbs's post in key command collection was marked as the answer
"Help" menu > "SciTE Help" > in contents pane, expand "SciTE4AutoIt3" > "Keyboard Shortcuts"
-
orbs's post in MSDN <> AutoIt : Developing a Per-Monitor DPI-Aware WPF Application was marked as the answer
I know this is not the answer you are looking for, but I once tried to delve into the depths of programming GUI appearance, I found that the issue is much more complex than I expected. The solution however may be very simple (for a controlled environment, at least). In general, an application can be written to detect DPI settings and draw its GUI accordingly. Some modern applications (e.g. Microsoft Office 2007) are written from scratch to do that; but most applications, and legacy applications in specific, require practically a complete re-write. Fortunately, Microsoft acknowledge that this would be a trouble for developers, so since Windows Vista, a feature called “DPI Virtualization” is introduced. This feature detects when an application GUI is not fit to high DPI, and draws the GUI to fit. This is done by the operating system, and the application itself does not need to be aware of this. This is a decent solution for legacy applications, until a newer version is written to be DPI-aware and can do it on its own. This is not a perfect solution; DPI-virtualized GUI may appear blurry. By default, DPI virtualization is not enabled (until Windows 8.1, where it is enabled and cannot be easily disabled…). To enable it and use it properly, follow these steps: Step 1: enable DPI Virtualization system-wide: Go to: “Control Panel” “Display” “Set custom text size (DPI)” Uncheck the checkbox “Use Windows XP style DPI scaling”. This requires log-off/log-on to apply. Step 2: launch your application to see that this indeed solves the issue. Step 3: check impact on other application: Some applications may not react well to DPI Virtualization. For example, I was surprised to see that the modern browser Safari is impacted. Fortunately, You can disable DPI Virtualization per application. (Unfortunately, you cannot enable DPI Virtualization per application; you must enable DPI Virtualization system-wide and then disable DPI Virtualization per application.) To disable DPI Virtualization per application: right-click the application, select “Properties”, switch to the “Compatibility” tab, and check the checkbox “Disable display scaling on high DPI settings”. Note that you can disable DPI Virtualization per application for you only (current user) or for all users. -
orbs's post in Write files being copied to log file (logging) was marked as the answer
switching to method 2: replace the copying command with this section:
$aFileList=_FileListToArray($FilePath,"*") For $i=1 To $aFileList[0] If FileCopy($FilePath&'\'&$aFileList[$i],$FileDest&'\*') Then LockWrite($hLock, _NowDate() & " " & _NowTime() & " " & "File copied: " & $aFileList[$i]) Next this simply lists the files in to an array, then loops the array, copying each file in turn. if a file was copied successfully, a log entry is added.
you can easily add a log entry for a file failed or skipped.
-
orbs's post in my function doesn't get the requested value was marked as the answer
a quick shot in the dark: if you are using 64-bit OS, change HKLM to HKLM64. any difference?
-
orbs's post in Uptime since awakening from SLEEP/HIBERNATE was marked as the answer
look at the event log for the last "awakening" event, have a look here:
http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/logging-power-events-sleep-wake-up-to-the-event/e004a68c-f9a9-4982-86ba-a1cee05f9e4d
in brief, it says:
You are searching for event ID 42 in System log from source Kernel-Power as the sleeping event and the event ID 1 in System log from source Power-Troubleshooter for computer's awakening, which are respectively the last and first logs entries upon sleeping/waking up -
orbs's post in FileInstall & FileCopy Help was marked as the answer
extract to one of the following:
@TempDir @LocalAppDataDir @TempDir may get cleaned-up every now and then, so @LocalAppDataDir is preferred. in any case, better create a subfolder.
-
orbs's post in Need help with CmdLine was marked as the answer
the $oIE.navigate misled me to believe you are using IE. if that is incorrect, then ignore my previous post.
you need to have your MyBrowser handle the $CmdLine differently. flow like this:
if already another instance running (use _Singleon() ), then
just write the url to a temp text file, and exit immediately.
endif
main part: instead of:
while running
do what you do
wend
do this:
while running
do what you do
if a temp text file exists, read the url from it and do what you do with it (start new tab?) and delete the temp file
wend
-
orbs's post in Need help with populating .wim files from a folder into a combo box was marked as the answer
you limit the height of the ComboBox to 20 px. change to something un-limiting, like 1000 or so. it will downsize to fit.
P.S. welcome to AutoIt and to the forum!
-
orbs's post in Get back old default icon for AutoIt-created .EXE's? was marked as the answer
AutoIt icons can be found in the surprisingly named "Icons" folder in the AutoIt installation directory, commonly "C:\Program Files (x86)\AutoIt3\Icons\".
use the wrapper directive #AutoIt3Wrapper_Res_Icon_Add= to add the icon of your choice. this is explained in SciTe help.
-
orbs's post in Launch dropbox after mounting Truecrypt was marked as the answer
call _TC_Path("X:PATHTrueCrypt.exe") after the line:
#include"_TC.au3"
note: change X:PATH to wherever your TrueCrypt.exe is found.
-
orbs's post in Com port Query was marked as the answer
alternative, using WMI:
code adapted from: http://artisgeek.com/weblog/scripts/-getdevices-autoit/
#include <Array.au3> $aDeviceList=_getDevices('Silicon Labs CP210x USB to UART Bridge',1) _ArrayDisplay($aDeviceList) ;Function Name: Get (Connected) Devices ;Written By: Amin Babaeipanah ;Usage: _getDevices(1,'') ;_getDevices("search for", flag) ;"search for": can be set to empty to list everything ;flag: ; 1 = List Device Name(s) ; 2 = List Device ID(s) ; 3 = List Device Name(s) @ Device ID(s) ;Example 1: ; Code below will list all the connected devices by name ; _getDevices('',1) ; Code below will list all the connected devices by ID ; _getDevices('',2) ; Code below will list all the connected devices by name that has the word "COM" ; _getDevices('COM',1) ; adaptation: replace ConsoleWrite with array return ; adaptation by: orbs ; original source at: http://artisgeek.com/weblog/scripts/-getdevices-autoit/ Func _getDevices($name,$type) Dim $aDeviceList[1]=[0] Local $objWMIService = ObjGet('winmgmts:\\localhost\root\CIMV2') Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%"&$name&"%'", "WQL", 48) If IsObj($colItems) Then If $type = 1 Then For $objItem In $colItems $aDeviceList[0]+=1 ReDim $aDeviceList[$aDeviceList[0]+1] $aDeviceList[$aDeviceList[0]]=$objItem.Name ;ConsoleWrite($objItem.Name&@LF) Next ElseIf $type = 2 Then For $objItem In $colItems $aDeviceList[0]+=1 ReDim $aDeviceList[$aDeviceList[0]+1] $aDeviceList[$aDeviceList[0]]=$objItem.PNPDeviceID ;ConsoleWrite($objItem.PNPDeviceID&@LF) Next ElseIf $type = 3 Then For $objItem In $colItems $aDeviceList[0]+=1 ReDim $aDeviceList[$aDeviceList[0]+1] $aDeviceList[$aDeviceList[0]]=$objItem.Name&'@'&$objItem.PNPDeviceID ;ConsoleWrite($objItem.Name&'@'&$objItem.PNPDeviceID&@LF) Next EndIf EndIf Return $aDeviceList EndFunc the function returns an array of all devices by criteria (name or type).
calling he function with your device name will return (hopefully) only one result, then use string manipulation - like _StringBetween() - to parse the port.
-
orbs's post in Registry boot VS startup folder ? was marked as the answer
1) registry keys are executed before shortcuts on the startup folders.
2) on the registry, it is less apparent for users to modify or remove the command. leave the startup folder to the users, it's theirs. (also don't spam the Documents folder with creating some "My Stuff" subfolders like some programs do, it's annoying).
-
orbs's post in Install drivers on remote systems was marked as the answer
hello confuseis, welcome to AutoIt and to the forum!
first, i assume you have at-least some client machines running Windows newer than XP (i.e. Vista, 7, 8, 8.1). if you have only XP machines (or older), then things get easier.
in general, you can not install drivers/software under a non-admin account. but fortunately, you don't need to; if you deploy remotely (directly or by psexec) then you are using your admin account, so no issue there. you will encounter this issue if you try to initialize the install process in the user context - for example, in the logon script. avoid that. you can either do a remote silent deployment, or local interactive installation. you usually can not combine the two - UAC, user permissions and session isolation will come in the way - so don't even try, it's a battle already lost.
now, assuming you go for remote silent deployment, you'd want to avoid the exe and use either driver files (commonly .inf and .dll files) or installation packages (.msi files)
if you can obtain the driver files of your exe, either from the vendor or by extracting from the exe, then check-out DPInst - a formal MS tool designed for drivers pre-installation, may suit you well:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544842(v=vs.85).aspx
if you can obtain the .msi alternative, very simple to deploy with a combination of psexec and msiexec.
if you have no driver files and no installation package, then what you are installing is not a driver but an application, which requires a different approach. first, your application may have a built-in deployment option - check the command-line switches of your exe, consult the vendor support if possible.
if you have not that option, then you are beginning to sink into a swamp. for every additional step described below, take extra care to test in full before put to production.
for one, you can re-package your "driver" using an external tool like AppDeploy Packager (very useful and free, although not open source):
http://www.itninja.com/blog/view/the-appdeploy-repackager
now, as you probably noticed, nothing described until now involves AutoIt. if you got to here, and still no solution, then this is where AutoIt kicks in.
AutoIt has some very helpful tutorials, which are the first thing you should spend your next 5 minutes on. look at the help file for the automated installation of WinZip (yeah, WinZip. autoIt is that old ). this should give you a clear view on how AutoIt can handle dialog windows presented by the installer. use the example to generate your own installation script.
when you got that, the next step is to launch the script on remote workstations. now you are sinking even deeper into the swamp. you can not launch it in the user context (no permissions), and if you launch it in another session the interactive operation will be crippled.
for this there are some creative solutions, but i advise you begin with attempting the first steps of this post, and if you eventually do get to this point, we can discuss further.
-
orbs's post in Keypress detection. was marked as the answer
this seems a bit familiar to an issue i had in the past, only in reverse:
'?do=embed' frameborder='0' data-embedContent>>
so venturing into gedankenexperiment territory, i'd check the idle time. but if idle time reports activity, i'd check also for mouse moves, and assume a key press only if mouse did not move.
anyway i think it's time to let the OP get the reins now.
-
orbs's post in Loop portqry.exe until condition met or 30 times was marked as the answer
ok, so i hasted a bit, didn't think it through... and didn't notice you're new around, so welcome to AutoIt and to the forum!
now let's get it right:
If lnchTerm1() Then ; this is how you query the result of the functon ; this happens when the function returns "True" MsgBox(0, "SOL", "Yey, we are connected!", 10) ; this is an optional addition Else ; this happens when the function returns "False" MsgBox(0, "SOL", "No tunnel created, sorry!", 10) ; this was moved here EndIf Func lnchTerm1() $qPort = 3391 $uName = "sshuser" $pWord = "sshpass" Run("plink.exe -l " & $uName & " -pw " & $pWord & " -L 3391:192.168.50.25:3389 -P 22 -2 -C -ssh ssh.domain.tld","",@SW_SHOW) $intCtr = 1 while $intCtr < 30 $retVal = RunWait("portqry.exe -n 127.0.0.1 -e 3391","",@SW_SHOW) if $retVal = 0 Then Run("mstsc.exe Term1.RDP") ;ExitLoop ; replace this with next line Return True ; add this: if you got to here, then you connected successfully Else $intCtr = $intCtr + 1 EndIf ;MsgBox(0, "SOL", "No tunnel created, sorry!", 10) ; move this away, see top of script ;ExitLoop ; remove this completely WEnd Return False ; add this: if you got to here, then you could not connect EndFunc EDIT: yeah, also what jdelaney said.
-
orbs's post in Run exe in several Terminal Services simultaneously was marked as the answer
anything running in the user context will terminate when the user terminates the session. you'll have to open a session, run the script, minimize the session, start the next session, etc. while the scripts are running, visit every session to prevent it from closing automatically. when all is done, quit every session in order.
if the script terminates before session is terminated, check your script to see why.
alternatively, you can launch the script several times on the same session. performance-wise there should be only little difference, so if you're worried, launch it 10 times. or 100 times.
-
orbs's post in communications betwen process on other pcs was marked as the answer
look for TCPSend() in the help file.
-
orbs's post in Send command arguments to running script was marked as the answer
this has been discussed many times, lately here:
'?do=embed' frameborder='0' data-embedContent>>
and here:
'?do=embed' frameborder='0' data-embedContent>>
in short: you can do some kind of IPC. for your example, i'd go for quick and dirty, like in the 1st link above.
script is launched:
option 1) with arguments. script writes a file with the arguments and exits.
option 2) without arguments: script runs and remains idle, waiting for a file with arguments. when such file exists, script processes the arguments.
if you prefer a more elegant way, check out the 2nd link above.