It is currently Fri Oct 30, 2020 1:45 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: terminal and spaces
PostPosted: Thu Sep 01, 2011 2:26 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 2075
Location: USA
As you can see below, the image name has a space in it. This should work but doesn't. Any thoughts?
Code:
image$ = GetHomeDirectory() + "Desktop/image 2.png"
PreviewFix$ = ReplaceString(image$, " ", "\ ", 1, FindString(image$, " ", 1))
View = RunProgram("open", "-a /Applications/Preview.app " + PreviewFix$, "", #PB_Program_Open)
Debug PreviewFix$
CloseProgram(View)

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: terminal and spaces
PostPosted: Thu Sep 01, 2011 2:49 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3683
Location: Netherlands
How about this ?
Code:
image$ = Chr(34) + GetHomeDirectory() + "Desktop/image 2.png" + Chr(34)
View = RunProgram("open", "-a /Applications/Preview.app " + image$, "", #PB_Program_Open)
CloseProgram(View)


Top
 Profile  
Reply with quote  
 Post subject: Re: terminal and spaces
PostPosted: Thu Sep 01, 2011 7:16 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 2075
Location: USA
wilbert wrote:
How about this ?
Code:
image$ = Chr(34) + GetHomeDirectory() + "Desktop/image 2.png" + Chr(34)
View = RunProgram("open", "-a /Applications/Preview.app " + image$, "", #PB_Program_Open)
CloseProgram(View)

You're awesome, thanks wilbert! ;)

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: terminal and spaces
PostPosted: Wed Jun 17, 2020 2:59 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1131
Location: Portugal
Having similar problem trying to mount a dmg.

hdiutil mount /Users/williamatkin/Documents/World\ Stamp\ Collector/Downloads/WorldStampCollector.dmg

works every time in terminal.

Tried
Code:
   MountDMG.s  = "hdiutil mount " + Chr(34) + "/Users/williamatkin/Documents/World\ Stamp\ Collector/Downloads/WorldStampCollector.dmg" + Chr(34)

RunProgram("open", MountDMG, "", #PB_Program_Open)


and other combinations and it does nothing.

can anyone explain what I am doing wrong?

CD

_________________
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.


Top
 Profile  
Reply with quote  
 Post subject: Re: terminal and spaces
PostPosted: Wed Jun 17, 2020 10:59 am 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 523
collectordave wrote:

can anyone explain what I am doing wrong?

CD


Code:
Command.s  = "mount " + Chr(34) + "/Users/williamatkin/Documents/World\ Stamp\ Collector/Downloads/WorldStampCollector.dmg" + Chr(34)

RunProgram("hdiutil",  Command, "", #PB_Program_Open)


Top
 Profile  
Reply with quote  
 Post subject: Re: terminal and spaces
PostPosted: Wed Jun 17, 2020 1:52 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1854
** Not on a Mac to test right now, but
Code:
MountDMG.s  = "hdiutil mount " + Chr(34) + "/Users/williamatkin/Documents/World\ Stamp\ Collector/Downloads/WorldStampCollector.dmg" + Chr(34)

It looks like you're mixing the double-quote method AND the backslash-space method?

Try taking out the backslashes before those spaces.


I think the backslash-space method is a feature of the Terminal, it is not universal like double-quoting, which I think was J. Baker's issue at the start of this thread.

_________________
On GitHub: PB Includes - IDE Tools - Color Themes - IDE Branches - TabBarGadget Mods


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye