Been looking for and playing around with a script that would prompt me for a UserName and Password then Map a network drive.
I have included the code:
#AutoIt3Wrapper_icon=your_icon.ico #AutoIt3Wrapper_Run_Obfuscator=y #obfuscator_parameters=/striponly #NoTrayIcon #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Connect To Your Drive", 265, 135) $username_id = GUICtrlCreateInput("", 88, 16, 153, 21) $password_id = GUICtrlCreateInput("", 87, 44, 153, 21, $ES_PASSWORD) GUICtrlCreateLabel("&Username", 24, 16, 52, 17) GUICtrlCreateLabel("&Password", 26, 46, 50, 17) $connect = GUICtrlCreateButton("&Connect", 24, 80, 217, 33, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $connect $username = GUICtrlRead($username_id) $password = GUICtrlRead($password_id) If $username = '' Or $password = '' Then MsgBox(16, 'Error', 'Empty username or password') ContinueLoop EndIf If DriveMapGet("X:") <> '' Then ; very fast MsgBox(16, 'Error', 'The device is already assigned') ContinueLoop EndIf GUISetCursor(15,1) DriveMapAdd("X:", "\\Server\share\filestore\" & $username, 0, $username, $password) ; slow If @error Then Switch @error Case 1 $err_message = 'Undefined / Other error. Windows API return code: ' & @extended Case 2 $err_message = 'Access to the remote share was denied' Case 3 $err_message = 'The device is already assigned' Case 4 $err_message = 'Invalid device name' Case 5 $err_message = 'Invalid remote share' Case 6 $err_message = 'Invalid password' EndSwitch GUISetCursor(2) MsgBox(16, 'Error', $err_message) Else ; everything OK Exit EndIf EndSwitch WEnd
When I attempt the build I get the following:
Obfuscator support has been discontinued and is replaced by Au3Stripper using "#Au3Stripper_" directives.
! The directive to run Au3Stripper is: #AutoIt3Wrapper_Run_Au3Stripper=y ; Default is n
! #Au3Stripper_Parameters options are:
/pe : Replace and reference to a Global Const variable with its actual value.
/tl : Create Au3Stripper.Log with a trace of all actions.
/debug: add Debug information to Au3Stripper.Log.
/so : This is the default when no parameters are provided. same as /sf + /sv
/sf : Strip all unused Func's
/sv : Strip all unused Global var records.
/mo : Just merges the Include files into the source and strips the Comments.
This is similar to aut2exe and helps finding the errorline.
/mi : Sets the maximum Iterations Au3Stripper will perform. Default is 5.
/rm : Rename Variables and Functions to a shorter name.
/rsln: Replace @ScriptLineNumber with the actual line number.
/Beta: Use Beta Includes.
- Icon not found: your_icon.ico ==> Changing to default ICON.
>Running AU3Check (22.214.171.124) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS.au3
+>18:28:11 AU3Check ended.rc:0
>Running Au3Stripper (18.708.1148.0) from:C:\Program Files (x86)\AutoIt3\SciTE\Au3Stripper cmdline:
- 0.22 Iteration 1 Strip Functions result: Output 1050 lines, stripped 0 Func lines and 234 Commentlines
- 0.61 Iteration 2 Strip Variables result: Output 88 lines and stripped 962 lines
- 0.63 Iteration 3 Strip Variables result: Output 58 lines and stripped 30 lines
- 0.64 Iteration 4 Strip Variables result: Output 52 lines and stripped 6 lines
- 0.66 Iteration 5 Strip Variables result: Output 51 lines and stripped 1 lines
+> Source 1285 lines 48435 Characters.
+> Stripped 999 Func/Var lines and 234 comment lines, Total 46893 Characters.
+> Saved 95% lines 96% Characters.
+> Au3Stripper v18.708.1148.0 finished created:C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS_stripped.au3
+>18:28:12 Au3Stripper ended.rc:0
>Running AU3Check (126.96.36.199) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS_stripped.au3
+>18:28:12 AU3Check ended.rc:0
>Running:(188.8.131.52):C:\Program Files (x86)\AutoIt3\aut2exe\aut2exe.exe /in "C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS_stripped.au3" /out "C:\Users\Migue\AppData\Local\AutoIt v3\Aut2exe\~AU495C.tmp.exe" /nopack /comp 2
+>18:28:13 Aut2exe.exe ended.C:\Users\Migue\AppData\Local\AutoIt v3\Aut2exe\~AU495C.tmp.exe. rc:0
!>18:28:13 Problem copying file from: C:\Users\Migue\AppData\Local\AutoIt v3\Aut2exe\~AU495C.tmp.exe To :C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS.exe
+>18:28:14 AutoIt3Wrapper Finished.
>Exit code: 0 Time: 3.046
When I attempt to run the executable I get the following:
Many thanks in advance
Has anybody else noticed that Windows 7 reacts ignorantly when you use the Windows key + arrow key shortcuts on a GUI with GUIEventMode set to 1? I discovered this recently when I was working on an app where I wanted complete control over the maximize/minimize buttons.
Just give it a spin:
#include <GUIConstants.au3> Opt('GUIEventOptions', 1) $hGUI = GUICreate('', 300, 200, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_MAXIMIZE ToolTip('Maximized') Case $GUI_EVENT_MINIMIZE ToolTip('Minimized') Case $GUI_EVENT_RESTORE ToolTip('Restored') Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Run that, then hit Win+Up or Win+Down. None of those events get triggered, and it still maximizes/minimizes. Although I can't get it to restore down from a maximize unless the window is also resizable ($WS_THICKFRAME in the style).
Is there a way to stop Windows from doing what it wants or is the only option to check with WinGetState() and then change it back?
Windows 10 seems to respect my settings, and I don't have any other versions to test on.
I have a script that just adds some keyboard shortcuts for things like displaying the current song and artist, moving the window to the side so it won't pop up in my way, and play/pause, next song, previous song (these are the only 3 to still work since they don't need the window handle.)
In some update recently, Spotify's window class swapped from "[CLASS:SpotifyMainWindow]" to "[CLASS:Chrome_WidgetWin_0]". Using the new class in my controls doesn't seem to work, I've tried getting the window handle from the process handle (_GetHwndFromPID($PID)) but that seems to fail as well.
Does anybody have some idea of a way I could get this script working again?
edit: seems like discord has the same window class name, so could be some issue with this? Still not sure of a way to solve the issue though, I added a function to get the handle of the active window and can just use that now, but it was able to find it on its own before on spotify startup or script startup which would be preferred.
hey, can anybody enlighten on lesser known Windows hacks or uses ?
Screenshot program that can upload/FTP to website/storage with hotkey.
Features GUI to display programmable keys.
Set the hotkeys with this function to use, and display hotkeys.
; hotkey_set() Parameters: ; ----------------------------------------------------------- ; $aHotkey - The array hotkeys are stored in. This function sets the values of this array[hotkey_id][$hotkey_data] ; $dHotkey_id - The enum for this hotkey index ; $sHotkey_description - The label displayed to the user to represent function of hotkey ; $sHotkey_name - The hotkey it'self. Whatever name string you want to give the key ; $dHotkey_key - The _IsPressed keycode ; Keycodes AT: https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm ; $dHotkey_shift - Shift flag 0 or 1 Default off ; $dHotkey_ctrl - Ctrl flag 0 or 1 Default off ; $dHotkey_alt - Alt flag 0 or 1 Default off Func hotkey_set(ByRef $aHotkey, $dHotkey_id, $sHotkey_description, $sHotkey_name, $dHotkey_key, $dHotkey_shift = 0, $dHotkey_ctrl = 0, $dHotkey_alt = 0) $aHotkey[$dHotkey_id][$eHotkey_data_key_description] = $sHotkey_description $aHotkey[$dHotkey_id][$eHotkey_data_key_name] = $sHotkey_name $aHotkey[$dHotkey_id][$eHotkey_data_key] = $dHotkey_key $aHotkey[$dHotkey_id][$eHotkey_data_shift] = $dHotkey_shift $aHotkey[$dHotkey_id][$eHotkey_data_ctrl] = $dHotkey_ctrl $aHotkey[$dHotkey_id][$eHotkey_data_alt] = $dHotkey_alt EndFunc ;==>hotkey_set ; You can set your hotkeys here ; Please visit the hotkey_set() function for parameter information hotkey_set($aHotkey, $eHotkey_screenshot_ftp, "Selected Window to FTP", "F12", "7B", 0, 1, 0); F12 hotkey_set($aHotkey, $eHotkey_screenshot_disk, "Selected Window to Disk", "S", "53", 1, 1, 1); S hotkey_set($aHotkey, $eHotkey_clipboard_send, "Send Clipboard keystrokes", "F10", "79", 1, 1, 1); F10
Configure settings dialog:
Screenshot Filename and Screenshot Counter, are used to create simple unique filenames that can cycle. Copy URL to clipboard option. - For linking your screenshots. The screenshot file type is for local copy only. App always uses .JPG for FTP right now, but I could add FTP screenshot file type specification.
Any suggestions? Did I break anything, what did I miss?
Package uses TTS.au3 by Beege:
- TTS.au3 - by Beege