Masen Posted December 25, 2016 Share Posted December 25, 2016 what im trying to do is get the list box to open certain files to the computers default programs. mainly using windows 10. hopefully this makes sense. thx in advance. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form=c:\users\masen\desktop\workshop interface\masen.kxf $Masen = GUICreate("Masen's Headquarter", 777, 574, 192, 124) GUISetCursor (0) GUISetBkColor(0xFF0000) $Information = GUICtrlCreateEdit("", 24, 176, 361, 321) GUICtrlSetData(-1, "Information") GUICtrlSetBkColor(-1, 0xC8C8C8) $Home = GUICtrlCreateButton("Home", 112, 64, 75, 25, $WS_GROUP) $Company = GUICtrlCreateButton("Company", 192, 64, 75, 25, $WS_GROUP) $Music = GUICtrlCreateButton("Music", 432, 64, 75, 25, $WS_GROUP) $Pictures = GUICtrlCreateButton("Pictures", 352, 64, 75, 25, $WS_GROUP) $Website = GUICtrlCreateButton("Website", 272, 64, 75, 25, $WS_GROUP) $Admin = GUICtrlCreateButton("Admin", 512, 64, 75, 25, $WS_GROUP) $TodoList = GUICtrlCreateEdit("", 488, 192, 241, 281) GUICtrlSetData(-1, "TodoList") $ToDoLis = GUICtrlCreateLabel("To Do List", 520, 144, 161, 39) GUICtrlSetFont(-1, 22, 800, 0, "MS Reference Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $MHQ = GUICtrlCreateLabel("Masen's Headquarter Interface", 112, 8, 577, 50) GUICtrlSetFont(-1, 30, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetBkColor(-1, 0x000000) $Open = GUICtrlCreateButton("Open", 32, 512, 75, 25, $WS_GROUP) $Save = GUICtrlCreateButton("Save", 112, 512, 75, 25, $WS_GROUP) $Open2 = GUICtrlCreateButton("Open", 488, 488, 75, 25, $WS_GROUP) $Save2 = GUICtrlCreateButton("Save", 568, 488, 75, 25, $WS_GROUP) $SD1 = GUICtrlCreatePic("C:\Users\masen\Desktop\Workshop Interface\Prototype Images\Space Divider1.bmp", 32, 112, 716, 12, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic1 = GUICtrlCreatePic("C:\Users\masen\Desktop\Workshop Interface\Prototype Images\Space Divider1.bmp", 464, 128, 12, 444, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic2 = GUICtrlCreatePic("C:\Users\masen\Desktop\Workshop Interface\Prototype Images\Space Divider1.bmp", 400, 128, 12, 444, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Info = GUICtrlCreateLabel("Information Screen", 48, 128, 303, 39) GUICtrlSetFont(-1, 22, 800, 0, "MS Reference Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $Folders = GUICtrlCreateButton("Folders", 592, 64, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Folders Folders () EndSwitch WEnd Func Folders() $message = ("Click Shift to Select Multiple files.") $var = FileOpenDialog($message, "C:\Users\masen\Desktop\Database" & "\", "Pictures (*.jpg; *.bmp; *.png; *.gif)|Videos (*.avi; *.mpg)|Txt (*.txt)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) $file = FileRead($var) If @error Then Else endif MsgBox(0, "", "No File(s) were selected") EndFunc ;==>Example Link to comment Share on other sites More sharing options...
careca Posted December 25, 2016 Share Posted December 25, 2016 2 hours ago, Masen said: to open certain files to the computers default programs What i get from that is you want to associate certain file extensions to certain applications. In essence, a file associater? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Masen Posted December 25, 2016 Author Share Posted December 25, 2016 ok for example if i would want to open a music file from this script. like Korn - Freak on a leash.mp3 it would open with windows media players then same script if i would wanna open a picture file like Family.jpg it would open in Microsoft Photo program or paint. hopfuly this helped Link to comment Share on other sites More sharing options...
careca Posted December 25, 2016 Share Posted December 25, 2016 ShellExecute should open the file with it's default application association. ShellExecute(@ScriptDir&'\family.jpg') Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Masen Posted December 25, 2016 Author Share Posted December 25, 2016 (edited) ok. but wut im doing is open a window to open multi files not just family.jpg otherwise i got to type all the picture names music and all the other files and make buttons for them. when i open a family.jpg using this script it does not go any farther than this window. im trying to get it to open family.jpg from this script and jump over to a paint program or microsoft photo. or when i open a text.txt folder just to read some information on notepad it does not go to not pad just says no files were selected. Func Folders() $message = ("Click Shift to Select Multiple files.") $var = FileOpenDialog($message, "C:\Users\masen\Desktop\Database" & "\", "Pictures (*.jpg; *.bmp; *.png; *.gif)|Videos (*.avi; *.mpg)|Txt (*.txt)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) $file = FileRead($var) If @error Then Else endif MsgBox(0, "", "No File(s) were selected") EndFunc ;==>Example Edited December 25, 2016 by Masen Link to comment Share on other sites More sharing options...
careca Posted December 25, 2016 Share Posted December 25, 2016 #include <FileConstants.au3> Folders() Func Folders() $message = ("Click Shift to Select Multiple files.") $var = FileOpenDialog($message, "C:\Users\masen\Desktop\Database" & "\", "Pictures (*.jpg; *.bmp; *.png; *.gif)|Videos (*.avi; *.mpg)|Txt (*.txt)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If Not @error Then ShellExecute($var) Else MsgBox(64, 'Error', 'Error') Endif EndFunc ;==>Example Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Masen Posted December 25, 2016 Author Share Posted December 25, 2016 after you typed that out i did some modifications to it. did it this way and it worked. thx for the inspiration Func Folders() $message = ("Click Shift to Select Multiple files.") $var = FileOpenDialog($message, "C:\Users\masen\Desktop\Database" & "\", "Pictures (*.jpg; *.bmp; *.png; *.gif)|Videos (*.avi; *.mpg)|Txt (*.txt)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) $file = ShellExecute($var) EndFunc ;==>Example Link to comment Share on other sites More sharing options...
careca Posted December 25, 2016 Share Posted December 25, 2016 (edited) Thing is, if you do select more than one, trouble gonna arise, more modifications have to be done, and you removed the error check, why i don't know, but anyway. If you get in trouble making multiple files to open, come back, we help. In fact, check the for loops for that. Edited December 25, 2016 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Masen Posted December 25, 2016 Author Share Posted December 25, 2016 (edited) yea i will be back. just 1 thing at a time and the reason why i removed that error script when i open the pictures it still said no file selected. when clearly it was selected and open haha yea ill have to figure that out when i open multi files. or i got a solution to it let me know Edited December 25, 2016 by Masen Link to comment Share on other sites More sharing options...
careca Posted December 25, 2016 Share Posted December 25, 2016 #include <FileConstants.au3> Folders() Func Folders() $message = ("Click Shift to Select Multiple files.") $var = FileOpenDialog($message, "C:\Users\masen\Desktop\Database" & "\", "Pictures (*.jpg; *.bmp; *.png; *.gif)|Videos (*.avi; *.mpg)|Txt (*.txt)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If Not @error Then If StringInStr($var, '|') Then $Split = StringSplit($var, '|', 1) For $i = 1 to $Split[0] ;ConsoleWrite($Split[$i] &' - '&@MSEC&@CRLF) ShellExecute($Split[$i]) Next Else ShellExecute($var) EndIf Else MsgBox(64, 'Error', 'Error') Endif EndFunc ;==>Example Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Masen Posted December 25, 2016 Author Share Posted December 25, 2016 alright thx nice a clean up on that Link to comment Share on other sites More sharing options...
SadBunny Posted December 25, 2016 Share Posted December 25, 2016 Also, Korn - Freak On A Leash! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now