-
Posts
5,552 -
Joined
-
Last visited
-
Days Won
3
Community Answers
-
MHz's post in How To Put A Function After If,Then was marked as the answer
You have a 2nd GUIGetMsg() which is having an effect on the flow of the loop. Comment that out and it works much better. I changed the conditions in the loop to use Switch..EndSwitch as some have recommended so it will work better hopefully.
FileOpenDialog changes the working directory so passing @WorkingDir as a parameter to _FillLists() seems more suited then passing the selected files path and replacing Openfile.txt to get the same result. More could be improved though I do not want to change too much which may confuse you. Some use of arrays could help to shrink the code down but I am not sure of your current experience level for changing any of that.
See if this helps.
$_FF_COM_TRACE = True #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> ;#include <FF.au3> #include <staticConstants.au3> #include <IE.au3> #include <String.au3> #include <Excel.au3> #include <FileConstants.au3> #include <IE.au3> #include <String.au3> #include <GUIConstantsEx.au3> #include "GUIExtender.au3" #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> Local $oIE ;, BitOR($WS_BORDER, $WS_VSCROLL) ;_FFStart( "https://www.google.nl" ) ;WinSetState ( "Google - Mozilla Firefox", "", @SW_MINIMIZE ) ;~ _GUIExtender_Init($Form1_1_1_1) FileWrite(@ScriptDir & "\Openfile.txt", "text") For $i = 1 To 13 FileDelete(@ScriptDir & "\list" & $i & ".txt") FileWrite(@ScriptDir & "\list" & $i & ".txt", "text " & $i) Next Global $iIndex = 0 #Region ### START Koda GUI section ### Form= $Form1_1_1_1 = GUICreate("program", 814, 713, 697, 101) $Button1 = GUICtrlCreateButton("Next", 208, 0, 41, 25) $List1 = GUICtrlCreateList("", 0, 64, 145, 358) GUICtrlSetData(-1, "") $List2 = GUICtrlCreateList("", 144, 64, 65, 358) GUICtrlSetData(-1, "") $List3 = GUICtrlCreateList("", 208, 64, 65, 358) GUICtrlSetData(-1, "") $List4 = GUICtrlCreateList("", 344, 64, 153, 358) GUICtrlSetData(-1, "") $List5 = GUICtrlCreateList("", 496, 64, 65, 358) GUICtrlSetData(-1, "") $List6 = GUICtrlCreateList("", 560, 64, 121, 230) GUICtrlSetData(-1, "") $List7 = GUICtrlCreateList("", 680, 64, 65, 230) GUICtrlSetData(-1, "") $List8 = GUICtrlCreateList("", 744, 64, 65, 230) GUICtrlSetData(-1, "") $List9 = GUICtrlCreateList("", 272, 64, 65, 358) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) Local $helpmenu, $infoitem, $exititem, $recentfilesmenu Local $viewmenu, $viewstatusitem Local $statuslabel, $msg, $file $filemenu = GUICtrlCreateMenu("&File") $fileitem = GUICtrlCreateMenuItem("Open", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $newitem = GUICtrlCreateMenuItem("new", $filemenu) $helpmenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $filemenu) GUICtrlSetState(-1, $GUI_DISABLE) $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu) $message4 = GUICtrlCreateMenuItem("message", $filemenu) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 $msg = GUIGetMsg() Switch $msg Case $fileitem ConsoleWrite("Hit" & @CRLF) ; Find Openfile.txt to get change the working directory to where it exists. $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)", 1, "Openfile.txt") If Not @error Then GUICtrlCreateMenuItem($file, $recentfilesmenu) ; FileOpenDialog changes the working directory to the selected files location. This is what you want? _FillLists(@WorkingDir) EndIf Case $newitem $newitem = FileSaveDialog("Choose file...", @TempDir, "All (*.*)") Case $viewstatusitem If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED) GUICtrlSetState($statuslabel, $GUI_HIDE) Else GUICtrlSetState($viewstatusitem, $GUI_CHECKED) GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf Case $GUI_EVENT_CLOSE, $exititem ExitLoop Case $infoitem MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") Case $Button1 _pluseen($Button1) EndSwitch WEnd GUIDelete() #EndRegion ### END Koda GUI section ### Func _FillLists($file) ; The next 2 lines seem to be obsolete. ;~ Local $newfile = StringReplace($file, "Openfile.txt", "") ;~ $1newfile = ($newfile & ("lists\list")) ; $file will be the working directory path changed with previous use of FileOpenDialog Local $1newfile = $file & '\list' Global $iIndex = 0, $sListData1 = ($1newfile & ("1.txt")) Global $sListFile1 = ($1newfile & ("1.txt")) Global $iIndex = 0, $sListData2 = ($1newfile & ("2.txt")) Global $sListFile2 = ($1newfile & ("2.txt")) Global $iIndex = 0, $sListData3 = ($1newfile & ("3.txt")) Global $sListFile3 = ($1newfile & ("3.txt")) Global $iIndex = 0, $sListData4 = ($1newfile & ("4.txt")) Global $sListFile4 = ($1newfile & ("4.txt")) Global $iIndex = 0, $sListData5 = ($1newfile & ("5.txt")) Global $sListFile5 = ($1newfile & ("5.txt")) Global $iIndex = 0, $sListData6 = ($1newfile & ("6.txt")) Global $sListFile6 = ($1newfile & ("6.txt")) Global $iIndex = 0, $sListData7 = ($1newfile & ("7.txt")) Global $sListFile7 = ($1newfile & ("7.txt")) Global $iIndex = 0, $sListData8 = ($1newfile & ("8.txt")) Global $sListFile8 = ($1newfile & ("8.txt")) Global $iIndex = 0, $sListData9 = ($1newfile & ("9.txt")) Global $sListFile9 = ($1newfile & ("9.txt")) Global $iIndex = 0, $sListData10 = ($1newfile & ("10.txt")) Global $sListFile10 = ($1newfile & ("10.txt")) Global $iIndex = 0, $sListData11 = ($1newfile & ("11.txt")) Global $sListFile11 = ($1newfile & ("11.txt")) Global $iIndex = 0, $sListData12 = ($1newfile & ("12.txt")) Global $sListFile12 = ($1newfile & ("12.txt")) Global $iIndex = 0, $sListData13 = ($1newfile & ("13.txt")) Global $sListFile13 = ($1newfile & ("13.txt")) ; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) Else MsgBox($MB_SYSTEMMODAL, "Error", $sListFile1 & " does not exist") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) _GUICtrlListBox_SetCurSel($List1, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile2) Then $sListData2 = FileRead($sListFile2) EndIf ; Load data read from the file GUICtrlSetData($List2, $sListData2) _GUICtrlListBox_SetCurSel($List2, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile3) Then $sListData3 = FileRead($sListFile3) EndIf ; Load data read from the file GUICtrlSetData($List3, $sListData3) _GUICtrlListBox_SetCurSel($List3, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile4) Then $sListData4 = FileRead($sListFile4) EndIf ; Load data read from the file GUICtrlSetData($List4, $sListData4) _GUICtrlListBox_SetCurSel($List4, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile5) Then $sListData5 = FileRead($sListFile5) EndIf ; Load data read from the file GUICtrlSetData($List5, $sListData5) _GUICtrlListBox_SetCurSel($List5, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile6) Then $sListData6 = FileRead($sListFile6) EndIf ; Load data read from the file GUICtrlSetData($List6, $sListData6) _GUICtrlListBox_SetCurSel($List6, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile7) Then $sListData7 = FileRead($sListFile7) EndIf ; Load data read from the file GUICtrlSetData($List7, $sListData7) _GUICtrlListBox_SetCurSel($List7, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile8) Then $sListData8 = FileRead($sListFile8) EndIf ; Load data read from the file GUICtrlSetData($List8, $sListData8) _GUICtrlListBox_SetCurSel($List8, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile9) Then $sListData9 = FileRead($sListFile9) EndIf ; Load data read from the file GUICtrlSetData($List9, $sListData9) _GUICtrlListBox_SetCurSel($List9, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile10) Then $sListData10 = FileRead($sListFile10) EndIf EndFunc Func _pluseen($Button1) $iIndex += 1 _GUICtrlListBox_SetCurSel($List1, $iIndex) _GUICtrlListBox_SetCurSel($List4, $iIndex) EndFunc ; -
MHz's post in Run, Runwait or @ComSpec piping output using "|" was marked as the answer
In experiencing issues, it seems you are blaming what is not at fault. Piping seems to work fine. Using Chr(124) seems quite unnecessary.
You may still need to escape certain characters passed to CMD under certain conditions. Like this example where a For loop does not like a pipe character unless it is escaped with a caret (^).
; Run cmd with /q = Echo off, /k Remain open. Pipe dir output to sort. Run("cmd /q /k for /f %A in ('dir /b ^| sort') do echo %A") .
Piping FFMPEG to VLC can be done. An example that I tested as working on Windows 7 X64 with VLC X86 ver. 2.1.5 installed and with FFMPEG ver. N-52941-g13cb6ed static built on 2013-05-09 in a folder that is in %path%. I added some extra double quotes which do not cause any issue.
; Select a FLV media file. Option 1 = File must exist. $input_flv = FileOpenDialog('Select FLV media file', EnvGet('SystemDrive'), 'Flash media file (*.flv)', 1) If @error Then Exit ; Set full path to vlc.exe. $vlc_fullpath = EnvGet('ProgramFiles') & '\VideoLAN\VLC\vlc.exe' If Not FileExists($vlc_fullpath) And @OSArch <> 'X86' Then $vlc_fullpath = EnvGet('ProgramFiles(x86)') & '\VideoLAN\VLC\vlc.exe' EndIf ; Last attempt to find vlc.exe if not found already. If Not FileExists($vlc_fullpath) Then ; Select location to vlc.exe. Option 1 = File must exist. $vlc_fullpath = FileOpenDialog('Find vlc.exe', EnvGet('SystemDrive'), 'Executable file (*.exe)', 1, 'vlc.exe') If @error Then Exit EndIf ; Run the command. The command expects ffmpeg to be in the path. $command = 'cmd /k ffmpeg -i "' & $input_flv & '" -c:v "copy" -c:a "copy" -f "flv" pipe:1 | "' & $vlc_fullpath & '" -' Run($command) If @error Then MsgBox(0x40030, @ScriptName, 'This command failed to run.' & @CRLF & @CRLF & $command) ; As for yamdi, I do not know why it does not like the pipe from ffmpeg. Perhaps a later build of ffmpeg may help. Perhaps yambi is stdin incompetent. Perhaps my lack of experience with yambi is failing me. I do not have the answer with ffmpeg | yambi though perhaps I have helped with what it is not.
-
MHz's post in SQLite performing a .import was marked as the answer
You mentioned CMD script. This may help you to show the difference between the command and how to apply it with AutoIt.
Here a a CMD script to built a test.db and do some tasks.
@echo off setlocal enabledelayedexpansion set db=test.db if exist "%db%" del "%db%" echo. & echo Creating the database. sqlite3 "%db%" "begin;create table NormalizeStage(ta, tb, tc);insert into NormalizeStage values(1,2,3),(4,5,6);commit;" echo. & echo Exporting contents of the table NormalizeStage to a csv file then delete table content. sqlite3 -cmd ".mode csv" -cmd ".once test.csv" "%db%" "select * from NormalizeStage;delete from NormalizeStage;" echo. & echo Display contents of csv file. type test.csv pause echo. & echo Display table NormalizeStage to show contents. Expect empty return. sqlite3 "%db%" "select * from NormalizeStage;" pause echo. & echo Import csv file into the table NormalizeStage. sqlite3 -csv -cmd ".import test.csv NormalizeStage" "%db%" "" pause echo. & echo Display table NormalizeStage to show contents with headers on. sqlite3 -cmd ".headers on" "%db%" "select * from NormalizeStage;" pause endlocal goto :eof Note how the script exports with mode csv. Using an external command to import seems to need mode csv to be active for a successful import.
For reference if not known, "Sqlite3 --help" will give you external help commands while "Sqlite3 .help" internally give you the internal dot commands. This gives you all the options.
After running the CMD script above, a database file exists. I tested AutoIt with this script on that database and it adds the csv content to the existing entries in the NormalizeStage table.
; import csv into test.db. It may add to the existing entries. $pid = Run('sqlite3 -csv -cmd ".import ''test.csv'' NormalizeStage" test.db "select * from NormalizeStage;"', '', @SW_MINIMIZE, 6) ; Wait for finish and get exit code. ProcessWaitClose($pid) $exitcode = @extended ; Read the streams. $stdoutput = StdOutRead($pid) $erroutput = StdErrRead($pid) If $exitcode Then ; if exit code, exit with it. Exit @extended ElseIf $erroutput Then ; if error output, show it. MsgBox(0x40030, @ScriptName, $erroutput) Else ; Show the std output. MsgBox(0x40000, @ScriptName, $stdoutput) EndIf All seems to be working and hopefully give you some ideas. I have not tried _SQLite_SQLiteExe() on this test yet though it will probably do it.
-
MHz's post in stdoutRead help was marked as the answer
Nice reply Exit. I will attempt to do a little more with cmd by using a for loop.
$result = ipconfig() ConsoleWrite($result & @CRLF) Func ipconfig($lookfor = "DHCP Server") ; run cmd hidden with stdout Local $cmd = Run(@Comspec & ' /c @echo off & ' & _ 'for /f "usebackq tokens=2 delims=:" %# in (`ipconfig /all ^| find "' & $lookfor & '"`) do echo %#', "" , @SW_HIDE, 2 _ ) ; wait for the process to close ProcessWaitClose($cmd) ; return the result with each end trimmed of whitespace Return StringStripWS(StdoutRead($cmd), 3) EndFunc
-
MHz's post in Combine variable name was marked as the answer
Eval takes an expression. This means a string is acceptable rather then an actual variable.
Example
Local $abc1 = 2 Local $abc2 = 3 Local $abc3 = 4 For $1 = 1 To 3 MsgBox(0, $1, Eval('abc' & $1)) Next All 3 variables are shown in the loop by using the expression of 'abc' & $1
-
MHz's post in Shorten Multiple If Statements? was marked as the answer
With many items, I usually consider an array.
One example of array usage:
; split each printer by | with no count and loop through each printer For $printer In StringSplit('Mil SHARP MX-3501|Mil Quality SHARP MX-3501|Mil Copier Quality|Mil Copier West', '|', 2) If _PrinterExist($printer) Then _RemovePrinter($printer) Next ; below functions are for testing Func _PrinterExist($printer) ConsoleWrite('exists ' & $printer & @CRLF) Return 1 EndFunc Func _RemovePrinter($printer) ConsoleWrite('remove ' & $printer & @CRLF) EndFunc -
MHz's post in DiskPart script auto-generation was marked as the answer
Perhaps this may help as some of the ElseIf conditions seemed illogical.
$DiskSize = 20480 $testData = "c,20%,1024,*,a" $PartitionParams = StringSplit($testData, ",", 2) $FinalFile = "" For $ExamineParams In $PartitionParams If $ExamineParams = "a" Then $FinalFile &= "active" & @CRLF ElseIf $ExamineParams = "c" Then $FinalFile &= "clean" & @CRLF ElseIf $ExamineParams = "*" Then $FinalFile &= "create partition primary" & @CRLF & "format fs=" & "ntfs" & " quick" & @CRLF ElseIf StringInStr($ExamineParams, "%") Then $MultiString = "0." & StringReplace($ExamineParams, "%", "") $ActualGenSize = $DiskSize * $MultiString $SizeToReport = Round($ActualGenSize, -1) $FinalFile &= "create partition primary size=" & $SizeToReport & @CRLF & "format fs=" & "ntfs" & " quick" & @CRLF ElseIf StringIsInt($ExamineParams) Then $FinalFile &= "create partition primary size=" & $ExamineParams & @CRLF & "format fs=" & "ntfs" & " quick" & @CRLF EndIf Next ConsoleWrite($FinalFile) Outputs:
clean create partition primary size=4100 format fs=ntfs quick create partition primary size=1024 format fs=ntfs quick create partition primary format fs=ntfs quick active I can only guess that is what you want for the output.
-
MHz's post in Setting default SciTE user parameters? was marked as the answer
Setting default parameters for a project in a folder of its own. Sure. I will assume you have the latest full Scite4AutoIt3 which will run AutoIt3Wrapper by default. The Local Options used are based on that assumption.
Here are 5 steps to do it.
1. Open main script file as current active tab in Scite
2. In Options Menu in Scite, select entry "Open Local Options File"
3. Add contents below into the Local Options file and save. (creates a file, if not already exists, named SciTE.properties in the same dir as the main script file)
4. You can now close the Local Options file in Scite if you wish
5. Running any script in that directory in Scite will use the options set in the Local Options file that will override settings in other existing property files.
Some examples to show are below.
Local Options file (SciTE.properties)
# Use as Local Directory Options file or Directory Options file # Based on Scite4AutoIt3 2014-04-05 # Commands to compile / run your script # Static Parameters (Add your own parameters here) UserParams=Static parameters "like defaults for this project" /ok # Run Production command.go.$(au3)="$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "$(FilePath)" /UserParams $(UserParams) $(1) $(2) $(3) $(4) # Run Beta command.0.$(au3)="$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "$(FilePath)" /UserParams $(UserParams) $(1) $(2) $(3) $(4) .
Main script (main.au3)
Global $params For $1 = 1 To $CMDLINE[0] $params &= $CMDLINE[$1] & @CRLF Next MsgBox(0, '', $params) .
Running the main script with the Local options file saved in the same directory, will produce this result from the Msgbox.
--------------------------- --------------------------- Static parameters like defaults for this project /ok --------------------------- OK --------------------------- The output is the same parameters that the UserParams variable is set as in the Local Options file.
You can add to the default parameters using the parameter window in Scite (Shift+F8) and add for example gui_1 in 1st input, gui_2 in 2nd input, gui_3 in 3rd input and gui_4 in 4th input. Run the main script will show this result.
--------------------------- --------------------------- Static parameters like defaults for this project /ok gui_1 gui_2 gui_3 gui_4 --------------------------- OK --------------------------- .
So now you should now know the basics of having Scite property settings for each project folder.
-
MHz's post in Any way I can get an email for new official releases? was marked as the answer
Try going to (Downloads ->AutoIt Team) http://www.autoitscript.com/forum/files/category/2-autoit-team/ and click the "Follow this category" button. If you have email notifications setup then you may get an email when a new item is posted.
-
MHz's post in Simplistic Command Prompt was marked as the answer
Perhaps this is suitable. Not sure if you want an input box in the function as you left it out of your last attempt and it would make a parameter strange to have that you request.
; get the copyright banner and the initial prompt $prompt = RemoteShell('"' & @ComSpec & '"') While 1 $command = InputBox('Enter Command','Please enter a command for the Console') If @error Then ExitLoop MsgBox(0, @ComSpec, $prompt & $command & @CRLF & @CRLF & RemoteShell($command)) WEnd Func RemoteShell($command) ; run command in cmdline mode Local $pid, $stdout Local Const $STDERR_MERGED = 8 $pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, $STDERR_MERGED) Do Sleep(10) $stdout &= StdOutRead($pid) Until @error Return $stdout EndFunc -
MHz's post in Command Prompt was marked as the answer
I added a limit to what is put into the edit control as it can only do 30000 characters and then accepts no more. So, only approximately last 15000 is kept. Added CLS to clear the edit control. Added $tail variable to keep output of last command as you mention about ping....
Try this and see if it suits your interest.
#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GuiEdit.au3> #include <Misc.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Command Prompt", 600, 326) $hEdit = GUICtrlCreateEdit('', 0, 0, 600, 297, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY)) GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) $Input1 = GUICtrlCreateInput("", 104, 299, 483, 21) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $Button1 = GUICtrlCreateButton("Send", 8, 297, 91, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) $DOS = Run('"' & @ComSpec & '"', '', @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD) Global $tail While ProcessExists($DOS) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE StdInWrite($DOS, 'Exit' & @CRLF) ProcessWaitClose($DOS) Case $Button1 ; clear screen using cls Switch GuiCtrlRead($Input1) Case 'cls' GUICtrlSetData($hEdit, '') GUICtrlSetData($Input1, '') ContinueLoop EndSwitch ; write in command StdinWrite($DOS, GuiCtrlRead($Input1) & @CRLF) ; clear input ctrl GUICtrlSetData($Input1, '') ; clear tail of stdout data $tail = '' Case Else ; get output from command $Stdout = StdoutRead($DOS) If @extended Then ; add to tail $tail &= $Stdout ; read edit ctrl $sEdit = GUICtrlRead($hEdit) ; limit size in edit to prevent reaching full limit If StringLen($sEdit) > 15000 Then GUICtrlSetData($hEdit, StringRight($sEdit, 15000)) EndIf ; append stdout to edit ctrl GUICtrlSetData($hEdit, $Stdout, True) ElseIf StringRight($tail, 1) = '>' Then ; show out of tail when > is found at the end MsgBox(0, 'tail', $tail) $tail = '' EndIf EndSwitch WEnd -
MHz's post in Create an inactive GUI was marked as the answer
Hi baoquocphan. You could use @SW_SHOWNOACTIVATE as the flag of GUISetState.
#include <WindowsConstants.au3> GUICreate('test', Default, Default, Default, Default, $WS_POPUP) GUISetState(@SW_SHOWNOACTIVATE) Sleep(1000) ConsoleWrite(WinGetTitle('') & @CRLF) Sleep(3000) Seems inactive initially and the active title returned by consolewrite is the editor I test the script with.
-
MHz's post in Load and Save File was marked as the answer
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $readproxy Global $readportproxy Global $readhost Global $readporthost Global $readusername Global $readpassword #Region ### START Koda GUI section ### $formdata = GUICreate("data", 350, 280, 200, 114) GUISetBkColor(0xC0DCC0) $server = GUICtrlCreateGroup("Server", 8, 8, 225, 97) $inputhost = GUICtrlCreateInput($readhost, 88, 32, 137, 21) $Label1 = GUICtrlCreateLabel("Host", 24, 32, 26, 17) $Label2 = GUICtrlCreateLabel("Port", 24, 64, 23, 17) $inputporthost = GUICtrlCreateInput($readporthost, 88, 64, 137, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group1 = GUICtrlCreateGroup("User", 8, 112, 225, 97) $Label3 = GUICtrlCreateLabel("Username", 24, 136, 52, 17) $inputusername = GUICtrlCreateInput($readusername, 88, 136, 137, 21) $Label4 = GUICtrlCreateLabel("Password", 24, 168, 50, 17) $inputpassword = GUICtrlCreateInput($readpassword, 88, 168, 137, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Proxy", 8, 216, 225, 49) $inputproxy = GUICtrlCreateInput("127.0.0.1", 88, 232, 137, 21) $Label5 = GUICtrlCreateLabel("Proxy", 16, 232, 30, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $btnsimpan = GUICtrlCreateButton("SIMPAN", 248, 240, 89, 25) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $btnload = GUICtrlCreateButton("LOAD", 248, 200, 89, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Group3 = GUICtrlCreateGroup("Akun", 248, 8, 89, 177) $AkunRadio1 = GUICtrlCreateRadio("Akun1", 256, 32, 65, 17) $AkunRadio2 = GUICtrlCreateRadio("Akun2", 256, 56, 65, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnsimpan save() Case $btnload load() EndSwitch WEnd Func save() Local $ini_file, $workingdir ; save workingdir $workingdir = @WorkingDir ; save file dialog $ini_file = FileSaveDialog('Save', @ScriptDir, 'Ini (*.ini)|All (*.*)', 10, 'Config.ini', $formdata) ; check if return is valid If @error Or $ini_file == '' Then FileChangeDir($workingdir) Return SetError(1, 0, '') EndIf ; write to ini file IniWrite($ini_file, "Data", "Host", GUICtrlRead($inputhost)) IniWrite($ini_file, "Data", "Port Host", GUICtrlRead($inputporthost)) IniWrite($ini_file, "Data", "Proxy", GUICtrlRead($inputproxy)) IniWrite($ini_file, "Data", "Username", GUICtrlRead($inputusername)) IniWrite($ini_file, "Data", "Password", GUICtrlRead($inputpassword)) ; restore workingdir FileChangeDir($workingdir) EndFunc Func load() Local $ini_file, $workingdir ; save workingdir $workingdir = @WorkingDir ; open file dialog $ini_file = FileOpenDialog('Open', @ScriptDir, 'Ini (*.ini)|All (*.*)', 1, 'Config.ini', $formdata) ; check if return is valid If @error Or $ini_file == '' Then FileChangeDir($workingdir) Return SetError(1, 0, '') EndIf ; read from ini file GUICtrlSetData($inputproxy, IniRead($ini_file, "Data", "Proxy", "127.0.0.1")) GUICtrlSetData($inputhost, IniRead($ini_file, "Data", "Host", "")) GUICtrlSetData($inputporthost, IniRead($ini_file, "Data", "Port Host", "")) GUICtrlSetData($inputusername, IniRead($ini_file, "Data", "Username", "")) GUICtrlSetData($inputpassword, IniRead($ini_file, "Data", "Password", "")) ; restore workingdir FileChangeDir($workingdir) EndFunc I modified the load and save functions to use FileOpenDialog and FileSaveDialog. Comments added to help to know what happens at each event. Perhaps not exactly what you may want but may show you how to do it.
-
MHz's post in Multiple GUI. was marked as the answer
Hello Victorique,
GuiSwitch can do this for you. It tells AutoIt to use another Gui as the current Gui to receive the messages. The 2nd and 3rd Gui can just be put into user defined functions and have their own loops. The good idea about this is that you can make some of the variables local. No need for the GuiGetMsg advanced mode. So now you have _Gui_Select() and _Gui_Thunderbird() functions.
Changes I made
#NoTrayIcon #RequireAdmin #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=C:\Users\Accelerator\Desktop\Quicklaunch.exe #AutoIt3Wrapper_UseX64=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <ComboConstants.au3> #include <EditConstants.au3> ;#include <_UskinLibrary.au3> ;#include <Skins/XXX.au3> ;#include <DesuSplash2.au3> #include <Crypt.au3> ;#region ### Thweme load section (may select soon) ### Form= ;_Uskin_LoadDLL() ;_Uskin_Init(_XXX(True)) ;#endregion ### Thweme load section (may select soon) ### Form= ;#region ### Splash screen ### start= ;SplashImageOn("Desu Splash", _DesuSplash2(True), 650, 303, -1, -1, 1) ;Sleep(5000) ;SplashOff() #endregion ### Splash screen ### start= $hParent = GUICreate("parent");not shown GUISetState(@SW_DISABLE, $hParent) GUISetState(@SW_HIDE, $hParent) #region ### START Koda GUI section ### Form= $maingui = GUICreate("Quick launch V1.5", 225, 315, 470, 34, $WS_DLGFRAME, -1, $hParent) $Firefox = GUICtrlCreateButton("Cyberfox", 0, 0, 105, 49) $File = GUICtrlCreateMenu("File") $Edit = GUICtrlCreateMenuItem("Edit program", $File) $Reset = GUICtrlCreateMenuItem("Reset Configuration file", $File) $admin = GUICtrlCreateMenuItem("Enter Admin key", $File) $Edi = GUICtrlCreateMenu("Edit") $Edit_Config = GUICtrlCreateMenuItem("Edit Config file", $Edi) $Drive_Letter = GUICtrlCreateMenuItem("Change Drive letter", $Edi) $Scite = GUICtrlCreateButton("Scite", 120, 0, 105, 49) $PaleMoon = GUICtrlCreateButton("Pale moon", 0, 56, 105, 49) $STS = GUICtrlCreateButton("STS", 120, 56, 105, 49) GUICtrlSetTip($STS, "Eclipse") $Notepad = GUICtrlCreateButton("notepad++", 0, 112, 105, 49) $Skype = GUICtrlCreateButton("Skype", 120, 112, 105, 49) $Exit = GUICtrlCreateButton("Exit", 120, 224, 105, 49) $Thunderbird = GUICtrlCreateButton("Thunderbird", 120, 168, 105, 49) $Tomcatui = GUICtrlCreateButton("Tomcat", 0, 168, 105, 49) $SQLyog = GUICtrlCreateButton("SQLyog", 0, 224, 105, 49) Dim $maingui_AccelTable[7][2] = [["{F1}", $Firefox],["{F2}", $Scite],["{F3}", $PaleMoon],["{F4}", $STS],["{F5}", $Notepad],["{F6}", $Skype],["{F7}", $Tomcatui]]; 2 dimentinal array to create keyboard shortcuts using "F" keys GUISetAccelerators($maingui_AccelTable) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### If _Singleton("I don't know what this does, but it works.", 1) = 0 Then GUISetState(@SW_HIDE, $maingui) GUIDelete($maingui) MsgBox(48, "Error", "The program is already open!") Exit EndIf If Not FileExists("Config.ini") Then GUISetState(@SW_DISABLE, $maingui) MsgBox(48, "Error", "Ini does not exist, a new one will be made with the defult values") GUISetState(@SW_DISABLE, $maingui) _iniWrite("D:") GUISetState(@SW_ENABLE, $maingui) EndIf _Check() #region ### Ini Read start ### ini= $IniFirefox = IniRead("Config.ini", "LocationNames", "$Firefox", "Not found") $IniScite = IniRead("Config.ini", "LocationNames", "$Scite", "Not found") $IniPaleMoon = IniRead("Config.ini", "LocationNames", "$PaleMoon", "Not found") $IniSTS = IniRead("Config.ini", "LocationNames", "$STS", "Not found") $IniNotepad = IniRead("Config.ini", "LocationNames", "$Notepad", "Not found") $IniSkype = IniRead("Config.ini", "LocationNames", "$Skype", "Not found") $Editprogramini = IniRead("Config.ini", "LocationNames", "$EditProgram", "Not found") $Thunderbirdini = IniRead("Config.ini", "LocationNames", "$Thunderbirdini", "Not found") $ThunderbirdInstall = IniRead("Config.ini", "LocationNames", "$ThunderbirdInstall", "Not found") $Thunderbird64 = IniRead("Config.ini", "LocationNames", "$Thunderbird64", "Not found") $Tomcat = IniRead("Config.ini", "LocationNames", "$Tomcat", "Not found") $SQLyogini = IniRead("Config.ini", "LocationNames", "$SQLyog", "Not found") #endregion ### Ini Read start ### ini= While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Exit GUISetState(@SW_DISABLE, $maingui) $quit = MsgBox(52, "Quit", "Are you sure you want to exit?") If $quit = 6 Then Exit Else GUISetState(@SW_ENABLE, $maingui) EndIf Case $Firefox Run($IniFirefox) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $Scite Run($IniScite) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $PaleMoon Run($IniPaleMoon) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $STS Run($IniSTS) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $Notepad Run($IniNotepad) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $Skype Run($IniSkype) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $Edit ShellExecute($Editprogramini) Case $Reset GUISetState(@SW_DISABLE, $maingui) If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36, "Reset?", "Are you sure you want to reset the configuation? This will reset the config to defults; ALL CHANGES WILL BE LOST") Select Case $iMsgBoxAnswer = 6 $restedelete = FileDelete("config.ini") If $restedelete = 0 Then _iniWrite("D:") Else _iniWrite("D:") EndIf MsgBox(64, "Please restart", "Please restart the program") Exit Case $iMsgBoxAnswer = 7 GUISetState(@SW_ENABLE, $maingui) EndSelect Case $Edit_Config $test = ShellExecute(@WorkingDir & "\Config.ini") Case $Drive_Letter GUISetState(@SW_DISABLE, $maingui) _Gui_Select() GUISetState(@SW_ENABLE, $maingui) WinActivate($maingui) Case $Thunderbird GUISetState(@SW_DISABLE, $maingui) _Gui_Thunderbird() GUISetState(@SW_ENABLE, $maingui) WinActivate($maingui) Case $Tomcatui Run($Tomcat) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $admin GUISetState(@SW_DISABLE, $maingui) _Crypt_Startup() While 1 $key = InputBox("Enter key", "Please enter the key to Unlock the code", "Null") If @error = 1 Then GUISetState(@SW_ENABLE, $maingui) ExitLoop EndIf $crypt_Key = (StringTrimLeft(_Crypt_HashData($key, $CALG_SHA1), 2)) If $crypt_Key == "55C388D3015FF7544A9D1FD8186A04FD88000209" Then ;Adminallowed1 GUISetState(@SW_HIDE, $maingui) MsgBox(64, "Correct", "Correct key, features are now unlocked", 5) MsgBox(64, "code on this computer", "This computer is registerd for the code, if you delete the code, you can't get it back... Unless you are clever.") $downloadTest = InetGet("https://dl.dropboxusercontent.com/s/ybcjjrslgtjzlhe/QuickLaunch.au3?dl=1&token_hash=AAHNERKvJbqjw9dt59HX5wPVvnLbQL5pQo-smUbykEwKUg", "Quicklaunch.au3", 1, 0) If $downloadTest = 0 Then ;error downloading MsgBox(16, "error", "There was an Error downloading or genarating the code, please allow the program though the firewall, If this happens again, contact Author") ExitLoop EndIf $errorCrypt = IniWrite(@TempDir & "/Admin.ini", "Isadmin", "$admin", StringTrimLeft(_Crypt_HashData("youareadmin", $CALG_SHA1), 2)) If $errorCrypt = 0 Then MsgBox(16, "Error", "Could not save Admin settings, this is not a problem: continueing...") ExitLoop EndIf MsgBox(64, "Please restart", "Please restart the program") Exit Else MsgBox(48, "Incorrect key", "Key is not correct!") EndIf _Crypt_Shutdown() WEnd Case $SQLyog Run($SQLyogini) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf EndSwitch WEnd Func _Gui_Select() ; Second GUI Local $Cancel, $Drive_ID, $read_selection, $Select, $Submist_Drive, $Warning_box ; Global $maingui $Select = GUICreate("select Drive", 131, 120, 192, 124, $WS_DLGFRAME, $ES_READONLY) $Drive_ID = GUICtrlCreateCombo("Select Drive", 8, 8, 113, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:") $Submist_Drive = GUICtrlCreateButton("Change", 8, 32, 113, 25) $Cancel = GUICtrlCreateButton("Cancel", 8, 64, 113, 25) GUISetState() ; GUISwitch($Select); set this Gui as current to receive messages ; While 1 Switch GUIGetMsg() Case $Submist_Drive GUISetState(@SW_DISABLE, $Select) $read_selection = GUICtrlRead($Drive_ID) If $read_selection = "Select Drive" Then MsgBox(48, "Warning", "Please select a drive letter") GUISetState(@SW_ENABLE, $Select) Else $Warning_box = MsgBox(52, "Warning", "Are you sure you want to change the Drive letter in the config file to: " & $read_selection) If $Warning_box = 6 Then _iniWrite($read_selection) GUIDelete($maingui) ; GLOBAL GUIDelete($Select) MsgBox(64, "Please restart", "Please restart the program") Exit Else GUISetState(@SW_ENABLE, $Select) EndIf EndIf Case $Cancel, $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; GUIDelete($Select) EndFunc Func _Gui_Thunderbird() ; Third GUI Local $Cancel, $Installed, $Portable, $ThunderbirdUI ;Global $Thunderbird64, $Thunderbirdini, $ThunderbirdInstall $ThunderbirdUI = GUICreate("Select type", 327, 86, 192, 124, $WS_DLGFRAME) $Portable = GUICtrlCreateButton("Portable", 0, 8, 97, 49) GUICtrlSetFont(-1, 12, 400, 0, "Calibri") $Installed = GUICtrlCreateButton("Installed", 224, 8, 97, 49) GUICtrlSetFont(-1, 12, 400, 0, "Calibri") $Cancel = GUICtrlCreateButton("Cancel", 112, 8, 97, 49) GUICtrlSetFont(-1, 12, 400, 0, "Calibri") GUISetState() ; GUISwitch($ThunderbirdUI); set this Gui as current to receive messages ; While 1 Switch GUIGetMsg() Case $Portable Run($Thunderbirdini) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Case $Installed If @OSArch = "X64" Then Run($Thunderbird64) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf Else Run($ThunderbirdInstall) If @error Then MsgBox(48, "Error", "There was a error while trying to open this program") EndIf EndIf Case $Cancel, $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; GUIDelete($ThunderbirdUI) EndFunc Func _Check() $isadmin = IniRead(@TempDir & "/Admin.ini", "Isadmin", "$admin", "apples") If $isadmin = "FA15EB666BCBA6755735B9767F3FE99D80121473" Then GUICtrlSetState($admin, $GUI_DISABLE) Local $i = IniWrite("Config.ini", "LocationNames", "$EditProgram", "Quicklaunch.au3") If $i = 0 Then MsgBox(16, "Error", "file is read-only!") EndIf EndIf EndFunc ;==>_Check Func _iniWrite($reading) $error = IniWrite("Config.ini", "LocationNames", "$Firefox", "C:\Program Files\Cyberfox\Cyberfox.exe") IniWrite("Config.ini", "LocationNames", "$Scite", $reading & "\Portible\AutoIt3\SciTE\SciTE.exe") IniWrite("Config.ini", "LocationNames", "$PaleMoon", $reading & "\Portible\Firefox(x86-64bit)\pale moon\Palemoon-Portable.exe") IniWrite("Config.ini", "LocationNames", "$STS", $reading & "\Portible\springsource\sts-3.4.0.RELEASE\STS.exe") IniWrite("Config.ini", "LocationNames", "$Notepad", $reading & "\Portible\Notepad++\notepad++.exe") IniWrite("Config.ini", "LocationNames", "$Skype", $reading & "\Portible\Skype\SkypePortable.exe") IniWrite("Config.ini", "LocationNames", "$EditProgram", $reading & "\auto it programs\close\close.au3") IniWrite("Config.ini", "LocationNames", "$Thunderbirdini", $reading & "\Portible\ThunderbirdPortable\ThunderbirdPortable.exe") IniWrite("Config.ini", "LocationNames", "$ThunderbirdInstall", "C:\Program Files\Mozilla Thunderbird\Thunderbird.exe") IniWrite("Config.ini", "LocationNames", "$Thunderbird64", "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe") IniWrite("Config.ini", "LocationNames", "$Tomcat", "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7.exe") IniWrite("Config.ini", "LocationNames", "$SQLyog", "C:\Program Files\SQLyog Community\SQLyogCommunity.exe") Sleep(1000) If $error = 0 Then GUIDelete($maingui) MsgBox(16, "Error", "Could not make Ini file, reason of this could be that the folder is read only") Exit Else MsgBox(64, "Done", "Ini made") EndIf EndFunc ;==>_iniWrite Just check to make sure that I have not broken something.
-
MHz's post in GUICtrlCreateCombo menu help was marked as the answer
I have made some changes. Creating a picture control in a function without destroying the previous picture control is just add another one on top of the previous one. So put control creation in global code and update with GUICtrlSetImage. Replace some functions with Gui... equivalents so it remains handling by internal control ids. I left the picture and label control below the GuiSetState though you can move up into the main gui code if you would like to. Differcult for me to understand the language used so I cannot be sure of doing a good fix.
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) HotKeySet("^x", "izlaz1") #region --- CodeWizard generated code Start --- ;SpashImage features: Title=No, Width=900, Height=400, Always On Top SplashImageOn("", "twisterfun.jpg", "900", "400", "-1", "-1", 1) Sleep(1000) SplashOff() #endregion --- CodeWizard generated code Start --- #region ### START Koda GUI section ### Form=C:\Documents and Settings\SlavonskiBrod01\My Documents\My Pictures\Form1.kxf $Form1_1 = GUICreate("Twisterichne kartice", 624, 450, 192, 114, $WS_BORDER) $MenuItem1 = GUICtrlCreateMenu("&Izbornik") $MenuItem4 = GUICtrlCreateMenuItem("&Nova kartica", $MenuItem1) GUICtrlSetOnEvent($MenuItem4, "svenovo1") $MenuItem9 = GUICtrlCreateMenuItem("&Izdane kartice", $MenuItem1) GUICtrlSetOnEvent($MenuItem9, "izdane1") $MenuItem7 = GUICtrlCreateMenu("&O programu") $MenuItem3 = GUICtrlCreateMenuItem("---------------", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("I&zlaz (Ctrl+x)", $MenuItem1) GUICtrlSetOnEvent($MenuItem5, "izlaz1") $imeprezime = GUICtrlCreateInput("", 100, 40, 120, 21, BitOR($ES_UPPERCASE, $ES_OEMCONVERT)) GUICtrlCreateLabel("Ime i prezime:", 20, 43, 80, 15) $adresa = GUICtrlCreateInput("", 100, 66, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Adresa:", 20, 69, 80, 15) $posta = GUICtrlCreateInput("", 100, 92, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER, $ES_OEMCONVERT)) GUICtrlSetLimit(-1, 5, 5) GUICtrlCreateLabel("Broj pošte:", 20, 95, 80, 15) $grad = GUICtrlCreateInput("", 100, 118, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE, $ES_OEMCONVERT)) GUICtrlCreateLabel("Grad:", 20, 121, 80, 15) $datum = GUICtrlCreateDate(_NowDate(), 20, 280, 200, 20, $DTS_SHORTDATEFORMAT) $datumx = _NowDate() $datumizd = GUICtrlCreateLabel("Datum izdavanja kartice", 20, 260, 118, 15) $vrijedido = GUICtrlCreateLabel("Vrijedi do:", 20, 320, 50, 17) ;~ $datumizdtxt2 = ControlGetText("Twisterichne kartice", "", "[ID:12]") $vrsta = GUICtrlCreateCombo("", 20, 170, 200, 25) ;~ $vrsta = GUICtrlCreateList("", 312, 272, 113, 110) GUICtrlSetData(-1, "Mjesecna|Polugodisnja|Godisnja", "") GUICtrlSetOnEvent($vrsta, "kartica1") $vrstakar = GUICtrlCreateLabel("Vrsta kartice", 20, 150, 200, 15) $brojkartlabel = GUICtrlCreateLabel("Broj kartice", 20, 200, 200, 15) $brojkart = GUICtrlCreateInput("", 20, 220, 60, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $djelatna = GUICtrlCreateLabel("Djelatnik:", 20, 17, 60, 15) $djelatnici = GUICtrlCreateCombo("", 100, 13, 119, 25) GUICtrlSetData(-1, "Anita Tihi|Nikolina Matanovic", "Anita Tihi") $Spremi = GUICtrlCreateButton("Spremi", 20, 368, 75, 25) GUICtrlSetOnEvent($Spremi, "spremi1") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### ; *** create these here and not over and over in a function $pic = GUICtrlCreatePic("", 256, 0, 364, 228) $vrijedido2 = GUICtrlCreateLabel('', 80, 320, 100, 17) While 1 Sleep(10) ; *** it is oneventmode so GUIGetMsg will not work ;~ $msg = GUIGetMsg() ;~ Switch $msg ;~ Case $GUI_EVENT_CLOSE ;~ Exit ;~ EndSwitch WEnd Func svenovo1() ;put empty values into fields GUICtrlSetData($imeprezime, '') GUICtrlSetData($adresa, '') GUICtrlSetData($posta, '') GUICtrlSetData($grad, '') GUICtrlSetData($vrsta, '') GUICtrlSetData($brojkart, '') GUICtrlSetImage($pic, "") EndFunc ;==>svenovo1 Func kartica1() Switch GUICtrlRead($vrsta) Case "Mjesecna" GUICtrlSetImage($pic, "mjesecna.jpg") $dodandatum = _DateAdd('M', 1, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) Case "Polugodisnja" GUICtrlSetImage($pic, "polugodisnja.jpg") $dodandatum = _DateAdd('M', 6, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) Case "Godisnja" GUICtrlSetImage($pic, "godisnja.jpg") $dodandatum = _DateAdd('M', 12, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) EndSwitch GUICtrlSetData($vrijedido2, $novidatum) EndFunc ;==>kartica1 Func spremi1() $imeprezimetxt = GUICtrlRead($imeprezime) $adresatxt = GUICtrlRead($adresa) $postatxt = GUICtrlRead($posta) $gradtxt = GUICtrlRead($grad) $brojkarttxt = GUICtrlRead($brojkart) $datumizdtxt = GUICtrlRead($datum); *** $datum instead of $datumizd ? $djelatnicitxt = GUICtrlRead($djelatnici) $vrijedidotxt = GUICtrlRead($vrijedido) FileWrite(@ScriptDir & "\izdane kartice\" & $brojkarttxt & "_" & $imeprezimetxt & ".txt", @CRLF & "PREZIME I IME: " & $imeprezimetxt & @CRLF & "ADRESA: " & $adresatxt & @CRLF & "MJESTO: " & $postatxt & " " & $gradtxt & @CRLF & "BROJ KARTICE: " & $brojkarttxt & @CRLF & "KARTICA IZDANA: " & $datumizdtxt & @CRLF & "VRIJEDI DO: " & $vrijedidotxt & @CRLF & @CRLF & "DJELATNICA: " & $djelatnicitxt) MsgBox(4096, "Podatci", "Podatci spremljeni u txt file pod imenom:" & @CRLF & $brojkarttxt & "_" & $imeprezimetxt & ".txt") EndFunc ;==>spremi1 Func izdane1() ;~ MsgBox(4,"Pregled izdanih kartica","#Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36,"Pregled izdanih kartica","Da li zelite otvoriti direktorij u kojem se nalaze izdane kartice?") Select Case $iMsgBoxAnswer = 6 ;Yes Run("Explorer.exe " & @ScriptDir & "\izdane kartice") Case $iMsgBoxAnswer = 7 ;No Sleep(100) EndSelect #EndRegion --- CodeWizard generated code End --- EndFunc ;==>izdane1 Func izlaz1() Exit EndFunc ;==>izlaz1
-
MHz's post in Is _SQLite_QueryFinalize really necessary? was marked as the answer
I get the error with using #include <SQLite.dll.au3>, otherwise this works fine as I have SQLite3.dll in path.
#include <SQLite.au3> ;~ #include <SQLite.dll.au3> _SQLite_Startup () _SQLite_Open ("") _SQLite_Exec(-1,"CREATE TABLE IF NOT EXISTS Architecture ('Architecture');") _SQLite_Exec(-1,"INSERT INTO Architecture VALUES ('x64');") _SQLite_Exec(-1,"INSERT INTO Architecture VALUES ('x32');") Local $sRet = _Database_Query("SELECT * FROM Architecture;") $sRet = _Database_Query("SELECT * FROM Architecture;") ; added to run another query without closing the first and try to error MsgBox(0, 'Result ' & @error, $sRet) MsgBox(0,'Close', _SQLite_Close ()) MsgBox(0,'Shutdown',_SQLite_Shutdown ()) Func _Database_Query($sSQL, $iOutput = 1) ; output 1 = delimited string, 2 = array Local $vRet, $hQuery, $aRow, $sRet, $bEarlyReturn If _SQLite_Query(-1, $sSQL, $hQuery) = $SQLITE_OK Then ; loop and get all the data While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK $sRet &= $aRow[0] & '|' ; If Fetchdata does not finalize as to early exit from the loop then ; you may need to use _SQLite_QueryFinalize() to inform SQLite to release ; from the query. If Random(0, 2, 1) Then ; if this is not called then SQLite may stay busy with the open query ; and you may get the error when you close SQLite or do another query MsgBox(0, 'Finalize', 'Returned: ' & _SQLite_QueryFinalize($hQuery)) Return $sRet EndIf WEnd If $sRet == '' Then Return SetError(1, 0, '') ; trim any trailing | $sRet = StringRegExpReplace($sRet, '[\|]\z', '') ; If $iOutput = 1 Then Return $sRet Return StringSplit($sRet, '|') Else MsgBox(0,'', 'Error: ' & _SQLite_ErrMsg()) Return SetError(2, 0, '') EndIf EndFunc ;==>_Database_Query You initiate the query so SQLite is busy doing the query. You call FetchData in a loop to get the data of the query until finalized. If you do not loop until finalized, then SQLite remains in the busy state with the query and as such it errors if you attempt another query or attempt to close the handle. This is when you call QueryFinalize to end the query. I would not expect use of QueryFinalize in your UDF as you loop through with FetchData until finalized. So if you attempt to use QueryFinalize when it is already finalized then you get an error on close. If the query errors then their is nothing to finalize so no need to use on error either.
-
MHz's post in Ctrl - Shift key stuck was marked as the answer
You change
Send("my_value") to
_SendEx("my_value") Here is a change to your code with the use of the linked code that BrewManNH posted to sleep until the Shift-Ctrl-Alt keys are released. I guess it shows that using the keyboard while using Send can activate the issue with key state. Best to deactivate the hotkey while the sleep happens else the queue can still be added to.
#include < Misc.au3 > HotKeySet("^+9", "Encl") While 1 Sleep(10000) WEnd Func Encl() ClipPut("") HotKeySet(@HotKeyPressed) While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") Sleep(10) WEnd Send("^x") Sleep(200) local $ClipEncl = ClipGet() Switch @HotKeyPressed Case "^+9" $ClipEncl = '(' & $ClipEncl & ')' EndSwitch ClipPut($ClipEncl) Send("^v") HotKeySet(@HotKeyPressed, "Encl") EndFunc I have not been able to create the issue with testing this though if you like playing your keyboard like a piano then the _SendEx() is probably best to use to ensure all sends are covered.
-
MHz's post in running an autoit exe from qtp with parameters was marked as the answer
So this is VBS in QTP? If so then double up the double quotes and use braces only if you retrieve the return value. Try this line
oAutoIt.Run """C:\PWCOnlineQTP\traytip.exe"" ""This is a TITLE"" ""This is a message"""
-
MHz's post in FileOpenDialog and SQLite Error was marked as the answer
Using relative paths can a problem if the script is not handling the relative paths with any change of working directory.
I am not changing too much to the code other then getting it working. The single quotes around text parameters to SQLite seem fine. The major concern was the working directory change when using FileOpenDialog. FileOpenDialog changes working directory to the path of the selected file. The database.db being used in _SQLite_Open() may not be at the same path with successful use of FileOpenDialog. So when the working directory changed, then your SQL Insert statements failed as database.db did not exist in the current working directory.
This is what I tested with.
; Changes: ; Added missing _GoMainScreen() that was added to test with ; Updated OpenImage() to handle workingdir change to fix major issue ; Removed 3rd parameter used for _SQLite_Exec() as unneeded and it was doing nothing as being "" #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;SQLite Include #include <SQLite.au3> #include <SQLite.dll.au3> #include <file.au3> Opt("GUIOnEventMode", 1) Global $type,$vintage,$enginecode,$cubic,$performance,$license,$image $AddForm = GUICreate("Autó Hozzáadás", 468, 364, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_GoMainScreen") ;GoMainScreen GUISetState(@SW_SHOW) GUISetFont(11, 400, 0, "Myriad Hebrew") $Group1 = GUICtrlCreateGroup("Autó adatai", 8, 8, 449, 225) $Label1 = GUICtrlCreateLabel("Típus", 90, 38, 38, 22) $type = GUICtrlCreateInput("", 144, 32, 289, 26) $Label2 = GUICtrlCreateLabel("Évjárat", 83, 68, 46, 22) $vintage = GUICtrlCreateInput("", 144, 64, 289, 26) $Label3 = GUICtrlCreateLabel("Motorkód", 64, 103, 65, 22) $enginecode = GUICtrlCreateInput("", 144, 96, 289, 26) $cubic = GUICtrlCreateInput("", 144, 128, 289, 26) $performance = GUICtrlCreateInput("", 144, 160, 289, 26) $license = GUICtrlCreateInput("", 144, 192, 289, 26) $Label4 = GUICtrlCreateLabel("Hengerürtartalom", 16, 133, 118, 22) $Label6 = GUICtrlCreateLabel("Teljesítmény", 48, 163, 86, 22) $Label7 = GUICtrlCreateLabel("Rendszám", 64, 198, 68, 22) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Kép", 8, 248, 449, 65) $Label5 = GUICtrlCreateLabel("Kép kiválasztás", 13, 278, 98, 22) $Button2 = GUICtrlCreateButton("Tallózás...", 360, 272, 89, 25) GUICtrlSetOnEvent(-1, "OpenImage") ;OpenImage $image = GUICtrlCreateInput("", 112, 272, 241, 26) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button3 = GUICtrlCreateButton("Mégse", 328, 320, 121, 33) GUICtrlSetOnEvent(-1, "_GoMainScreen") ;GoMainScreen $Button4 = GUICtrlCreateButton("Hozzáadás", 192, 320, 121, 33) GUICtrlSetOnEvent(-1, "InsertCar") ;Insert Car #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func OpenImage() Local $var, $workingdir ; save workingdir $workingdir = @WorkingDir ; FileOpenDialog changes the workingdir on success $var = FileOpenDialog("Válaszd ki az album mappáját", "","Képek (*.jpg;*.bmp;*.jpeg;*.gif)", 1) If $var Then GUICtrlSetData($image, $var) EndIf ; If FileExists code block is for temporary debugging If Not FileExists('database.db') Then MsgBox(0x40030, 'Debug', 'database.db does not exist' & @CRLF & _ '$workingdir = "' & $workingdir & '"' & @CRLF & _ '@WorkingDir = "' & @WorkingDir & '"' _ ) EndIf ; go back to save workingdir FileChangeDir($workingdir) EndFunc Func InsertCar() Local $listQuery, $listRow, $listMsg _SQLite_Startup() _SQLite_Open('database.db') _SQLite_Exec(-1, "CREATE TABLE IF NOT EXISTS cars (id INTEGER PRIMARY KEY, type TEXT, vintage TEXT, enginecode TEXT, cubic TEXT, performance TEXT, license TEXT, image TEXT);") ; Create Table _SQLite_Exec(-1, "INSERT INTO cars (type,vintage,enginecode,cubic,performance,license,image) VALUES ('" & GUICtrlRead($type) & "','" & GUICtrlRead($vintage) & "','" & GUICtrlRead($enginecode) & "','" & GUICtrlRead($cubic) & "','" & GUICtrlRead($performance) & "','" & GUICtrlRead($license) & "','" & GUICtrlRead($image) & "');") ; Insert Row MsgBox(0, "SQLite Error", "Error Code: " & _SQLite_ErrCode() & @CRLF & "Error Message: " & _SQLite_ErrMsg()) _SQLite_Close() _SQLite_Shutdown() ;_UpdateListView() ;_GoMainScreen() EndFunc ; missing function that was added to test with Func _GoMainScreen() Exit EndFunc The code that kylomas has posted does not have an issue with working directory change as the handle created by _SQLite_Open() is kept open.
So hopefully the question of FileOpenDialog is compatible with SQLite has been answered.
-
MHz's post in Golbal Functions was marked as the answer
Perhaps the vital part of your code could be like this?
Send("{BACKSPACE}www.yahoo.com{DEL}{ENTER}") If WinWait("Yahoo Canada - Mozilla Firefox", "", 3) Then MsgBox(0, "Error", "Please Check your Settings in Forticlient") Exit EndIf _WinWaitActivate("Web Page Blocked! - Mozilla Firefox","") You could also use AdlibRegister to look for certain titles with WinExists and exit if detected.
-
MHz's post in Remove first few lines from GUICtrlCreateEdit was marked as the answer
Removing the 1st 8 lines would best be done in a separate use of StringRegExpReplace as it has little in common with replacing the other strings.
Your 2nd code option is perhaps close with a small change of using $StrReplace from the 1st StringRegExpReplace and using it as the input of the 2nd StringRegExpReplace.
$StrReplace = StringRegExpReplace(GUICtrlRead($Output), '.*?[\r\n]+', '', 8) $StrReplace = StringRegExpReplace($StrReplace, '[\r\n]*- \d* files found in \d* seconds[\r\n]*' & '\s*coverage file \d*\s*\d*%\s*\d*\s*\d*\s*[\r\n]*', '') GUICtrlSetData($Output, $StrReplace) It would the same nesting the function call like this
$StrReplace = StringRegExpReplace( _ StringRegExpReplace(GUICtrlRead($Output), '.*?[\r\n]+', '', 8), _ '[\r\n]*- \d* files found in \d* seconds[\r\n]*' & _ '\s*coverage file \d*\s*\d*%\s*\d*\s*\d*\s*[\r\n]*', '' _ ) GUICtrlSetData($Output, $StrReplace)
-
MHz's post in Multi vars in run command was marked as the answer
The last one is with you setting a working directory. I do not see you making good use of it though it may have benefits if used to help with the command string. If you set the working directory of CMD to @TempDir then paths there can be relative to that path like you can do in a command prompt.
So a total of what could be used by setting the workingdir parameter to @TempDir
; Post #1 Run('"' & @ComSpec & '" /c bm.exe -d -o zi2.bms "' & @DesktopDir & '\ters.pak"', @TempDir, @SW_HIDE) ; Post #8 Run('"' & @ComSpec & '" /c sod\bm.exe -o -d sod\zi2.bms "' & GuiCtrlRead($File) & '"', @TempDir, @SW_HIDE) ; Post #10 Run('"' & @ComSpec & '" /c sod\bm.exe -o sodt\zi2.bms "' & GuiCtrlRead($File) & '" "' & @DesktopDir & '\P Ion"', @TempDir, @SW_HIDE) If you still need help with those double quotes, then, perhaps this may help.
GUICreate('test') $File = GUICtrlCreateInput('Some file.exe', 0, 0) ; Post #1 Local $tmp = @TempDir & '\stg' Local $dtop = @DesktopDir Global $command[7] = [ _ @ComSpec, _ '/c', _ $tmp & '\sod\bm.exe', _ '-d', _ '-o', _ $tmp & '\zi2.bms', _ $dtop & '\ters.pak' _ ] $command = _ArrayToCmdLineString($command) _Display($command) ; Post #8 Global $command[7] = [ _ @ComSpec, _ '/c', _ @TempDir & '\sod\bm.exe', _ '-o', _ '-d', _ @TempDir & '\sod\zi2.bms', _ GuiCtrlRead($File) _ ] $command = _ArrayToCmdLineString($command) _Display($command) ; Post #10 Global $command[7] = [ _ @ComSpec, _ '/c', _ @TempDir & '\sod\bm.exe', _ '-o', _ @TempDir & '\sod\zi2.bms', _ GuiCtrlRead($File), _ @DesktopDir & '\P Ion' _ ] $command = _ArrayToCmdLineString($command) _Display($command) ; Post #10 though with workingdir of @TempDir set in Run ; will do the array as one line for this test Global $command[7] = [@ComSpec, '/c', 'sod\bm.exe', '-o', 'sod\zi2.bms', GuiCtrlRead($File), @DesktopDir & '\P Ion'] $command = _ArrayToCmdLineString($command) _Display($command) GUIDelete() Exit Func _ArrayToCmdLineString($aInput, $iLBound = 0) Local $1, $sOutput If Not IsArray($aInput) Then Return SetError(1, 0, '') For $1 = $iLBound To UBound($aInput) -1 ; trim whitespace from both ends $aInput[$1] = StringStripWS($aInput[$1], 3) ; if double quotes are not on both ends and a space is found, then add double quotes If StringInStr($aInput[$1], ' ') And Not StringRegExp($aInput[$1], '\A".*"\Z') Then $sOutput &= '"' & $aInput[$1] & '" ' Else $sOutput &= $aInput[$1] & ' ' EndIf Next $sOutput = StringStripWS($sOutput, 3) If $sOutput == '' Then Return SetError(2, 0, '') Return $sOutput EndFunc Func _Display($message, $error = @error, $line = @ScriptLineNumber) ; display result of test If Not $error Then MsgBox(0, $line, $message) Else MsgBox(0x30, $line, '@error ' & $error) EndIf EndFunc The _ArrayToCmdLineString function will join the array elements into a string. It will put double quotes around elements that contain a space. The _Display function is just for easy showing of the result of each command. The lines that end with a space and then an underscore are continuation chars to indicate a line continued to the next line. If you have 6 elements in the array, then you insert 6 between the square brackets after the array name. You may noticed that I use $command for creation of the array and as the variable for the return from ArrayToCmdLineString. It is just reusing a variable since interest in the array is no more after the use of it. The $iLBound parameter is optional and is just useful if you want to start the joining of the command string from 1 or greater element of the array (default is 0).
Now the idea above may help as the command parameters are added to the array without quotes. Sometimes people like to break up a command into parts so it may help to make it easier to handle. You could also break it down as keeping it as a string though it may still be complicated for some. Like the string below.
$sCommand = _ '"' & @ComSpec & '"' & _ '/c' & _ '"' & @TempDir & '\sod\bm.exe' & '"' & _ '-o' & _ '-d' & _ '"' & @TempDir & '\sod\zi2.bms' & '"' & _ '"' & GuiCtrlRead($File) & '"' Choose what works for you.
-
MHz's post in FileSaveDialog Issue was marked as the answer
The value of $valsave is an empty string yet as a number will equal 0. GuiGetMsg may return 0 on no event. You could put a Case 0 right below the Case $GUI_EVENT_CLOSE and use a ContinueLoop so 0 is not available past the Case 0.
-
MHz's post in how to link the menu with another .au3 files was marked as the answer
Labels below the menu bar. Labels are quite easy to add.
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("Menu", 500, 500) ; 5 labels created here GUICtrlCreateLabel('label 1', 5, 0, 100) GUICtrlCreateLabel('label 2', 105, 0, 100) GUICtrlCreateLabel('label 3', 205, 0, 100) GUICtrlCreateLabel('label 4', 305, 0, 100) GUICtrlCreateLabel('label 5', 405, 0, 100) $home = GUICtrlCreateMenu("&HOME") ; create a menu item for the script to run $run = GUICtrlCreateMenuItem("&Run a script", $home) $register = GUICtrlCreateMenu("®ISTER") $now = GUICtrlCreateMenuItem("&Now", $register) $admission = GUICtrlCreateMenu("&ADMISSION") $accept = GUICtrlCreateMenuItem("&Accept", $admission) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $run ; add the name of the script into a variable $script = 'test2.au3' ; run the script Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $script & '"') If @error Then MsgBox(0x30, 'Run a script', 'test2.au3 did not run') Case $msg = $now MsgBox(0, 'Now', 'Time to register') Case $msg = $accept MsgBox(0, 'Accept', 'I can register it now') EndSelect WEnd 5 labels for you.
-
MHz's post in Open a file with an autoit compiled script thru windows context menu was marked as the answer
Hi careca,
I have some concerns why you are using the Windows directory. My example is not going there.
Another is writing to HKCR. This is a merged root key created for easy reading of classes. It is not a good idea to write to it.
2 keys exist for writing classes are
HKCUSOFTWAREClasses HKLMSOFTWAREClasses Writing to HKCR can mess things up as it does not know to which of those 2 above paths that it is writing to.
Notice in the CommandStore that keys are listed as for e.g. Windows.playmusic. This is done so keys are unique. So may I suggest you follow with a similar naming scheme.
This is a regfile that I tested with
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\BPlayer] "MUIVerb"="BPlayer" "SubCommands"="BPlayer.Play;BPlayer.List" "icon"="C:\\BPlayer\\BPlayer.ico" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.Play] "MUIVerb"="Play" "icon"="C:\\BPlayer\\BPlayer.ico" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.Play\command] @="\"C:\\BPlayer\\Beats Player 1.6.exe\" /P \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.List] "MUIVerb"="Add to list" "icon"="C:\\BPlayer\\BPlayer.ico" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\BPlayer.List\command] @="\"C:\\BPlayer\\Beats Player 1.6.exe\" /L \"%1\"" This is the script that was compiled as "Beats Player 1.6.exe" to test with
Global $action, $file_to_play If $CMDLINE[0] Then For $1 = 1 To $CMDLINE[0] Switch $CMDLINE[$1] Case '/P' $action = 'play' Case '/L' $action = 'list' Case Else If FileExists($CMDLINE[$1]) Then $file_to_play = $CMDLINE[$1] EndIf EndSwitch Next EndIf MsgBox(0, @ScriptName, _ '$action = ' & $action & @CRLF & _ '$file_to_play = ' & $file_to_play & @CRLF _ ) If I right click on "Beats Player 1.6.exe" and select BPlayer -> Play from the context menu then I get a Msgbox with this
--------------------------- Beats Player 1.6.exe --------------------------- $action = play $file_to_play = C:\BPlayer\Beats Player 1.6.exe --------------------------- OK --------------------------- In the registry, %1 is replaced with the path of the highlighted file from explorer. This is how you get the path.