Jump to content

aphesia

Active Members
  • Posts

    167
  • Joined

  • Last visited

Everything posted by aphesia

  1. Good morning everyone, I have a little script which checks whether a device is online in my network or not by pinging it's ip. So far my script has been working but suddenly it won't detect the ping answer "Destination host unreachable" as ping = 0 (error) anymore: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.5.6 (beta) Author: Patrick Schneider Script Function: Checks if I´m back at home with my laptop. If so, it will enable the scheduler in uTorrent to slow down the upload rate. It will update the ipfilter.dat & restart uTorrent. Also included a log file to check when an update is done and which device enables the scheduler. lan laptop 192.168.178.30 wlan maci 192.168.178.67 lan maci 192.168.178.22 lan laptop: 192.168.1.17 lan maci: 192.168.1.22 wlan maci: 192.168.178.67 Laptop = offline.......$status = 0 Scheduler = disabled.......&scheduler = 0 #ce ---------------------------------------------------------------------------- #include <Date.au3> If ProcessExists("uTorrent.exe") Then Sleep(10000) Else ProcessWait("uTorrent.exe") Sleep(10000) EndIf If FileExists(@ScriptDir & "\status.ini") = 0 Then MsgBox(0, "First run", "Please enable the scheduler in uTorrent. Afterwards press OK") IniWrite(@ScriptDir & "\status.ini", "Server status", "Devices Online", "No") IniWrite(@ScriptDir & "\status.ini", "Devices", "My_Laptop", "Offline") IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_LAN", "Offline") IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_WLAN", "Offline") IniWrite(@ScriptDir & "\status.ini", "Server status", "Scheduler", "Enabled") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP1", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP2", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP3", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP4", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP5", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP6", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP7", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP8", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP9", "0") IniWrite(@ScriptDir & "\status.ini", "IPs", "IP10", "0") EndIf While 1 $IP1 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP1", "NotFound") $IP2 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP2", "NotFound") $IP3 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP3", "NotFound") $IP4 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP4", "NotFound") $IP5 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP5", "NotFound") $IP6 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP6", "NotFound") $IP7 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP7", "NotFound") $IP8 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP8", "NotFound") $IP9 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP9", "NotFound") $IP10 = IniRead(@ScriptDir & "\status.ini", "IPs", "IP10", "NotFound") $maciwlan = Ping($IP4, 1000) $macilan = Ping($IP3, 1000) $mylaptop = Ping($IP1, 1000) $mylaptop2 = Ping($IP2, 1000) If $maciwlan = 0 And $macilan = 0 And $mylaptop = 0 And $mylaptop2 = 0 And $IP5 = 0 And $IP6 = 0 And $IP7 = 0 And $IP8 = 0 And $IP9 = 0 And $IP10 = 0 Then Sleep(60000) If $maciwlan = 0 And $macilan = 0 And $mylaptop = 0 And $mylaptop2 = 0 And $IP5 = 0 And $IP6 = 0 And $IP7 = 0 And $IP8 = 0 And $IP9 = 0 And $IP10 = 0 Then IniWrite(@ScriptDir & "\status.ini", "Server status", "Devices Online", "No") IniWrite(@ScriptDir & "\status.ini", "Devices", "My_Laptop", "Offline") IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_LAN", "Offline") IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_WLAN", "Offline") EndIf Else IniWrite(@ScriptDir & "\status.ini", "Server status", "Devices Online", "Yes") If $mylaptop Then IniWrite(@ScriptDir & "\status.ini", "Devices", "My_Laptop", "Online") Else Sleep(60000) If $mylaptop = 0 Then IniWrite(@ScriptDir & "\status.ini", "Devices", "My_Laptop", "Offline") EndIf EndIf If $mylaptop2 Then IniWrite(@ScriptDir & "\status.ini", "Devices", "My_Laptop", "Online") Else Sleep(60000) If $mylaptop2 = 0 Then IniWrite(@ScriptDir & "\status.ini", "Devices", "My_Laptop", "Offline") EndIf EndIf If $macilan Then IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_LAN", "Online") Else Sleep(60000) If $macilan = 0 Then IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_LAN", "Offline") EndIf EndIf If $maciwlan Then IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_WLAN", "Online") Else Sleep(60000) If $maciwlan = 0 Then IniWrite(@ScriptDir & "\status.ini", "Devices", "maci_WLAN", "Offline") EndIf EndIf EndIf $status = IniRead(@ScriptDir & "\status.ini", "Server status", "Devices Online", "NotFound") $scheduler = IniRead(@ScriptDir & "\status.ini", "Server status", "Scheduler", "NotFound") If ProcessExists("uTorrent.exe") Then ; Sleep(10000) If $status = "Yes" And $scheduler = "Disabled" Then WinActivate("[CLASS:µTorrent4823DF041B09]", "") Send("{CTRLDOWN}") ;sleep(200) Send("p") ;sleep(200) Send("{CTRLUP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{tab}") ;sleep(200) Send("{space}") Send("{enter}") IniWrite(@ScriptDir & "\status.ini", "Server status", "Scheduler", "Enabled") $logstatus = "Scheduler Enabled" If $maciwlan Then $logstatus = $logstatus & "... Maci Wlan Online" If $macilan Then $logstatus = $logstatus & "... Maci Lan Online" If $mylaptop Or $mylaptop2 Then $logstatus = $logstatus & "... My_Laptop Online" If $IP5 Then $logstatus = $logstatus & "... IP5 Online" If $IP6 Then $logstatus = $logstatus & "... IP6 Online" If $IP7 Then $logstatus = $logstatus & "... IP7 Online" If $IP8 Then $logstatus = $logstatus & "... IP8 Online" If $IP9 Then $logstatus = $logstatus & "... IP9 Online" If $IP10 Then $logstatus = $logstatus & "... IP10 Online" $tSystem = _Date_Time_GetSystemTime() $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem)) IniWrite(@ScriptDir & "\log.ini", "Server log", _Date_Time_SystemTimeToDateTimeStr($tLocal), $logstatus) Local $update = InetGetSize("http://downloads.sourceforge.net/scarangel/ipfilter.rar") $size = FileGetSize(@AppDataDir & "\uTorrent\ipfilter.rar") If $update = $size Then WinSetState("[CLASS:µTorrent4823DF041B09]", "", @SW_MINIMIZE) Else WinActivate("[CLASS:µTorrent4823DF041B09]", "") Send("{ALT}") Send("{F}") Send("{X}") Send("{Y}") ProcessWaitClose("uTorrent.exe") Run(@AppDataDir & "\uTorrent\µpdater.bat", @AppDataDir & "\uTorrent\") $tSystem = _Date_Time_GetSystemTime() $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem)) IniWrite(@ScriptDir & "\log.ini", "Server log", _Date_Time_SystemTimeToDateTimeStr($tLocal), "Update done") EndIf EndIf Else ProcessWait("uTorrent.exe") EndIf If ProcessExists("uTorrent.exe") Then ; Sleep(10000) If $status = "No" And $scheduler = "Enabled" Then WinActivate("[CLASS:µTorrent4823DF041B09]", "") Send("{CTRLDOWN}") ;sleep(200) Send("p") ;sleep(200) Send("{CTRLUP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") Send("{UP}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{Down}") ;sleep(200) Send("{tab}") ;sleep(200) Send("{space}") Send("{enter}") IniWrite(@ScriptDir & "\status.ini", "Server status", "Scheduler", "Disabled") $logstatus = "Scheduler Disabled" $tSystem = _Date_Time_GetSystemTime() $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem)) IniWrite(@ScriptDir & "\log.ini", "Server log", _Date_Time_SystemTimeToDateTimeStr($tLocal), $logstatus) Local $update = InetGetSize("http://downloads.sourceforge.net/scarangel/ipfilter.rar") $size = FileGetSize(@AppDataDir & "\uTorrent\ipfilter.rar") If $update = $size Then WinSetState("[CLASS:µTorrent4823DF041B09]", "", @SW_MINIMIZE) Else WinActivate("[CLASS:µTorrent4823DF041B09]", "") Send("{ALT}") Send("{F}") Send("{X}") Send("{Y}") ProcessWaitClose("uTorrent.exe") Run(@AppDataDir & "\uTorrent\µpdater.bat", @AppDataDir & "\uTorrent\") $tSystem = _Date_Time_GetSystemTime() $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem)) IniWrite(@ScriptDir & "\log.ini", "Server log", _Date_Time_SystemTimeToDateTimeStr($tLocal), "Update done") EndIf EndIf Else ProcessWait("uTorrent.exe") EndIf Sleep(60000) WEnd The answer for pinging an IP (e.g. 192.168.0.111) is: Destination host unreachable. This should still be "ping = 0" according to the autoit help file: I also tried "if ping 192.168.0.111 = 0 or 1 or 2 or 3 or 4 then" but that didn't work either. Any ideas? Thanks !
  2. mikell: your way sounds even more complicated :S So I still wonder how to tell the udf that $sRoot is my sftp-folder
  3. Thanks you , your UDF is really nice BUT: How to I tell your udf to use the sftp-folder as $sRoot ?
  4. hmm no one? :/
  5. Hey there, I am working on a "note" app which sync via sftp. I am trying to display all contents of a folder in a tree view (and then I want to select one of the note.txt files in this folder and edit it). Anyway, I am currently stuck at displaying the folder content: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: Script Function: Sync all notes.txt within a folder via sftp #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <SFTPEx.au3> #include <Array.au3> $MainGUI = GUICreate("MyNotes", 984, 841, 259, 141) $Edit1 = GUICtrlCreateEdit("", 208, 72, 755, 729) GUICtrlSetData(-1, "Edit1") $TreeView = GUICtrlCreateTreeView(16, 72, 177, 729, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $ServerGroup = GUICtrlCreateGroup("Server", 16, 8, 195, 49) $ServerInput = GUICtrlCreateInput("ftp.com", 24, 24, 129, 21) $PortInput = GUICtrlCreateInput("1337", 160, 24, 45, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $UserGroup = GUICtrlCreateGroup("User", 218, 8, 145, 49) $UserInput = GUICtrlCreateInput("User", 226, 24, 129, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $PasswordGroup = GUICtrlCreateGroup("Password", 370, 8, 145, 49) $PasswordInput = GUICtrlCreateInput("Password", 378, 24, 129, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group4 = GUICtrlCreateGroup("Status", 522, 8, 145, 49) $Status = GUICtrlCreateLabel("Disconnected", 524, 31, 140, 17, $SS_CENTER) GUICtrlSetColor(-1, 0xFF0000) GUICtrlCreateGroup("", -99, -99, 1, 1) $ConnectButton = GUICtrlCreateButton("Connect", 682, 16, 137, 41) $SavesyncButton = GUICtrlCreateButton("Save / Sync", 826, 16, 137, 41) $mFile_Menu = GUICtrlCreateMenu("File") $mSettings_Item = GUICtrlCreateMenuItem("Einstellungen", $mFile_Menu) $mCheckUp_Item = GUICtrlCreateMenuItem("Update", $mFile_Menu) GUICtrlCreateMenuItem("", $mFile_Menu) $mExit_Item = GUICtrlCreateMenuItem("Exit", $mFile_Menu) $mHelp_Menu = GUICtrlCreateMenu("?") $mAbout_Item = GUICtrlCreateMenuItem("About", $mHelp_Menu) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $mExit_Item Exit Case $ConnectButton $sPath = 'psftp.exe' $hSession = _SFTP_Open($sPath) $sUsername = GUICtrlRead($UserInput) $sPassword = GUICtrlRead($PasswordInput) $sServerName = GUICtrlRead($ServerInput) $iServerPort = GUICtrlRead($PortInput) $hConnection = _SFTP_Connect ( $hSession, $sServerName , $sUsername , $sPassword , $iServerPort ) sleep(2000) Local $Array[10] _SFTP_ListToArray( $hConnection ) sleep(2000) _ArrayDisplay($Array) EndSwitch WEnd
  6. I haven't really changed your version: Opt("TrayMenuMode", 0) TraySetIcon("anOFF.ico") $path4 = "C:whatever" While Sleep(5000) If Not WinExists("SSH-Tunnel") Then TraySetIcon("anOFF.ico") While Not Ping("my-server-domain.com") WEnd Run($path4 & "ssh-tunnel.exe") TraySetIcon("anON.ico") Else TraySetIcon("anON.ico") EndIf WEnd
  7. hmm the "if ping not possible, do not run .exe" loop doesn't seem to work either. When my network goes offline the script just spams the run ssh-tunnel.exe
  8. nope because the process is called putty.exe and i might have multiple putty.exe's open so I renamed the ssh-tunnel-putty.exe window title :/ but I guess I could re-name putty.exe and save it manually somewhere instead of using the installed putty.exe
  9. Well, I put the laptop into sleep mode and then i wake it up ;P
  10. For some reason after a wakeup, the script will run another "SSH-Tunnel.exe" although the original one is still there and active. Any idea on how to fix this?
  11. @Exit: thanks ! @MvGulik: So I have my check if "Run("C:SSH-Tunnel.exe")" was actual successful
  12. As soon as SSH-Tunnel.exe runs, the window "SSH-Tunnel" will be active. As long as this window isn't active, ssh-tunnel.exe didn't run ?
  13. Well that seems awesome but isn't the ping-sleep-ping again code more lightweight than "while not ping" ? Thanks
  14. Hi there, I am working on a script for my homeserver which: Checks if the SSH-Tunnel (Putty) is still active (e.g. if the network time outs, the SSH-Tunnel / Putty will exit) If it is not active anymore, check it the network connection is availabe If not, wait until network is back running Then connect to the SSH-Tunnel again This script should run 24/7 and be as lightweight as possible. I wonder if I could improve it somehow? Opt("TrayMenuMode", 0) TraySetIcon("anOFF.ico") While 1 If WinExists("SSH-Tunnel") Then TraySetIcon("anON.ico") WinWaitClose("SSH-Tunnel") TraySetIcon("anOFF.ico") If Ping("google.at", 250) = 0 Then For $i = 1 to 99999999999999999999999999999999 Step 1 If Ping("google.at", 250) = 0 Then sleep(5000) Else run("C:SSH-Tunnel.exe") ExitLoop EndIf Next Else run("C:SSH-Tunnel.exe") EndIf EndIf WEnd Thanks @edit: I will continue working on the script. I have more ideas/features I want to include. If there are any suggestion so far please let me know ;P
  15. @Mikeman: This is exactly my idea The only problem I currently have is how to read all the version informations from the different software vendors. And yes it would be on a linux server. How ever, the client application would be written in AutoIt @storme: Thanks for the links. My idea is to be able to fully setup a fresh OS and keep it up to date with this app. Export/Important a list of applications and install ALL your favourite software on a new PC with just a few clicks. Upgrade the software, etc. So far I could only find half-working projects or dead projects. Update which weren't able to update already existing installations (so the update would only work if you install the software via the updater.exe) or e.g. filehippo which is giving you links but won't download/install anything automatically. SecuniaPSI does a nice updating job but it won't allow you to install new applications + it's too big for a simple updater/package manager.
  16. Hi, I have this idea already for some months now... I want to code a package manager for windows. I'm not sure if it will have a GUI or be simply a command-line tool. Or maybe both. Anyway, here is where my first real problem comes: How do I detect the latest version of a software? I could do some kind of "hidden" website browsing to check if the latest version has changed but I guess this is: - buggy - costs more time than simply checking a file for the newest version - uses more ressources than checking a simple app-name.txt file Sites like filehippo don't really offer an easy way to find information of the latest version? I also thought about running a "version checker" app on my server. It will scan 24/7 for new versions and safes the version number in a file. The Package Manager itself just has to check this file then. What do you guy think? For the server application I would actually need code it for linux/debian :/ Thanks @edit: is there an easy way to work with mysql-db's on my server? E.g. reading version numbers out of it?
  17. Hi, I would like to sync a file via my linux server. But: I would prefer to first open & use a SSH tunnel before starting to log into the ftp and syncing the file. Using SFTP would be fine too I guess. I couldn't find anything help full via google. The only thing I could imagine right now: Run putty.exe (I'm on Windows 7) with command line options to automatically load the SSH-tunnel session & log into the account. This would mean the ssh tunnel is open and I just need to use an socks5 proxy for localhost:port. Then I could use a simply ftp transfer. I hoped there would be a more "lightweight" solution. Thanks @edit: It looks like winscp.exe is the only solution. its a simple .exe that support command line parameters to connect via sftp + sync folders (winscp.exe /sync /folder1 /folder2).. so I guess I will just run that via autoit
  18. Alright, I will try to get rainmeter to display the latest entries instead of the first ones then.
  19. Thanks, it works just perfectly for my needs I just wonder if this will also work with an .txt file that is 5-20MB ?
  20. Yup.. Windows always puts it at the end of the file :/ Hmm.. what about using smth else than a .ini file? Like .txt?
  21. Hi, I'm working on a little script which controls uTorrent.exe on my homeserver (slow down the upload speed when my laptop or other devices go online, removes the upload limit when no one else is online in the network, updates the ipfilter.dat and also writes all those things into some log file which I display on my servers-desktop via rainmeter). My problem is: I want the logfile (currently log.ini) to display the newest entries first. Is there any way to do so? Thanks
  22. well yes it will overwrite them.. but what if i add the keys in a different alignment e.g. i add: key1=a key2=b key3=c and then i add key1=b key2=c the output would be: key1=b key2=c key3=c or am i wrong? atleast thats what i got when trying it out :S so i tried to make a script which wont overwrite/add anything unless it doesnt exist in the .ini file.. if so, it will add it as a new key with the next logical number. because i wont need/dont want 2 same values. will try to fix the search loop tomorrow thanks
  23. well the script currently adds whatever you select at the bottom of the .ini .. so if you add 20 files , saved & exit , then the next time you open it and add another 5 files, it will be added below those 20 files.. also if they are duplicates.
  24. This is the script i´m currently working on: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <FTPEx.au3> If Not FileExists(@ScriptDir & "\Settings.ini") Then IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "Server", "ftp.myserver1.com") IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "Port", "21") IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "User", "Admin") IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "Password", "123456") EndIf $Server = IniRead(@ScriptDir & "\Settings.ini", "Servermanager", "Server", "NotFound") $Port = IniRead(@ScriptDir & "\Settings.ini", "Servermanager", "Port", "NotFound") $User = IniRead(@ScriptDir & "\Settings.ini", "Servermanager", "User", "NotFound") $Password = IniRead(@ScriptDir & "\Settings.ini", "Servermanager", "Password", "NotFound") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Syncer 0.1", 615, 438, 657, 348) $Server_Label = GUICtrlCreateLabel("Server", 96, 32, 36, 17) $Server_Input = GUICtrlCreateInput($Server, 144, 32, 145, 21) $Port_Label = GUICtrlCreateLabel("Port", 368, 32, 36, 17) $Port_Input = GUICtrlCreateInput($Port, 416, 32, 57, 21) $User_Label = GUICtrlCreateLabel("User", 96, 88, 36, 17) $User_Input = GUICtrlCreateInput($User, 144, 88, 113, 21) $Password_Label = GUICtrlCreateLabel("Password", 96, 128, 36, 17) $Password_Input = GUICtrlCreateInput($Password, 144, 128, 113, 21) $Save_Button = GUICtrlCreateButton("Save", 104, 264, 129, 33) $File_Button = GUICtrlCreateButton("File", 264, 264, 129, 33) $Folder_Button = GUICtrlCreateButton("Folder", 440, 264, 129, 33) $Button4 = GUICtrlCreateButton("Button4", 104, 328, 129, 25) $Button5 = GUICtrlCreateButton("Button5", 264, 328, 129, 33) $Button6 = GUICtrlCreateButton("Button6", 448, 336, 121, 33) ;$hLog_Edit = GUICtrlCreateEdit("", 168, 96, 465, 321) #EndRegion ### END Koda GUI section ### GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Save_Button $Server = GUICtrlRead($Server_Input) IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "Server", $Server) $Port = GUICtrlRead($Port_Input) IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "Port", $Port) $User = GUICtrlRead($User_Input) IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "User", $User) $Password = GUICtrlRead($Password_Input) IniWrite(@ScriptDir & "\Settings.ini", "Servermanager", "Password", $Password) Case $File_Button $File_Var = FileOpenDialog("Select file(s):", "D:\", "All (*.*)|Images (*.jpg;*.bmp;*.png;*.psd;*.gif)|Videos (*.avi;*.mpg;*.mp4;*.mov;*.flv;*.mkv)|Music (*.mp3;*.wav;*.flac;*.cue)", 1 + 2 + 4) ;more If @error Then ContinueLoop $OnlyFileName = StringSplit($File_Var,"|") $Folder = $OnlyFileName[1] $Count = $OnlyFileName[0] While $Count > 1 ; ohne folder .. > 0 = mit folder $Count_Exists = IniReadSection(@ScriptDir & "\Files.ini", "Files") If @error Then ContinueLoop $INI_Lines = 0 For $i = 1 To $Count_Exists[0][0] $INI_Lines = $INI_Lines + 1 Next For $i = 1 To $Count_Exists[0][0] If $Count_Exists[$i][1] = $Folder & "\" & $OnlyFileName[$Count] Then ; If $Count_Exists[$i][0] = $Folder Then ;msgbox(0, "test", $Count_Exists[$i][1] & " is " & $OnlyFileName[$Count]) Else msgbox(0, "test", $Folder & "\" & $OnlyFileName[$Count]) ;msgbox(0, "test", $Count_Exists[$i][1]) IniWrite(@ScriptDir & "\Files.ini", "Files", "File" & $INI_Lines + 1, $Folder & "\" & $OnlyFileName[$Count]) ;EndIf EndIf Next $Count = $Count - 1 ;GUICtrlSetData($hFile, $sTmpFile); GUI will be updated at next iteration Wend Case $Folder_Button $var1 = FileSelectFolder("Choose a folder.", "") EndSwitch WEnd So $File_Button should open a dialog where u can select files.. if those files are already saved inside the files.ini, they wont be added.. so only new files are getting added to the ini. with single files it works.. but when selecting multiple files it wont work.. and i dont get why :S thanks
  25. @Jobs: no not really i was just looking for Stringsplit and other commands which i didnt know/couldnt find.. and propably an idea on how to do that stuff with the editbox & the line-by-line read/write from an .ini @melba23: thanks alot.. stringsplit seems to be exactly what i was looking for.. will try it out as soon as i come home from work also that udf sounds great ! @monoscout: np still you helped me out cause i didnt knew how to use multiple options (e.g. 1 and 4) in the fileopendialog.. but you just showed me how to ;D $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )
×
×
  • Create New...